distrobox icon indicating copy to clipboard operation
distrobox copied to clipboard

[Error] Containers do not gracefully stop on pc shutdown

Open Meister1593 opened this issue 2 years ago • 6 comments

Describe the bug When shutting down pc, i constantly get message about not-stopping libpod containers, which goes for around 1.5 minutes (probably a timeout, but not by systemd, it's 2 minutes for systemd) and only then pc shuts down.

To Reproduce

  1. Open 1 or more container, do something in it, maybe even open background process within
  2. Try to shutdown

Expected behavior Shutdown shouldn't be interrupted by containers and gracefully shutdown after just a few seconds.

Logs i don't really know how to capture those logs? please tell me how to do it better

Desktop (please complete the following information): Fedora silverblue 36.20220617.0 podman version 4.1.0 distrobox: 1.3.1

Additional context I'm not quite sure if this is a bug for distrobox or in general podman, but... 90% of the time i can stop containers with distrobox-stop before shutting down pc and it would work just fine. Other 10% is when distrobox-stop results in something like container has active exec sessions, refusing to clean up: container state improper and they don't really stop (and distrobox thinks they are stopped by the way, list shows so), thus forced to be time-outed on pc shutdown.

Meister1593 avatar Jun 27 '22 16:06 Meister1593

Hi @Meister1593

sadly this is a known podman issue: https://github.com/containers/podman/issues/14531 https://bugzilla.redhat.com/show_bug.cgi?id=2084498

Cannot do much on my side, closing as this is not distrobox related

89luca89 avatar Jun 27 '22 21:06 89luca89

Hi @Meister1593

sadly this is a known podman issue: containers/podman#14531 https://bugzilla.redhat.com/show_bug.cgi?id=2084498

Cannot do much on my side, closing as this is not distrobox related

Hello are you sure that this is upstream bug? it seems like any bash/sh/zsh/etc... sessions can't be stopped just by doing podman stop (thus, by using distrobox-stop), because it doesn't send signal to close shell... Shells ignore SIGTERM that is sent by podman stop so the only way they can be stopped is either SIGKILL or proper exit (i couldn't find exact code it uses for that) for shell.

can this be done within distrobox?

Meister1593 avatar Jun 28 '22 15:06 Meister1593

you mean this happens if you shut down with some terminals open with distrobox running?

If that's the case, it is the same as trying to shut down with a

podman run -it container:tag /bin/bash

Distrobox just uses podman or docker, so it cannot be related to distrobox itself, but to the tool it uses. In this case podman.

89luca89 avatar Jun 28 '22 16:06 89luca89

Upstream says it's a distrobox/toolbox bug: https://github.com/containers/podman/issues/14531#issuecomment-1168883575.

I'm not convinced it's a downstream bug but it seems both projects should communicate to figure out what's going on. I have no knowledge of podman nor distrobox internals.

1player avatar Jun 28 '22 16:06 1player

Let's reopen this and see if we can find a solution either down or upstram

89luca89 avatar Jun 28 '22 16:06 89luca89

I don't reboot my workstation often, but I haven't noticed it happening in the past month or so. Also, Fedora 37 will be shortening the shutdown timer from 2 minutes to 15 seconds IIRC, so if this still happens it will be mostly invisible (and perhaps masking the actual issue even further)

1player avatar Aug 18 '22 07:08 1player

This should be fixed by https://github.com/containers/podman/pull/16785

89luca89 avatar Feb 10 '23 16:02 89luca89