[systemd-devel] one shot service exit-code
Matt Zagrabelny
mzagrabe at d.umn.edu
Tue Oct 31 16:06:55 UTC 2017
Greetings,
I have phone that I plug into my computer and have a udev rule to fire off
a systemd service. Things work well, but the journal indicates that the
command isn't terminating cleanly.
Here is the udev rules. Added for completeness:
% cat /etc/udev/rules.d/90-galaxy-note-3.rules
# Download photos from Galaxy Note 3
ACTION=="add" \
ENV{ID_MTP_DEVICE}=="1" \
ENV{ID_VENDOR_ID}=="04e8" \
ENV{ID_MODEL_ID}=="6860" \
ENV{ID_SERIAL_SHORT}=="17b765cc" \
TAG+="systemd" \
PROGRAM="/bin/systemd-escape --template=download-photos at .service
$env{ID_SERIAL}" \
ENV{SYSTEMD_USER_WANTS}+="%c"
Here is my unit file with a minimal ExecStart that exhibits the problem:
% cat ~/.config/systemd/user/download-photos at .service
[Service]
Type=oneshot
ExecStart=/usr/bin/mate-terminal --command '/bin/cat /dev/null'
Here is the same command executed from a (secondary) terminal:
/usr/bin/mate-terminal --command '/bin/cat /dev/null'
echo $?
0
However here is the journal when I plug in the phone:
Oct 31 10:53:54 eruke systemd[1274]: Starting
download-photos at SAMSUNG_SAMSUNG_Android_17b765cc.service...
Oct 31 10:53:55 eruke systemd[1274]:
download-photos at SAMSUNG_SAMSUNG_Android_17b765cc.service: Main process
exited, code=exited, status=255/n/a
Oct 31 10:53:55 eruke systemd[1274]:
download-photos at SAMSUNG_SAMSUNG_Android_17b765cc.service: Failed with
result 'exit-code'.
Oct 31 10:53:55 eruke systemd[1274]: Failed to start
download-photos at SAMSUNG_SAMSUNG_Android_17b765cc.service.
When I replace "/bin/cat /dev/null" with the actual script to download
photos from the phone I get the same error in the journal. The downloading
script does the job (I get the photos downloaded and the correct output is
in the mate-terminal that systemd spawned) so it is "succeeding", but I
keep getting "Failed" in the journal due to the 'exit-code'.
This issue seems related to the ExecStart having '/usr/bin/mate-terminal'.
If I instead use
ExecStart=/bin/cat /dev/null
in the unit, then I do not get the "Failed with result 'exit-code'" message
in the journal, so the evidence is pointing at the mate-terminal
interaction with systemd.
Does anyone have any ideas how systemd is interacting (killing?) with the
mate-terminal?
Thanks for any pointers!
-m
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/systemd-devel/attachments/20171031/f94ef0fd/attachment.html>
More information about the systemd-devel
mailing list