Skip to content

Instantly share code, notes, and snippets.

@daharon
Created November 22, 2019 18:15
Show Gist options
  • Save daharon/c088b3ede0d72fd20ac400b3060cca2d to your computer and use it in GitHub Desktop.
Save daharon/c088b3ede0d72fd20ac400b3060cca2d to your computer and use it in GitHub Desktop.
Calling systemd's StartTransientUnit via DBus
# Trying to use the following command and recieving:
# Error: GDBus.Error:System.Error.ENXIO: No such device or address
# StartTransientUnit(in s arg_0,
# in s arg_1,
# in a(sv) arg_2,
# in a(sa(sv)) arg_3,
# out o arg_4);
gdbus call \
--system \
--dest org.freedesktop.systemd1 \
--object-path /org/freedesktop/systemd1 \
--method org.freedesktop.systemd1.Manager.StartTransientUnit \
daharon-test.service \
replace \
"[('ExecStart', <'ls -h'>)]" \
'[]'
@WhyNotHugo
Copy link

WhyNotHugo commented Sep 6, 2021

Did you ever figure out why you got this error? This is the only result on this topic 😅

@jbosboom
Copy link

ExecStart isn't just a string, it's a a(sasb). The array contains commands (there can be more than one for some unit types). In each array element, the string is the pathname to execute and the array of strings is the arguments -- the information for a call to execve. The boolean is an "ignore failure" flag. See after /* Exec container */ in systemd-run run.c.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment