ExecStop= defined in lxd.service interferes with lxd.socket, causing shutdown to hang
Task Info (Flyspray) | |
---|---|
Opened By | Marcel Menzel (WRMSR) |
Task ID | 72614 |
Type | Bug Report |
Project | Community Packages |
Category | Packages |
Version | None |
OS | All |
Opened | 2021-11-02 14:07:51 UTC |
Status | Assigned |
Assignee | George Rawlinson (rawlinsong) |
Assignee | Morten Linderud (Foxboron) |
Details
Description: LXD being stuck on shutdown because of lxd.socket systemd unit not closing the socket for "lxd shutdown" defined in ExecStop=
Additional info:
- package version(s) LXD 4.19
- config and/or log files etc. Default installation
- link to upstream bug report, if any N/A
Steps to reproduce:
- Install LXD (pacman -S lxd)
- Enable & start it (systemctl enable --now lxd)
- Try to stop lxd (systemctl stop lxd)
It's going to hang, because lxd shutdown (defined in ExecStop) is going to wait till the socket closes, but it's being held open by the lxd.socket file. Masking the lxd.socket (systemctl mask lxd.socket) fixes this problem for me. Also, overriding the lxd.service to have an empty ExecStop= is fixing this problem for me aswell, because LXD does a proper shutdown on receiving a SIGTERM aswell:
^CINFO[11-02|15:07:28] Received signal signal=interrupt INFO[11-02|15:07:28] Starting shutdown sequence
/usr/lib/systemd/system/lxd.service
[Unit] Description=LXD Container Hypervisor After=network-online.target lxcfs.service Requires=network-online.target lxcfs.service lxd.socket Documentation=man:lxd(1)
[Service] Environment=LXD_OVMF_PATH=/usr/share/ovmf/x64 ExecStart=/usr/bin/lxd --group=lxd --logfile=/var/log/lxd/lxd.log ExecStartPost=/usr/bin/lxd waitready --timeout=600 ExecStop=/usr/bin/lxd shutdown TimeoutStartSec=600s TimeoutStopSec=30s Restart=on-failure LimitNOFILE=1048576 LimitNPROC=infinity LimitCORE=infinity TasksMax=infinity Delegate=yes KillMode=process
[Install] WantedBy=multi-user.target
/etc/systemd/system/lxd.service.d/override.conf
[Service] ExecStop=