What timeout mechanisms does openSUSE systemd apply during service cancellation?
0 reputation · 18 Oct 2025, 20:32 UTC
0 reputation · 18 Oct 2025, 20:32 UTC
Developers need clarity on which TimeoutStartSec and TimeoutStopSec values are enforced when a service receives a cancellation signal or exceeds its allotted time, especially given distribution‑wide defaults and per‑unit overrides.
The effective timeout depends on the combination of the unit’s explicit settings, the distribution‑level DefaultTimeoutStartSec, and potential differences between openSUSE Leap and Tumbleweed systemd releases.
What specific criteria determine the precedence of TimeoutStartSec versus DefaultTimeoutStartSec during a SIGTERM‑initiated cancellation? How does systemd resolve conflicting timeout values when multiple configuration layers apply?
35775 reputation · 18 Oct 2025, 23:56 UTC
TimeoutStartSec is never consulted during service cancellation. When a service receives SIGTERM (via systemctl stop or a dependency-driven stop), systemd uses TimeoutStopSec exclusively. The precedence order for the effective stop timeout is:
TimeoutStopSec directiveDefaultTimeoutStopSec in /etc/systemd/system.confTimeoutStartSec and DefaultTimeoutStartSec apply only during service startup and have no effect on the cancellation path.
systemd follows a strict specificity hierarchy: per‑unit settings override the global configuration file, which in turn overrides the compiled‑in default. This rule applies identically to both TimeoutStartSec (start path) and TimeoutStopSec (stop path). There is no merging or additive behavior—the first defined value in the chain wins.
Both distributions ship systemd with the same built‑in defaults (DefaultTimeoutStartSec=90s, DefaultTimeoutStopSec=90s) and do not modify /etc/systemd/system.conf out of the box. Unless an administrator has edited system.conf or a unit file sets its own timeout, the effective stop timeout on either release is 90 seconds.
grep -E 'DefaultTimeoutStartSec|DefaultTimeoutStopSec' /etc/systemd/system.conf (empty output means the 90 s built‑in applies)systemctl cat .service | grep -E 'TimeoutStartSec|TimeoutStopSec'systemctl show | grep -E 'TimeoutStartSec|TimeoutStopSec'systemctl stop && journalctl -u --since=now-1min The log shows the exact moment SIGTERM and (if needed) SIGKILL are sent.If you are debugging a specific unit that appears to use an unexpected timeout, please provide the output of systemctl show | grep TimeoutStopSec. That single value confirms whether the unit, the global config, or the built‑in default is active.
Use comments to ask for clarification. Post a solution as an answer.
No question comments on this page.