On 2024-12-11 01:32 +03:00, Andrea Bolognani wrote: > On Mon, Dec 09, 2024 at 11:08:37PM +0300, Alper Nebi Yasak wrote: >> Hello, >> >> I've been having this weird issue for a while. When I try to shut down >> my computer from a desktop environment, I get logged out and see the GDM >> (or LightDM) login screen for about twenty seconds before the system >> continues shutting down. This is a bit confusing/annoying, I can even >> log in during this time but the computer will shutdown anyway. >> >> After downgrading various packages and tinkering a bit, I've managed to >> track it down to libvirt networks. Workarounds I found that fix the problem: >> >> - `virsh -c qemu:///system net-destroy default`, or >> - `systemctl disable --now libvirtd.service`, or >> - Downgrade to 10.8.0-1 (< 10.9.0-1) >> >> I didn't have time to figure out what interacts with what, but I guess >> some weirdness including systemd services? libvirtd.service stays >> running during the twenty seconds and stopping it continues shutdown >> immediately. >> >> I use virt-manager for some VMs, so I have set up a default virtual >> network to start at boot. Apparently libvirtd.service is supposed to >> shut down when nothing is connected (`--timeout 120`), and the virtual >> network prevents this. > > Correct. The timeout will not kick in as long as there are running > domains or active networks, so effectively libvirtd will be up at all > times. > > This is somewhat mitigated on a split daemons deployment, where only > virtnetworkd needs to stay up, but unfortunately we don't have split > daemons in Debian yet. > >> So it keeps running until shutdown, and then >> delays the shutdown, making the display manager show up? >> >> Attaching a `journalctl -b` output, not sure what other logs could help. >> I kind of spent too much time on figuring this much out, I hope it's >> enough for you to reproduce. > > Thanks for taking the time to look into the issue and report it. > > We already have an ticket tracking this upstream: > > https://gitlab.com/libvirt/libvirt/-/issues/695 > > It looks like the fix might be tricky. Hopefully it can be sorted out > before trixie. I'll make sure that upstream doesn't forget about it, > since it disproportionately affects Debian. > > The reason for that is this file: > > $ cat > /usr/lib/systemd/logind.conf.d/unattended-upgrades-logind-maxdelay.conf > [Login] > # delay > InhibitDelayMaxSec=30 > > This overrides the default systemd delay and results in the pause > between when the shutdown is initiated and when it actually happens > to be 30s instead of just 5s. > > In other words, uninstalling the unattended-upgrades packages is an > effective workaround to apply while you wait for the issue to receive > a proper fix.
Thanks for the explanation. Indeed, I can connect over ssh and run `systemd-inhibit --what=shutdown --mode=delay sleep infinity` and get the same behaviour, so it's definitely about the inhibit delay. I guess the login screen showing up during the delay is a different bug somewhere else, maybe in systemd/logind...?