From 9d2513b4c3caa93b174b8a3285db44f07a1cce91 Mon Sep 17 00:00:00 2001 From: Rocker Zhang Date: Fri, 15 May 2026 19:27:57 +0800 Subject: [PATCH] man: clarify that ExecCondition= skip triggers SuccessAction= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Unit-level Condition…= / Assert…= directives that fail prevent activation entirely, so SuccessAction= / FailureAction= never fire. An ExecCondition= skip in [Service] runs as part of the activation transition itself, so the unit goes active → inactive and SuccessAction= is honored. This asymmetry has tripped users up; document it explicitly in both systemd.service(5) (ExecCondition= section) and systemd.unit(5) (SuccessAction= / FailureAction= section) with cross-references. Fixes: https://github.com/systemd/systemd/issues/42035 Co-developed-by: Claude Opus 4.7 (cherry picked from commit 90e3b4cb2653f8a96512da625eb92bc72607a136) (cherry picked from commit 82d3a4911495926ec9c029c6703d5e20647be15c) (cherry picked from commit e9a039d14042f29f8515b88aa94157ab3cb7108d) --- man/systemd.service.xml | 9 +++++++++ man/systemd.unit.xml | 10 ++++++++++ 2 files changed, 19 insertions(+) diff --git a/man/systemd.service.xml b/man/systemd.service.xml index 00c7e823d9f..d7ca9bf8425 100644 --- a/man/systemd.service.xml +++ b/man/systemd.service.xml @@ -463,6 +463,15 @@ signal, etc.), the unit will be considered failed (and remaining commands will be skipped). Exit code of 0 or those matching SuccessExitStatus= will continue execution to the next commands. + Note that an ExecCondition= skip is not equivalent to a + unit-level Condition…= or Assert…= check failing. Because + ExecCondition= runs as part of the activation transition, a skip causes the unit to + transition from active to inactive, and consequently + SuccessAction= (see + systemd.unit5) will be + honored. By contrast, Condition…= directives in the [Unit] section + prevent activation entirely and therefore do not trigger SuccessAction=. + The same recommendations about not running long-running processes in ExecStartPre= also applies to ExecCondition=. ExecCondition= will also run the commands in ExecStopPost=, as part of stopping the service, in the case of any non-zero or abnormal diff --git a/man/systemd.unit.xml b/man/systemd.unit.xml index 4e4b1714c0d..c84a365a96b 100644 --- a/man/systemd.unit.xml +++ b/man/systemd.unit.xml @@ -1108,6 +1108,16 @@ allowed. In user mode, only , , and are allowed. Both options default to . + These actions are tied to the unit's state transitions and fire only when the unit actually + transitions out of an active or activating state. As a + consequence, Condition…= and Assert…= directives that fail do + not trigger SuccessAction= or + FailureAction=: they prevent activation in the first place, so no state transition + occurs. By contrast, the ExecCondition= directive in + systemd.service5 + runs as part of activation, so an ExecCondition= skip will + trigger SuccessAction=. + If is set, no action will be triggered. causes a reboot following the normal shutdown procedure (i.e. equivalent to systemctl reboot). causes a forced reboot which will terminate all