Bug 1217306

Summary: distrobox stuck at starting container
Product: [openSUSE] openSUSE Distribution Reporter: Lubos Kocman <lubos.kocman>
Component: ContainersAssignee: Dario Faggioli <dfaggioli>
Status: RESOLVED WORKSFORME QA Contact: E-mail List <qa-bugs>
Severity: Major    
Priority: P5 - None CC: alexandre.vicenzi, danish.prakash, dfaggioli, lubos.kocman
Version: Leap 15.6   
Target Milestone: ---   
Hardware: Other   
OS: Other   
Whiteboard:
Found By: --- Services Priority:
Business Priority: Blocker: ---
Marketing QA Status: --- IT Deployment: ---
Attachments: few seconds of strace -p 5212 2>&1 | tee /tmp/strace-out.log

Description Lubos Kocman 2023-11-19 07:59:25 UTC
Created attachment 870843 [details]
few seconds of strace -p 5212 2>&1 | tee /tmp/strace-out.log

Following happened on Leap 15.6
lkocman@localhost:~/Workspace> distrobox enter mirror
Error: no such container mirror
Cannot find container mirror
Creating the container with command:
  /usr/bin/distrobox-create -i registry.opensuse.org/opensuse/distrobox:latest -n mirror
Trying to pull registry.opensuse.org/opensuse/distrobox:latest...
Getting image source signatures
Copying blob 942e611a39d7 done  
Copying blob 1517c1ea8bb6 done  
Copying config 8372decf75 done  
Writing manifest to image destination
8372decf752e74665fcb94d31b9b378dd1790233ab36b03d37f63dac462e0fbc
Creating 'mirror' using image registry.opensuse.org/opensuse/distrobox:latest	 [ OK ]
Distrobox 'mirror' successfully created.
To enter, run:

distrobox enter mirror

Container mirror is not running.
Starting container mirror
run this command to follow along:

 podman logs -f mirror

 Starting container...                  	

# Stuck here for 30 minutes or so


lkocman@localhost:~/Workspace> ps aux | grep distro
lkocman   5210  0.0  0.0  11096  3328 pts/0    S+   08:13   0:00 /bin/sh /usr/bin/distrobox enter mirror
lkocman   5212  2.1  0.0  11224  3840 pts/0    S+   08:13   0:53 /bin/sh /usr/bin/distrobox-enter mirror
lkocman  27424  0.0  0.0   8212  2304 pts/1    S+   08:56   0:00 grep --color=auto distro


Strace seems that the program itself is busy 

Not sure if this isn't an issue

rt_sigprocmask(SIG_SETMASK, [], NULL, 8) = 0
--- SIGCHLD {si_signo=SIGCHLD, si_code=CLD_EXITED, si_pid=27782, si_uid=1000, si_status=0, si_utime=2, si_stime=0} ---
wait4(-1, 0x7ffc3cd5bbd0, WNOHANG, NULL) = -1 ECHILD (No child processes)
rt_sigreturn({mask=[]})                 = 0
openat(AT_FDCWD, "/home/lkocman/.cache/.mirror.fifo", O_RDONLY) = 3
fcntl(0, F_GETFD)                       = 0
fcntl(0, F_DUPFD, 10)                   = 10
fcntl(0, F_GETFD)                       = 0
fcntl(10, F_SETFD, FD_CLOEXEC)          = 0
dup2(3, 0)                              = 0
close(3)                                = 0
ioctl(0, TCGETS, 0x7ffc3cd5c4f0)        = -1 ENOTTY (Inappropriate ioctl for device)
Comment 1 Lubos Kocman 2023-11-19 08:04:34 UTC
I have seen this behavior on two 15.5 laptops as well. I have not noticed it until now on my 15.6 installation, and I use distrobox on daily basis, but I mostly re-use my existing 4 or similar contianers, and rarely create news ones.
Comment 2 Lubos Kocman 2023-11-19 08:07:23 UTC
Workaround: Killing the process and entering again seem to just work.

Creating 'mirror' using image registry.opensuse.org/opensuse/distrobox:latest	 [ OK ]
Distrobox 'mirror' successfully created.
To enter, run:

distrobox enter mirror

Container mirror is not running.
Starting container mirror
run this command to follow along:

 podman logs -f mirror

 Starting container...                  	



^C
lkocman@localhost:~/Workspace> distrobox enter mirror
lkocman@mirror:~/Workspace>
Comment 3 Lubos Kocman 2023-11-21 08:36:27 UTC
Interestingly it seems to happen also for existing distrobox containers

