System loads and shutdown timeout

Date: 2023/07/01 (initial publish), 2024/02/23 (last update)

Source: en/note-00048.md

Previous Post Top Next Post

TOC

Here is a memo to make a Linux system run and shutdown smoothly and quickly.

Ruducing system loads

I have edited Settings -> Search menu to disable background jobs.

Currently, I disabled everything. This seems to reduce CPU loads from the following process names:

Quick workaround for timeout

Edit /etc/systemd/system.conf to reduce timeout from default 100s according to systemd-system.conf(5):

 DefaultTimeoutStartSec=, DefaultTimeoutStopSec=,
 DefaultTimeoutAbortSec=, DefaultRestartSec=
     Configures the default timeouts for starting, stopping and aborting
     of units, as well as the default time to sleep between automatic
     restarts of units, as configured per-unit in TimeoutStartSec=,
     TimeoutStopSec=, TimeoutAbortSec= and RestartSec= (for services, see
     systemd.service(5) for details on the per-unit settings). Disabled
     by default, when service with Type=oneshot is used. For non-service
     units, DefaultTimeoutStartSec= sets the default TimeoutSec= value.
     DefaultTimeoutStartSec= and DefaultTimeoutStopSec= default to 90s.
     DefaultTimeoutAbortSec= is not set by default so that all units fall
     back to TimeoutStopSec=.  DefaultRestartSec= defaults to 100ms.

This can be a quick workaround to reduce time to shutdown from 100s to 60s without knowing the offending process.

This is not the root cause fix.

Root cause fix for timeout

Setting up proper shutdown sequence is the root cause fix.

For example, I edited the seemingly offending *.service files such as /lib/systemd/user/tracke~er-fs-control-3.service by adding dependency as:

[Unit]
...
Conflicts=shutdown.target initrd-switch-root.target
Before=shutdown.target initrd-switch-root.target

[Service]
...

This seemed to help avoid waiting for timeout.

Previous Post Top Next Post