How to debug systemd unit ExecStart
Solution 1:
Unfortunately there is no built in way. To see the final ExecStart you can turn on debugging. Edit the file /etc/systemd/system.conf
and set the LogLevel=
to debug
. Then you will see something like:
java.service About to execute: /usr/bin/java $OPTS_COMMON...
This doesn't solve your problem but it is good to see the systemd's specifier replacement. https://www.freedesktop.org/software/systemd/man/systemd.unit.html(specifiers)
But if you really want to get to the bottom of argument replacement you need to look in to here: https://github.com/systemd/systemd/blob/7ce9cc154576e342015eab8c1500790a9ededc01/src/core/execute.c#L2570
Solution 2:
In *.service file in section [Service]
ExecStartPre=/bin/bash -l -c 'echo "$OPTS_COMMON">/tmp/options.debug'