Closed vint66 closed 5 years ago
@vint66 what are the path of your Qemu binaries?
It is /opt/qemu/qemu-4.1/bin/
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/opt/qemu/qemu-4.1/bin:/snap/bin
I have copied qemu into /tmp and started the gns3server with PATH=$PATH:/tmp python3 -m gns3server --local
Then I made request to list all Qemu binaries with curl -X GET "http://127.0.0.1:3080/v2/compute/qemu/binaries"
And I could see the new path. So not sure what is going on here
The binaries must start with "qemu-system" or "qemu-kvm" or just be named "qemu" in order to be listed.
Hi Jeremy,
I'll try to test on fresh install and let you know.
Basically for now I my observations are:
Same issue on fresh install. GNS3 is running as root (in case you will be concerned about permissions).
gns3@gns3:~$ env | grep -i path PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/opt/qemu/qemu-4.1/bin:/snap/bin
gns3@gns3:~$ curl -X GET "http://127.0.0.1:3080/v2/compute/qemu/binaries" [ { "path": "/usr/bin/qemu-system-x86_64", "version": "2.11.1" }, { "path": "/usr/bin/qemu-system-i386", "version": "2.11.1" }
import shutil shutil.which("qemu-system-x86_64") '/usr/bin/qemu-system-x86_64' import os os.environ["PATH"] '/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/opt/qemu/qemu-4.1/bin:/snap/bin'
gns3@gns3:~$ ll /opt/qemu/qemu-4.1/bin/ drwxr-xr-x 2 root root 4096 Sep 27 16:13 ./ drwxr-xr-x 6 root root 4096 Sep 27 16:13 ../ -rwxr-xr-x 1 root root 22512 Sep 27 16:13 elf2dmp -rwxr-xr-x 1 root root 18416 Sep 27 16:13 ivshmem-client -rwxr-xr-x 1 root root 226416 Sep 27 16:13 ivshmem-server -rwxr-xr-x 1 root root 30856 Sep 27 16:13 qemu-edid -rwxr-xr-x 1 root root 370192 Sep 27 16:13 qemu-ga -rwxr-xr-x 1 root root 1754608 Sep 27 16:13 qemu-img -rwxr-xr-x 1 root root 1710064 Sep 27 16:13 qemu-io -rwxr-xr-x 1 root root 1714608 Sep 27 16:13 qemu-nbd -rwxr-xr-x 1 root root 595672 Sep 27 16:13 qemu-pr-helper -rwxr-xr-x 1 root root 15031256 Sep 27 16:13 qemu-system-i386 -rwxr-xr-x 1 root root 15069784 Sep 27 16:13 qemu-system-x86_64 -rwxr-xr-x 1 root root 26848 Sep 27 16:13 virtfs-proxy-helper
Hi Jeremy,
Here is the debug. GNS3 server doesn't even look into my desired directory
Environment: PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/opt/qemu/qemu-4.1/bin:/snap/bin
GNS3 Server debug: 2019-10-05 17:57:49 DEBUG compute.py:509 Attempting request to compute: GET http://127.0.0.1:3080/v2/compute/qemu/binaries {'content-type': 'application/json'} 2019-10-05 17:57:49 DEBUG init.py:147 Searching for Qemu binaries in '/bin' 2019-10-05 17:57:49 DEBUG init.py:147 Searching for Qemu binaries in '/usr/sbin' 2019-10-05 17:57:49 DEBUG init.py:147 Searching for Qemu binaries in '/usr/local/bin' 2019-10-05 17:57:49 DEBUG init.py:147 Searching for Qemu binaries in '/usr/bin' 2019-10-05 17:57:49 DEBUG init.py:147 Searching for Qemu binaries in '/sbin' 2019-10-05 17:57:49 DEBUG init.py:147 Searching for Qemu binaries in '/' 2019-10-05 17:57:49 DEBUG init.py:147 Searching for Qemu binaries in '/usr/local/sbin' 2019-10-05 17:57:49 INFO response.py:58 GET /v2/compute/qemu/binaries 2019-10-05 17:57:49 DEBUG response.py:59 {'Host': '127.0.0.1:3080', 'Content-Type': 'application/json', 'Accept': '/', 'Accept-Encoding': 'gzip, deflate', 'User-Agent': 'Python/3.6 aiohttp/3.5.4', 'Authorization': 'Basic =='} 2019-10-05 17:57:49 DEBUG response.py:61 {} 2019-10-05 17:57:49 INFO response.py:62 Response: 200 OK 2019-10-05 17:57:49 DEBUG response.py:63 {'Connection': 'close', 'X-Route': '/v2/compute/qemu/binaries', 'Server': 'Python/3.6 GNS3/2.2.0', 'Content-Type': 'application/json'} 2019-10-05 17:57:49 DEBUG response.py:65 [{'path': '/usr/bin/qemu-system-x86_64', 'version': '2.11.1'}, {'path': '/usr/bin/qemu-system-i386', 'version': '2.11.1'}] 2019-10-05 17:57:49 INFO web_log.py:233 127.0.0.1 [05/Oct/2019:17:57:49 +0000] "GET /v2/compute/qemu/binaries HTTP/1.1" 200 371 "-" "Python/3.6 aiohttp/3.5.4" 2019-10-05 17:57:49 INFO response.py:58 GET /v2/computes/local/qemu/binaries 2019-10-05 17:57:49 DEBUG response.py:59 {'Host': '1.1.1.1:3080', 'Authorization': 'Basic ==', 'User-Agent': 'GNS3 QT Client v2.2.0', 'Connection': 'Keep-Alive', 'Accept-Encoding': 'gzip, deflate', 'Accept-Language': 'en-US,*'} 2019-10-05 17:57:49 DEBUG response.py:61 {} 2019-10-05 17:57:49 INFO response.py:62 Response: 200 OK 2019-10-05 17:57:49 DEBUG response.py:63 {'Connection': 'close', 'X-Route': '/v2/computes/{compute_id}/{emulator}/{action:.+}', 'Server': 'Python/3.6 GNS3/2.2.0', 'Content-Type': 'application/json'} 2019-10-05 17:57:49 DEBUG response.py:65 [{'path': '/usr/bin/qemu-system-x86_64', 'version': '2.11.1'}, {'path': '/usr/bin/qemu-system-i386', 'version': '2.11.1'}] 2019-10-05 17:57:49 INFO web_log.py:233 10.19.197.149 [05/Oct/2019:17:57:49 +0000] "GET /v2/computes/local/qemu/binaries HTTP/1.1" 200 394 "-" "GNS3 QT Client v2.2.0"
How have you install GNS3 on your remote server? Is GNS3 started by systemd?
I think I found the problem is because systemd doesn't pass the PATH environment variable to GNS3.
To change that, add the Environment
variable to /lib/systemd/system/gns3.service
The file should look like this:
[Unit]
Description=GNS3 server
[Service]
Type=forking
User=gns3
Group=gns3
PermissionsStartOnly=true
Environment="PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/opt/qemu/qemu-4.1/bin/"
ExecStartPre=/bin/mkdir -p /var/log/gns3 /var/run/gns3
ExecStartPre=/bin/chown -R gns3:gns3 /var/log/gns3 /var/run/gns3
ExecStart=/usr/local/bin/gns3server --log /var/log/gns3/gns3.log --logcompression \
--pid /var/run/gns3/gns3.pid --daemon
Restart=on-abort
PIDFile=/var/run/gns3/gns3.pid
[Install]
WantedBy=multi-user.target
Then restart the systemd service:
sudo systemctl daemon-reload
sudo systemctl restart gns3.service
Let me know if this solves the problem on your side.
Hi Jeremy,
Thank you so much for looking into this. Yes, it appears issue with systemd rather with GNS3. I apologies for misbug.
Thanks for the confirmation.
I have added a default Environment for GNS3 service. Please update the VM and edit that file as described above if you want to add custom paths.
I'm trying to have several QEMU versions but $PATH variable doesn't work. Same issue https://github.com/GNS3/gns3-gui/issues/2720
GNS3 v2.2.0rc4, running on remote Ubuntu 18.04 server