Hi,
When a unit's RuntimeDirectory= contains an escape sequence (for example
because the unit is templated and the instance name is an escaped file
path), starting the service results in the following error:
systemd-executor[28474]: Failed to deserialize: Invalid argument
I first ran into this while trying to start a templated service unit
with an escaped file path as an instance name and a RuntimeDirectory=
containing "%i", but I found that this also affects systemd-journald. In
/usr/lib/systemd/system/[email protected]:
RuntimeDirectory=systemd/journal.%i
To reproduce, start an instance with an escaped namespace name:
sudo systemctl start "$(systemd-escape
[email protected] "foo-bar")"
The system journal:
mei 04 15:45:50 archaeopteryx sudo[28470]: mvancasteren : TTY=pts/3 ;
PWD=/home/mvancasteren ; USER=root ; COMMAND=/usr/bin/systemctl start
systemd-journald@foo\\x2dbar.service
mei 04 15:45:50 archaeopteryx sudo[28470]: pam_unix(sudo:session):
session opened for user root(uid=0) by mvancasteren(uid=1000)
mei 04 15:45:50 archaeopteryx systemd[1]: Listening on
systemd-journald-varlink@foo\x2dbar.socket - Journal Varlink Socket for
Namespace foo\x2dbar.
mei 04 15:45:50 archaeopteryx systemd[1]: Listening on
systemd-journald@foo\x2dbar.socket - Journal Socket for Namespace
foo\x2dbar.
mei 04 15:45:50 archaeopteryx systemd-executor[28474]: Failed to
deserialize: Invalid argument
mei 04 15:45:50 archaeopteryx systemd[1]: Starting
systemd-journald@foo\x2dbar.service - Journal Service for Namespace
foo\x2dbar...
mei 04 15:45:50 archaeopteryx systemd[1]:
systemd-journald@foo\x2dbar.service: Main process exited, code=exited,
status=1/FAILURE
mei 04 15:45:50 archaeopteryx systemd[1]:
systemd-journald@foo\x2dbar.service: Failed with result 'exit-code'.
mei 04 15:45:50 archaeopteryx systemd[1]: Failed to start
systemd-journald@foo\x2dbar.service - Journal Service for Namespace
foo\x2dbar.
mei 04 15:45:50 archaeopteryx systemd[1]:
systemd-journald-varlink@foo\x2dbar.socket: Deactivated successfully.
mei 04 15:45:50 archaeopteryx systemd[1]: Closed
systemd-journald-varlink@foo\x2dbar.socket - Journal Varlink Socket for
Namespace foo\x2dbar.
mei 04 15:45:50 archaeopteryx systemd[1]:
systemd-journald@foo\x2dbar.socket: Deactivated successfully.
mei 04 15:45:50 archaeopteryx systemd[1]: Closed
systemd-journald@foo\x2dbar.socket - Journal Socket for Namespace
foo\x2dbar.
I would expect that a systemd-escape'd instance name should be usable as
a directory name. I did a little digging and it looks like the issue
arises in the deserialization code for `exec-context-directories-` in
`src/core/execute-serialize.c`. How could the issue be solved? Could we
for example add the `EXTRACT_UNESCAPE_RELAX` flag?
Related issue: https://github.com/systemd/systemd/issues/41853