gns3-server icon indicating copy to clipboard operation
gns3-server copied to clipboard

Cannot Start containers

Open EarlRamirez opened this issue 3 years ago • 21 comments

I recently upgraded to GNS3 2.2.32 and I am no longer able to start any containers that were working previously because of the following error exec /gns3/init.sh: no such file or directory

I downgraded to the previous version 2.2.31 and I still getting the same error.

Here is the log from the gns3_server.log Traceback (most recent call last): File "/usr/lib/python3.10/site-packages/gns3server/web/route.py", line 198, in control_schema await func(request, response) File "/usr/lib/python3.10/site-packages/gns3server/handlers/api/compute/docker_handler.py", line 89, in start await container.start() File "/usr/lib/python3.10/site-packages/gns3server/compute/docker/docker_vm.py", line 497, in start raise DockerError(logdata) gns3server.compute.docker.docker_error.DockerError: exec /gns3/init.sh: no such file or directory exec /gns3/init.sh: no such file or directory

In /usr/lib/python3.10/site-packages/gns3server/compute/docker/docker_vm.py line 367 there is * params["Entrypoint"].insert(0, "/gns3/init.sh") # FIXME /gns3/init.sh is not found?*

Does this need to be fixed in the container?

EarlRamirez avatar May 27 '22 02:05 EarlRamirez

An interim solution, line 367 was commented out and the container starts as expected

EarlRamirez avatar May 30 '22 05:05 EarlRamirez

Can you try to start Python and type the following lines?

from gns3server.utils.get_resource import get_resource
get_resource("compute/docker/resources")

Thanks

grossmj avatar Jun 07 '22 16:06 grossmj

Here you go @grossmj

from gns3server.utils.get_resource import get_resource get_resource('compute/docker/resources') '/usr/lib/python3.10/site-packages/gns3server/compute/docker/resources'

EarlRamirez avatar Jun 08 '22 23:06 EarlRamirez

@grossmj where is there a need to insert /gns3/init.sh as an entry point?

EarlRamirez avatar Jun 14 '22 14:06 EarlRamirez

Here you go @grossmj

Thanks, what is the content of /usr/lib/python3.10/site-packages/gns3server/compute/docker/resources?

grossmj avatar Jun 15 '22 13:06 grossmj

Here you go @grossmj

Thanks, what is the content of /usr/lib/python3.10/site-packages/gns3server/compute/docker/resources? image

EarlRamirez avatar Jun 17 '22 13:06 EarlRamirez

Thank you, for some reason the container doesn't get the /gns3 volumes that contain init.sh

Please try to manually start a new container in a terminal to see if you have any error:

docker run -v /usr/lib/python3.10/site-packages/gns3server/compute/docker/resources:/gns3:ro -it ubuntu:latest /bin/bash

grossmj avatar Jun 17 '22 19:06 grossmj

Thank you, for some reason the container doesn't get the /gns3 volumes that contain init.sh

Please try to manually start a new container in a terminal to see if you have any error:

docker run -v /usr/lib/python3.10/site-packages/gns3server/compute/docker/resources:/gns3:ro -it ubuntu:latest /bin/bash

I tried manually and I can see that the volume is mounted in the container

EarlRamirez avatar Jun 17 '22 20:06 EarlRamirez

An interim solution, line 367 was commented out and the container starts as expected

Do you see the volume after you started the container from GNS3?

grossmj avatar Jun 17 '22 22:06 grossmj

An interim solution, line 367 was commented out and the container starts as expected

Do you see the volume after you started the container from GNS3?

Yes, I do but I do not see any other active interfaces with the exception of the loopback

EarlRamirez avatar Jun 18 '22 05:06 EarlRamirez

The interfaces are set up by the /gns3/init.sh script that should be in that volume.

After commenting line 367, do you confirm you see the /gns3/init.sh script inside the container?

Do you have the problem with whatever the container is?

grossmj avatar Jun 18 '22 15:06 grossmj

The interfaces are set up by the /gns3/init.sh script that should be in that volume.

After commenting line 367, do you confirm you see the /gns3/init.sh script inside the container?

Yes, I can confirm that the script is in the container

Do you have the problem with whatever the container is? That is correct, any containers I have the problem with not active network interfaces except for the loopback

EarlRamirez avatar Jun 19 '22 01:06 EarlRamirez

The interfaces are set up by the /gns3/init.sh script that should be in that volume. After commenting line 367, do you confirm you see the /gns3/init.sh script inside the container?

Yes, I can confirm that the script is in the container

Do you have the problem with whatever the container is? That is correct, any containers I have the problem with not active network interfaces except for the loopback

Having the same problem in a GNS3 server 2.2.33.1 running in VMWare Fusion VM in a M1-based MacBook. If I run manually the container in the GNS3 VM with docker run --privileged -v /usr/local/lib/python3.8/dist-packages/gns3server/compute/docker/resources:/gns3:ro -it container_name /bin/sh the file /gns3/init.sh is in the volume but when executed manually at the command prompt, it gives the errors:

/gns3/init.sh: line 77: grep: not found
/gns3/init.sh: line 78: sleep: not found

as in: https://github.com/GNS3/gns3-server/issues/1823

rcanonico avatar Jul 05 '22 17:07 rcanonico

@rcanonico thanks for this info. What container to you use to reproduce the issue?

grossmj avatar Jul 06 '22 13:07 grossmj

@rcanonico thanks for this info. What container to you use to reproduce the issue?

For any of the containers that I use I get the error

EarlRamirez avatar Aug 23 '22 05:08 EarlRamirez

@grossmj any interim solution for this error "exec /gns3/init.sh: no such file or directory?"

EarlRamirez avatar Sep 13 '22 16:09 EarlRamirez

I have added a change for this in v2.2.34: https://github.com/GNS3/gns3-server/commit/129f0a631c0916d5fb9db8d00675f392d5a28636

Do you have the same issue using v2.2.34?

grossmj avatar Sep 13 '22 19:09 grossmj

I have added a change for this in v2.2.34: 129f0a6

Do you have the same issue using v2.2.34?

This change is for grep and sleep not found but not for the original issue I have reported where the container will not start because it cannot find init.sh also this line is still the same in the docker_vm.py In /usr/lib/python3.10/site-packages/gns3server/compute/docker/docker_vm.py line 367 there is * params["Entrypoint"].insert(0, "/gns3/init.sh") # FIXME /gns3/init.sh is not found?*

EarlRamirez avatar Sep 13 '22 20:09 EarlRamirez

Sorry, you are right, that fix is not for this issue. We haven't found how to fix it yet.

grossmj avatar Sep 14 '22 09:09 grossmj

Sorry, you are right, that fix is not for this issue. We haven't found how to fix it yet.

okay, thanks @grossmj

EarlRamirez avatar Sep 18 '22 16:09 EarlRamirez

Sorry, you are right, that fix is not for this issue. We haven't found how to fix it yet.

I will continue to use the interim solution by commenting out line 367 and starting the interface with ip link set eth0 up

EarlRamirez avatar Sep 20 '22 11:09 EarlRamirez

Hi, I faced a similar problem with starting containers on my Nobara Linux (Fedora fork). It seems that /gns3/init.sh wasn't found. But after reading this issue #2069, I went and tried a number of things. Finally I'm able to start my containers and have the interface config (from GNS3) work in my containers.

The problem that I had was the busybox image that was used.

The /usr/lib/python3.10/site-packages/gns3server/compute/docker/resources/bin/busybox version from Nobara/fedora couldn't work. So, I tried to copy the busybox command from docker.io/library/busybox:latest image. Not surprising, it failed too.

A final attempt. I decided to extract Ubuntu focal's busybox static command to try. I downloaded the debian package from launchpad.net http://launchpadlibrarian.net/471755664/busybox-static_1.30.1-4ubuntu6_amd64.deb. Finally it worked.

If I ever face this again, I'll probably just use the GNS3 VM and copy the binary to my local machine. I believe that should work as well because in GNS3 VM, it worked flawlessly.

Thanks.

kelvinlnx avatar Oct 31 '22 08:10 kelvinlnx

Hi, I faced a similar problem with starting containers on my Nobara Linux (Fedora fork). It seems that /gns3/init.sh wasn't found. But after reading this issue #2069, I went and tried a number of things. Finally I'm able to start my containers and have the interface config (from GNS3) work in my containers.

The problem that I had was the busybox image that was used.

The /usr/lib/python3.10/site-packages/gns3server/compute/docker/resources/bin/busybox version from Nobara/fedora couldn't work. So, I tried to copy the busybox command from docker.io/library/busybox:latest image. Not surprising, it failed too.

