Skip to content

Negative ExecCondition triggers SuccessAction #42035

@Anuskuss

Description

@Anuskuss

systemd version the issue has been seen with

260

Used distribution

No response

Linux kernel version used

No response

CPU architectures issue was seen on

None

Component

No response

Expected behaviour you didn't see

If you have the condition in the [Unit] everything works like expected:

[Unit]
ConditionPathExists=/no
SuccessAction=shutdown

[Service]
ExecStart=echo 123
systemd[1]: test.service skipped, unmet condition check ConditionPathExists=/no

However if you have it in the [Service] it'll trigger the SuccessAction (notice how it didn't actually run the ExecStart though):

[Unit]
SuccessAction=shutdown

[Service]
ExecCondition=test -f /no
ExecStart=echo 123
systemd[1]: Starting test.service...
systemd[1]: test.service: Skipped due to 'exec-condition'.
systemd[1]: Condition check resulted in test.service being skipped.

Unexpected behaviour you saw

I guess that this behaviour makes sense to you (or people that ready every single word of the documentation) but to me this is pretty unintuitive. To me it'd make the most sense if ExecCondition behaved the same way like Condition* does but if you don't agree with me I guess a little note in the documentation could suffice.

Steps to reproduce the problem

No response

Additional program output to the terminal or log subsystem illustrating the issue

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions