[systemd-devel] Is %i supported in Condition?

Lennart Poettering mzerqung at 0pointer.de
Tue Jul 19 10:06:49 UTC 2016


On Tue, 19.07.16 00:32, Michael Biebl (mbiebl at gmail.com) wrote:

> Hi,
> 
> the systemd.unit man page is not quite clear on this, i.e. which
> settings support which specifiers.
> But maybe I just missed it.

It is supported.

I figure instead of documenting which options support specifier
expansion and which ones do not we should rather fix all options to
support it...

> I was wondering if I can use
> 
> ConditionPathExists=/dev/%i
> 
> Seems like this would e.g. be useful in getty at .service, which currently has
> ConditionPathExists=/dev/tty0
> 
> This seems rather arbitrary to hard-code this to tty0

"tty0" is a nice way to detect whether the VC system is available. The
instances should be cleanly skipped if the VC system is not available
(because compiled out of the kernel, or because of a container
env). If the specific tty the service is started for is missing we
shouldn't eat up the error however, but rightly fail.

A lot of the C code in systemd does a similar check for /dev/tty0 too
to see if the VC is available.

Or to say this differently: this is a check that should verify whether
the whole VC subsystem is there, it's not supposed to be a check for
the specific TTY device.

Or to say this even diffently: I am pretty sure that "systemctl start
getty at idontexist.service" should resultin an error, and not be eaten
up without comment.

Hope that makes sense?

Lennart

-- 
Lennart Poettering, Red Hat


More information about the systemd-devel mailing list