A final attempt. I decided to extract Ubuntu focal's busybox static command to try. I downloaded the debian package from launchpad.net http://launchpadlibrarian.net/471755664/busybox-static_1.30.1-4ubuntu6_amd64.deb. Finally it worked.

If I ever face this again, I'll probably just use the GNS3 VM and copy the binary to my local machine. I believe that should work as well because in GNS3 VM, it worked flawlessly.

Thanks.

Thanks for the details, I tried what you did with the version of busybox and I get the same error stating the init file cannot be found.

EarlRamirez avatar Oct 31 '22 13:10 EarlRamirez

busybox

I'll try to explain what I did and reconfirm the problem for my case:

Reconfirm it was busybox problem for me, by restoring the wrong file.

$ sudo su -
# cd /usr/lib/python3.10/site-packages/gns3server/compute/docker/resources/bin
# mv busybox busybox.new
# mv busybox.old busybox

Use GNS3 client to start the Ubuntu Docker Guest and I get the "_exec /gns3/init.sh: no such file or directory_" error.

I monitored the gns3_server.log in ~/.config/GNS3/2.2 and saw the following errors when I attempted to start the container.

2022-11-01 11:51:11 INFO ubridge_hypervisor.py:83 Connected to uBridge hypervisor on localhost:37645 after 0.1010 seconds
2022-11-01 11:51:11 **ERROR** docker_vm.py:490 Container UbuntuDockerGuest-1 failed to start
2022-11-01 11:51:11 INFO base_node.py:677 Stopping uBridge hypervisor localhost:37645
2022-11-01 11:51:11 INFO hypervisor.py:208 Stopping uBridge process PID=28949
2022-11-01 11:51:11 **ERROR** docker_vm.py:496 exec /gns3/init.sh: no such file or directory

Without going further with the log files. It shows clearly there is a problem trying to invoke/run the /gns3/init.sh script. So, I edited /usr/lib/python3.10/site-packages/gns3server/compute/docker/docker_vm.py and commented out the whole line that had the /gns3/init.sh line.

# vi  /usr/lib/python3.10/site-packages/gns3server/compute/docker/docker_vm.py
    #params["Entrypoint"].insert(0, "/gns3/init.sh")  # FIXME /gns3/init.sh is not found?

I restarted the GNS3 server by restarting the gns3 client(gui). Now I'm able to start the docker container. Open a console to troubleshoot the container.

# cd /gns3
# ./init.sh
bash: ./init.sh: /gns3/bin/busybox: bad interpreter: No such file or directory
# ls bin
busybox     busybox.new
# /gns3/bin/busybox
bash: /gns3/bin/busybox: No such file or directory

So the lines above show me it was busybox that is having problem. So I tried to manually run the busybox command and that exact error message was displayed.

Next I tried running the busybox.new command (which is the one that worked) and it shows very clearly everything is ok with this version of busybox that I've downloaded.

/gns3/bin/busybox.new 
BusyBox v1.30.1 (Ubuntu 1:1.30.1-4ubuntu6) multi-call binary.
BusyBox is copyrighted by many authors between 1998-2015.
Licensed under GPLv2. See source distribution for detailed
copyright notices.
#output omitted due to too long..

If you are having this same problem, you could try to copy the busybox command from the GNS3 VM provided by gns3.org and save it into this directory /usr/lib/python3.10/site-packages/gns3server/compute/docker/resources/bin. You don't need to stop the container as it's a bind mount. Just try running the new busybox command inside the container after you copy.

If this works, just edit back the /usr/lib/python3.10/site-packages/gns3server/compute/docker/docker_vm.py file and remove the hash(#) for the params... /gns3/init.sh line. This is very important. This is the one that helps us initialize the docker container network interface. This solved the "No such file or directory" error for me, and initialize the network interface based on the configs.

kelvinlnx avatar Nov 01 '22 04:11 kelvinlnx

I'll try to explain what I did and reconfirm the problem for my case:

Thank you very much, @kelvinlnx for the detailed explanation, I used busybox 1.30.1 and it worked. Saw that busybox is a dependency of gns3server which gets downloaded from the OS repository. My containers are working with all the network interfaces available without any hacks.

Thanks again, @kelvinlnx

EarlRamirez avatar Nov 01 '22 05:11 EarlRamirez