With systemd v245 as shipped with 20.04, the shutdown sequence does not use the value of `DefaultTimeoutStopSec` to wait for remaining processes, it instead uses the compiled in default of 90s.
This is most visible with services that use `KillMode=process` (docker, k8s, k3s, etc...), especially if the remaining processes do not handle `SIGTERM` or choose to ignore it.
For example:
```
[ OK ] Finished Reboot.
[ OK ] Reached target Reboot.
[ 243.652848 ] systemd-shutdown[1]: Waiting for process: containerd-shim, containerd-shim, containerd-shim, fluent-bit
--- hangs here for 90s even if DefaultTimeoutStopSec is set to a lower value ---
Of course, it would be much better if all the processes would properly handle `SIGTERM`, but having a way to enforce a maximum wait time at shutdown is a decent workaround.
Given that the patch is relatively simple, would it be possible to add it the package for 20.04?
With systemd v245 as shipped with 20.04, the shutdown sequence does not use the value of `DefaultTimeout StopSec` to wait for remaining processes, it instead uses the compiled in default of 90s.
This is most visible with services that use `KillMode=process` (docker, k8s, k3s, etc...), especially if the remaining processes do not handle `SIGTERM` or choose to ignore it.
For example: shutdown[ 1]: Waiting for process: containerd-shim, containerd-shim, containerd-shim, fluent-bit
```
[ OK ] Finished Reboot.
[ OK ] Reached target Reboot.
[ 243.652848 ] systemd-
--- hangs here for 90s even if DefaultTimeoutS topSec is set to a lower value ---
```
The bug has been fixed upstream here: https:/ /github. com/systemd/ systemd/ commit/ 7d9eea2bd3d4f83 668c7a78754d201 b22
Marc was kind enough to package the patch for 20.04 so I could test it (https:/ /launchpad. net/~mdeslaur/ +archive/ ubuntu/ testing/ +sourcepub/ 13210617/ +listing- archive- extra) and with that package, I can confirm that it indeed fixes the issue.
Here's a few github issues I stumbled upon while trying to debug this, along with a short writeup of the workaround I ended up using:
- https:/ /github. com/moby/ moby/issues/ 41831 /github. com/k3s- io/k3s/ issues/ 2400 localhost: 8000/debugging- 90s-hangs- during- shutdown- on-ubuntu- 2004.html
- https:/
- http://
Of course, it would be much better if all the processes would properly handle `SIGTERM`, but having a way to enforce a maximum wait time at shutdown is a decent workaround.
Given that the patch is relatively simple, would it be possible to add it the package for 20.04?
Thanks