systemd fails to set unit as inactive when using socket activation and the main process has exited
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
systemd |
Fix Released
|
Unknown
|
|||
systemd (Ubuntu) |
Fix Released
|
Critical
|
Unassigned |
Bug Description
systemd 253.5 on Mantic is affected by a bug which makes it fail to mark a unit as inactive even when its main process exited (when using socket activation). This is affecting libvirt and possibly other services.
Upstream has a bug: https:/
which has been fixed by: https:/
To reproduce the problem:
$ lxc launch ubuntu-daily:mantic libvirt-hang --vm
$ lxc shell libvirt-hang
# apt update && apt upgrade -y
# apt install -y libvirt-
# systemctl status libvirtd.service
You'll notice that there is a libvirt process running:
...
CGroup: /system.
├─ 870 /usr/sbin/dnsmasq --conf-
├─ 871 /usr/sbin/dnsmasq --conf-
└─1020 /usr/sbin/libvirtd --timeout 120
...
Wait for two minutes (or edit /etc/default/
root@libvirt-
● libvirtd.service - Virtualization daemon
Loaded: loaded (/lib/systemd/
Active: active (running) since Mon 2023-08-28 23:06:23 UTC; 57s ago
TriggeredBy: ● libvirtd-
● libvirtd.socket
● libvirtd-ro.socket
Docs: man:libvirtd(8)
https:/
Process: 1020 ExecStart=
Main PID: 1020 (code=exited, status=0/SUCCESS)
Tasks: 2 (limit: 32768)
Memory: 22.4M
CPU: 161ms
CGroup: /system.
├─870 /usr/sbin/dnsmasq --conf-
└─871 /usr/sbin/dnsmasq --conf-
...
libvirtd.service is socket-activated, but the fact that it is still considered to be active after the main process exited means that the socket won't be actively listening, and you end up seeing libvirt-related commands hang indefinitely, effectively rendering libvirt useless until you manually restart the service.
Changed in systemd: | |
status: | Unknown → Fix Released |
Changed in systemd (Ubuntu): | |
status: | Triaged → Fix Committed |
no longer affects: | libvirt (Ubuntu) |
This was indeed fixed in v253.6, so let's cherry pick the patch.
https:/ /github. com/systemd/ systemd- stable/ commit/ f29f0877c5abfd0 3060838d1812ea6 fdff3b0b37