[systemd-devel] Accpetance of Environment Variables in Attributes

Ede Wolf listac at nebelschwaden.de
Thu Jun 25 11:24:10 UTC 2020


So I have an environmentfile containing two variable definitions:

RUNASUSER=nobody
MEM=4294967296

And my service section reads:

[Service]
EnvironmentFile=/path/myfile
User=$RUNASUSER
LimitMEMLOCK=$MEM

This service failes to startup, as I cannot seem to being able to  use a 
variable for the User attribute, but I may very well for LimitMEMLOCK.

Error:

Failed to determine user credentials: No such process


And if specifying instead:

[Service]
EnvironmentFile=/path/myfile
User=nobody
LimitMEMLOCK=$MEM

Everything does work. And I am wondering, why? And moreover, is there 
any source of documentation, that lists or even explains, what 
attributes may have a variable as an argument and what do not?

As for instances/template units it would be really helpful to being able 
to set the running user in the configuration/environment file. Or at 
least have a knowledge of those settings, that do not allow this, for 
what reason ever. Especially when talking about directory settings.



More information about the systemd-devel mailing list