lkocman@localhost:/etc/openvpn> distrobox enter osc
Container osc is not running.
Starting container osc
run this command to follow along:

 podman logs -f osc

 Starting container...                  	

^C
lkocman@localhost:/etc/openvpn> distrobox enter osc
lkocman@osc:/run/host/etc/openvpn>
Comment 4 Danish Prakash 2023-12-04 06:51:32 UTC
Hi Lubos, which podman and distrobox version are you running? I came across this issue upstream[1][2] that has the fixes merged and discussed. Given you're running Leap, can you try configuring your podman logging driver to "file" in containers.conf?

[1] - https://github.com/89luca89/distrobox/issues/286
[2] - https://github.com/89luca89/distrobox/issues/287
Comment 5 Dario Faggioli 2023-12-06 12:29:42 UTC
(In reply to Danish Prakash from comment #4)
> Hi Lubos, which podman and distrobox version are you running? I came across
> this issue upstream[1][2] that has the fixes merged and discussed. Given
> you're running Leap, can you try configuring your podman logging driver to
> "file" in containers.conf?
> 
> [1] - https://github.com/89luca89/distrobox/issues/286
> [2] - https://github.com/89luca89/distrobox/issues/287

Leap seems to have distrobox 1.4.2, which should have the fixes. But, yes, it's worth checking if the problem could be related to the podman logging configuration.
Comment 6 Lubos Kocman 2023-12-06 12:55:59 UTC
lkocman@localhost:/etc/openvpn> rpm -qa | grep distrobox
distrobox-bash-completion-1.5.0.2-bp156.1.2.noarch
distrobox-1.5.0.2-bp156.1.2.noarch
Comment 7 Lubos Kocman 2023-12-06 12:56:31 UTC
Confirming that it still happens

lkocman@localhost:/etc/openvpn> distrobox enter tw
Container tw is not running.
Starting container tw
run this command to follow along:

 podman logs -f tw

 Starting container...
Comment 8 Dario Faggioli 2023-12-11 12:12:06 UTC
So, I just installed a Tumbleweed VM, and it seems to work there:

> dario@localhost:~> distrobox enter test
> Error: no such container test
> Creating the container test
> Trying to pull registry.opensuse.org/opensuse/distrobox:latest...
> Getting image source signatures
> Copying blob 3f501f5dfd08 done   | 
> Copying blob 2c46e69ca941 done   | 
> Copying config 98f2e40d0f done   | 
> Writing manifest to image destination
> 98f2e40d0f804ddcf8a55d3e8e8905f46bf6c439ead61ac0ed17b4ca02e8cd0f
> Creating 'test' using image registry.opensuse.org/opensuse/distrobox:latest	 [ OK ]
> Distrobox 'test' successfully created.
> To enter, run:
> 
> distrobox enter test
> 
> Starting container...                   	 [ OK ]
> Installing basic packages...            	 [ OK ]
> Setting up devpts mounts...             	 [ OK ]
> Setting up read-only mounts...          	 [ OK ]
> Setting up read-write mounts...         	 [ OK ]
> Setting up host's sockets integration...	 [ OK ]
> Integrating host's themes, icons, fonts...	 [ OK ]
> Setting up package manager exceptions...	 [ OK ]
> Setting up rpm exceptions...            	 [ OK ]
> Setting up distrobox profile...         	 [ OK ]
> Setting up sudo...                      	 [ OK ]
> Setting up groups...                    	 [ OK ]
> Setting up users...                     	 [ OK ]
> Setting up skel...                      	 [ OK ]
> 
> Container Setup Complete!
> dario@test:~> 

Version of distrobox in Tumbleweed is the latest:

> dario@localhost:~> distrobox --version
> distrobox: 1.6.0.1

In /usr/share/containers/containers.conf I have

> # Logging driver for the container. Available options: k8s-file and journald.
> #
> log_driver = "journald"

So, this seems to be either an old distrobox issue or an (old?) podman issue. I'm not sure when I'll be able to spend time debugging distrobox 1.4 or 1.5 on Leap. In fact, if we're still in time (are we, Lubos?), we probably should push 1.6.0.1 to, at least, Leap 15.6.

If it's podman, then I don't really know... :-(
Comment 9 Lubos Kocman 2023-12-11 13:11:03 UTC
lkocman@localhost:/etc/openvpn> grep log_driver /usr/share/containers/containers.conf  
log_driver = "journald"

lkocman@localhost:/etc/openvpn> rpm -q podman distrobox
podman-4.7.2-150600.1.3.x86_64
distrobox-1.5.0.2-bp156.1.2.noarch

If we could update distrobox to 1.6, that would be great.
Comment 10 Lubos Kocman 2023-12-11 13:16:24 UTC
https://build.opensuse.org/request/show/1132491
Comment 11 Lubos Kocman 2023-12-11 13:25:22 UTC
lkocman@localhost:~> distrobox enter tw
+ version=1.5.0.2
+ '[' 2 -eq 0 ']'
++ dirname /usr/bin/distrobox
+ distrobox_path=/usr/bin
+ distrobox_command=enter
+ shift
+ case "${distrobox_command}" in
+ /usr/bin/distrobox-enter tw
Container tw is not running.
Starting container tw
run this command to follow along:

 podman logs -f tw

 Starting container...                  	

# still the same ... but isn't this the problem?

lkocman@localhost:~>  podman logs -f tw
Error: using --follow with the journald --log-driver but without the journald --events-backend (file) is not supported
lkocman@localhost:~>
Comment 12 Lubos Kocman 2023-12-11 13:53:46 UTC
I see that people complained about this before https://github.com/containers/podman/issues/18987
Comment 13 Dario Faggioli 2023-12-11 15:55:09 UTC
(In reply to Lubos Kocman from comment #12)
> I see that people complained about this before
> https://github.com/containers/podman/issues/18987
>
Yeah, they also mention:

> As the error says this is not supported you have to change your event logger to journald or the container logger to k8s-file. You can set this in containers.conf, see log_driver and events_logger.

Which is what I meant when I said it might be a podman issue.

distrobox should have a workaround for that, and I honestly don't see why it would not work... But, anyway, let's first check how things are with the newest release of distrobox in place.
Comment 14 Lubos Kocman 2023-12-12 10:11:37 UTC
I do agree Dario. I do have an update request for docker too, I'll check if there are any requests for SLES (aside for SLEM) to update docker.

The problem that I see is that next container host (SLEM 6.X) is already ALP based, so there is an extra effort to ensure updates land also in codestream 15.
Comment 15 Lubos Kocman 2023-12-12 10:27:41 UTC
https://jira.suse.com/browse/PED-7483
Comment 16 Lubos Kocman 2024-03-06 22:37:50 UTC
Interestingly this issue still happens on 15.6 Beta (I'm using podman)


lkocman@localhost:~> rpm -qa | egrep "distrobox|podman|docker|container"
libcontainers-common-20230913-150600.1.1.noarch
distrobox-1.6.0.1-bp156.1.1.noarch
docker-24.0.5_ce-150600.200.47.x86_64
podman-4.7.2-150600.1.37.x86_64
docker-bash-completion-24.0.5_ce-150600.200.47.noarch
containerd-1.7.10-150000.106.1.x86_64
libcontainers-default-policy-20230913-150600.1.1.noarch
docker-buildx-0.11.2-bp156.1.8.x86_64
docker-rootless-extras-24.0.5_ce-150600.200.47.noarch
distrobox-bash-completion-1.6.0.1-bp156.1.1.noarch

lkocman@localhost:~> distrobox enter tw
Starting container...
Comment 17 Alexandre Vicenzi 2024-06-20 13:21:41 UTC
I believe this is related to log driver Bug 1199871. I can still reproduce distrobox creation getting stuck.

While digging it for Bug 1221278 I noticed it was stuck due to a failed attempt to follow the log to check if the container had started/finished setting up.
Comment 18 Lubos Kocman 2024-06-20 13:27:08 UTC
Not on my machine any more :-) Or at lest I do get different error, but it's no longer stuck. So imho this is resolved, and we should open a new issue.
Comment 19 Alexandre Vicenzi 2024-06-20 13:29:43 UTC
(In reply to Lubos Kocman from comment #18)
> Not on my machine any more :-) Or at lest I do get different error, but it's
> no longer stuck. So imho this is resolved, and we should open a new issue.

Which OS, podman, and distrobox version you have? I can re-test to ensure it got fixed since the last time I tried.
Comment 20 Lubos Kocman 2024-06-20 13:51:12 UTC
Leap 15.6 / x86_64

lkocman@localhost:~> rpm -q distrobox podman docker
distrobox-1.7.2.1-bp156.1.1.noarch
podman-4.8.3-150500.3.9.1.x86_64
package docker is not installed
Comment 21 Alexandre Vicenzi 2024-07-18 07:52:47 UTC
(In reply to Lubos Kocman from comment #18)
> Not on my machine any more :-) Or at lest I do get different error, but it's
> no longer stuck. So imho this is resolved, and we should open a new issue.

I'm not able to reproduce it as well. Closing this as suggested.

Feel free to create a new issue if you see fit.