systemd: Unknown lvalue 'ExecCondition' in section 'Service

palik asked:

Why systemd complains?

Jul  5 09:55:33 st701a-9 systemd[1]: [/etc/systemd/system/load-xyz-modules.service:7] Unknown lvalue 'ExecCondition' in section 'Service'

The service configuration /etc/systemd/system/load-xyz-modules.service:

[Unit]
Description=Load xyz kernel modules

[Service]
RemainAfterExit=yes
Type=oneshot
ExecCondition=/bin/sh -c '***'
ExecStart=/bin/sh -c '***'
ExecStop=/bin/sh -c '***'

[Install]
WantedBy=multi-user.target

If I read the systemd man page correctly, ExecCondition is an option of the section [Service].

Edit:
The issue happened on Debian stretch.

My answer:


Debian 9 has systemd 232, which does not include ExecCondition=. This was added in systemd 243. This means it is also not available in Debian 10, which has only systemd 241. If this functionality is critical, you should choose a different Linux distribution.


View the full question and any other answers on Server Fault.

Creative Commons License
This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.