Systemd tip: service conditionals

Josh Boyer jwboyer at
Tue May 21 14:23:41 UTC 2013

On Tue, May 21, 2013 at 10:12 AM, Lennart Poettering
<mzerqung at> wrote:
> On Tue, 21.05.13 14:08, Simone Caronni (negativo17 at wrote:
>> Hello,
>> thanks for the tip.
>> On 16 May 2013 20:41, Adam Williamson <awilliam at> wrote:
>> > It's really neat stuff, and very easy to use: you just add a
>> > Condition(Something) statement to the .service file. For details on
>> > using these conditions, see 'man systemd.unit' and just search for
>> > Condition, and you'll find a list of all the available Conditions and
>> > how to use them.
>> >
>> I have a question though, what is the best option in your opinion for a
>> service that should start only on a UEFI based system?
> /sys/firmware/efi only exists on EFI boots. In systemd you hence may use:
> ConditionPathExists=/sys/firmware/efi
>> If there's a way to check if Secure Boot is enabled that would be
>> great.
> There is an EFI var for that, but with systemd conditions you can only
> check for existance of EFI vars, not values, so this is currently not
> doable with systemd nicely.

You actually have to check two values anyway.  The SecureBoot variable
needs to be 1 and the SetupMode variable needs to be 0.  I don't think
it would be difficult for someone to write a small utility to check
for Secure Boot.


More information about the devel mailing list