systemd-shutdown.service override timout as its take 90 seconds

Asked by Nalin Gupta

Hi

In short,
I see systemd-shutdown.service but it has no unit files.
I wish to set TimeoutStopSec to lesser value only for it ONLY,
by way other than editing DefaultTimeoutStopSec in file /etc/systemd/system.conf.

I tried for systemd-poweroff.service in its unit file, but it didnot help to reduce delay.

As logs indicates systemd-shutdown plays major role, so I assume it may help me.
Pls Correct me.

thanks.

In detail,

# systemctl show systemd-shutdown.service -p Description
Description=systemd-shutdown.service

# systemctl show systemd-shutdown.service -p TimeoutStopUSec
TimeoutStopUSec=90s

# systemctl cat systemd-shutdown.service
No files found for systemd-shutdown.service.

root@tpvm:~# systemctl set-property systemd-shutdown.service TimeoutStopSec=8s
Failed to set unit properties on systemd-shutdown.service: Unit systemd-shutdown.service not found.

Ques)
Probably Above is not allowed at runtime,
But I wonder, how & why editing /etc/systemd/system.conf & systemctl daemon-reload works. ??

90 seconds delay seems to be lot discussed issue. But I could not find conclusive comment, except for reducing

# grep DefaultTimeoutStopSec /etc/systemd/system.conf
#DefaultTimeoutStopSec=90s to come less value.

I'm new to systemd.

I see above reduces TimeoutStopUSec for all/many systemd units like
* systemd-shutdown.service
* systemd-poweroff.service
* plymouth-poweroff.service
* mdadm-shutdown.service
* snapd.system-shutdown.service
* halt.service
* systemd-halt.service
* plymouth-halt.service

We are using qemu/kvm based Guest Ubuntu 18.04.4 LTS with

# systemctl --version
systemd 237

So either calling
       'shutdown -h -P +0' from its root prompt or
from Host
        virsh shutdown --mode=agent VMNAME

Both of above works fine on normal system and it shuts immediately.

But when we deploy our collection of containers/k3s based services etc,

then above takes 90secs.

From systemd logs for shutdown,

I could see following set of processes
are not gracefully shut and killed by SIGKILL (90s delay)

.....
[ 995.336946] systemd-shutdown[1]: Sending SIGTERM to remaining processes...
[ 995.362188] systemd-udevd[21195]: value '[dmi/id]sys_vendor' is 'QEMU'
[ 995.362582] systemd-udevd[21195]: value '[dmi/id]sys_vendor' is 'QEMU'
[ 995.363027] systemd-journald[420]: Received SIGTERM from PID 1 (systemd-shutdow).
......
[ 1085.373701] systemd-shutdown[1]: Sending SIGKILL to remaining processes...
[ 1085.379698] systemd-shutdown[1]: Sending SIGKILL to PID 2501 (containerd-shim).
[ 1085.379860] systemd-shutdown[1]: Sending SIGKILL to PID 2523 (containerd-shim).
[ 1085.380038] systemd-shutdown[1]: Sending SIGKILL to PID 2568 (containerd-shim).
[ 1085.380214] systemd-shutdown[1]: Sending SIGKILL to PID 2579 (containerd-shim).
[ 1085.380392] systemd-shutdown[1]: Sending SIGKILL to PID 3289 (containerd-shim).
[ 1085.380545] systemd-shutdown[1]: Sending SIGKILL to PID 3347 (containerd-shim).
[ 1085.380722] systemd-shutdown[1]: Sending SIGKILL to PID 3384 (containerd-shim).
[ 1085.380873] systemd-shutdown[1]: Sending SIGKILL to PID 3872 (containerd-shim).
[ 1085.381031] systemd-shutdown[1]: Sending SIGKILL to PID 4286 (containerd-shim).
[ 1085.381213] systemd-shutdown[1]: Sending SIGKILL to PID 4365 (containerd-shim).
[ 1085.381370] systemd-shutdown[1]: Sending SIGKILL to PID 4658 (containerd-shim).
[ 1085.381528] systemd-shutdown[1]: Sending SIGKILL to PID 4803 (containerd-shim).
[ 1085.381744] systemd-shutdown[1]: Sending SIGKILL to PID 5035 (containerd-shim).
[ 1085.381919] systemd-shutdown[1]: Sending SIGKILL to PID 5131 (containerd-shim).
[ 1085.382074] systemd-shutdown[1]: Sending SIGKILL to PID 5232 (containerd-shim).
[ 1085.382246] systemd-shutdown[1]: Sending SIGKILL to PID 5361 (containerd-shim).
[ 1085.382399] systemd-shutdown[1]: Sending SIGKILL to PID 5569 (system).
[ 1085.382730] systemd-shutdown[1]: Sending SIGKILL to PID 5607 (containerd-shim).
[ 1085.382951] systemd-shutdown[1]: Sending SIGKILL to PID 6886 (auth).
[ 1085.384749] systemd-shutdown[1]: Sending SIGKILL to PID 6918 (openstack).
[ 1085.386989] systemd-shutdown[1]: Sending SIGKILL to PID 9295 (rbac).
[ 1085.389934] systemd-shutdown[1]: Sending SIGKILL to PID 9614 (hyperv).
[ 1085.392324] systemd-shutdown[1]: Sending SIGKILL to PID 9771 (fabric).
[ 1085.395521] systemd-shutdown[1]: Sending SIGKILL to PID 9853 (ts-server).
[ 1085.401282] systemd-shutdown[1]: Sending SIGKILL to PID 9911 (vcenter).
[ 1085.401447] systemd-shutdown[1]: Sending SIGKILL to PID 10032 (inventory).

Question information

Language:
English Edit question
Status:
Expired
For:
Ubuntu systemd Edit question
Assignee:
No assignee Edit question
Last query:
Last reply:
Revision history for this message
Nalin Gupta (pub2ng) said :
#1

Just to add to my above question

I tried

systemctl edit --force systemd-shutdown.service

which created override.cond, somewhere under /etc/systemd/system/systemd-shutdown.d/...

I populated it with

[Service]
TimeoutStopSec=9s

Then did daemon-reload and also rebooted, but it had no impact.

thanks

Revision history for this message
Launchpad Janitor (janitor) said :
#2

This question was expired because it remained in the 'Open' state without activity for the last 15 days.