[systemd-devel] Unit reported as failed despite exit code from SuccessExitStatus

Nikolaus Rath Nikolaus at rath.org
Thu Apr 16 14:21:15 PDT 2015


On Apr 16 2015, Lennart Poettering <lennart at poettering.net> wrote:
> On Wed, 15.04.15 22:45, Nikolaus Rath (Nikolaus at rath.org) wrote:
>> I don't quite understand this:
>> 
>> $ systemctl --user status autocommit-org.service 
>> ● autocommit-org.service - Auto-commits changes to orgmode files.
>>    Loaded: loaded (/home/nikratio/.config/systemd/user/autocommit-org.service; static)
>>    Active: inactive (dead) since Wed 2015-04-15 22:42:13 PDT; 51s ago
>>  Main PID: 2820 (code=exited, status=1/FAILURE)
>> 
>> Apr 15 22:42:13 vostro systemd[2453]: Starting Auto-commits changes to orgmode fil.....
>> Apr 15 22:42:13 vostro hg[2820]: nothing changed
>> Apr 15 22:42:13 vostro systemd[2453]: Started Auto-commits changes to orgmode files..
>> Hint: Some lines were ellipsized, use -l to show in full.
>> 
>> $ cat /home/nikratio/.config/systemd/user/autocommit-org.service
>> [Unit]
>> Description=Auto-commits changes to orgmode files.
>> 
>> [Service]
>> Type = oneshot
>> WorkingDirectory = %h/lib/Dropbox/org
>> ExecStart = /usr/bin/hg commit -m "Autocommit."
>> SuccessExitStatus = 1
>> 
>> $ systemctl --version
>> systemd 215
>> +PAM +AUDIT +SELINUX +IMA +SYSVINIT +LIBCRYPTSETUP +GCRYPT +ACL +XZ -SECCOMP -APPARMOR
>> 
>> Why is the unit reported as failed? Shouldn't status=1 be interpreted as
>> success?
>
> Sounds like a bug, possibly an issue with type=oneshot together with
> SuccessExitStatus.

Actually it seems to be related to the user of a timer unit to start the
service. When I just start it manually, it works fine. But if I define a
timer:

$ cat autocommit-org.timer 
[Unit]
Description = bla

[Timer]
OnBootSec = 10
OnUnitActiveSec = 30
Unit = autocommit-org.service

Then the problem occurs.

> Can you paste "systemctl show -a" for that service please?

Sure:

$ systemctl --user show -a autocommit-org.service
Type=oneshot
Restart=no
PIDFile=
NotifyAccess=none
RestartUSec=100ms
TimeoutStartUSec=0
TimeoutStopUSec=1min 30s
WatchdogUSec=0
WatchdogTimestamp=
WatchdogTimestampMonotonic=0
StartLimitInterval=10000000
StartLimitBurst=5
StartLimitAction=none
RebootArgument=
FailureAction=none
PermissionsStartOnly=no
RootDirectoryStartOnly=no
RemainAfterExit=no
GuessMainPID=yes
MainPID=0
ControlPID=0
BusName=
StatusText=
Result=success
ExecMainStartTimestamp=Thu 2015-04-16 14:18:32 PDT
ExecMainStartTimestampMonotonic=15216756964
ExecMainExitTimestamp=Thu 2015-04-16 14:18:32 PDT
ExecMainExitTimestampMonotonic=15216834525
ExecMainPID=6794
ExecMainCode=1
ExecMainStatus=1
ExecStart={ path=/usr/bin/hg ; argv[]=/usr/bin/hg commit -m Autocommit. ; ignore_errors=no ; start_time=[Thu 2015-04-16 14:18:32 PDT] ; stop_time=[Thu 2015-04-16 14:18:32 PDT] ; pid=6794 ; code=exited ; status=1 }
Slice=-.slice
ControlGroup=
CPUAccounting=no
CPUShares=18446744073709551615
StartupCPUShares=18446744073709551615
CPUQuotaPerSecUSec=(null)
BlockIOAccounting=no
BlockIOWeight=18446744073709551615
StartupBlockIOWeight=18446744073709551615
MemoryAccounting=no
MemoryLimit=18446744073709551615
DevicePolicy=auto
Environment=
UMask=0022
LimitCPU=18446744073709551615
LimitFSIZE=18446744073709551615
LimitDATA=18446744073709551615
LimitSTACK=18446744073709551615
LimitCORE=18446744073709551615
LimitRSS=18446744073709551615
LimitNOFILE=4096
LimitAS=18446744073709551615
LimitNPROC=30556
LimitMEMLOCK=65536
LimitLOCKS=18446744073709551615
LimitSIGPENDING=30556
LimitMSGQUEUE=819200
LimitNICE=0
LimitRTPRIO=0
LimitRTTIME=18446744073709551615
WorkingDirectory=/home/nikratio/lib/Dropbox/org
RootDirectory=
OOMScoreAdjust=0
Nice=0
IOScheduling=0
CPUSchedulingPolicy=0
CPUSchedulingPriority=0
CPUAffinity=
TimerSlackNSec=50000
CPUSchedulingResetOnFork=no
NonBlocking=no
StandardInput=null
StandardOutput=journal
StandardError=inherit
TTYPath=
TTYReset=no
TTYVHangup=no
TTYVTDisallocate=no
SyslogPriority=30
SyslogIdentifier=
SyslogLevelPrefix=yes
Capabilities=
SecureBits=0
CapabilityBoundingSet=18446744073709551615
User=
Group=
SupplementaryGroups=
PAMName=
ReadWriteDirectories=
ReadOnlyDirectories=
InaccessibleDirectories=
MountFlags=0
PrivateTmp=no
PrivateNetwork=no
PrivateDevices=no
ProtectHome=no
ProtectSystem=no
SameProcessGroup=no
UtmpIdentifier=
SELinuxContext=[unprintable]
AppArmorProfile=[unprintable]
IgnoreSIGPIPE=yes
NoNewPrivileges=no
SystemCallFilter=~
SystemCallArchitectures=
SystemCallErrorNumber=0
Personality=
RestrictAddressFamilies=[unprintable]
RuntimeDirectoryMode=0755
RuntimeDirectory=
KillMode=control-group
KillSignal=15
SendSIGKILL=yes
SendSIGHUP=no
Id=autocommit-org.service
Names=autocommit-org.service
Following=
Requires=basic.target
RequiresOverridable=
Requisite=
RequisiteOverridable=
Wants=-.slice
BindsTo=
PartOf=
RequiredBy=
RequiredByOverridable=
WantedBy=
BoundBy=
ConsistsOf=
Conflicts=shutdown.target
ConflictedBy=
Before=shutdown.target
After=autocommit-org.timer basic.target -.slice home.mount -.mount
OnFailure=
Triggers=
TriggeredBy=autocommit-org.timer
PropagatesReloadTo=
ReloadPropagatedFrom=
JoinsNamespaceOf=
RequiresMountsFor=/home/nikratio/lib/Dropbox/org
Documentation=
Description=Auto-commits changes to orgmode files.
LoadState=loaded
ActiveState=inactive
SubState=dead
FragmentPath=/home/nikratio/.config/systemd/user/autocommit-org.service
SourcePath=
DropInPaths=
UnitFileState=static
InactiveExitTimestamp=Thu 2015-04-16 14:18:32 PDT
InactiveExitTimestampMonotonic=15216757084
ActiveEnterTimestamp=
ActiveEnterTimestampMonotonic=0
ActiveExitTimestamp=
ActiveExitTimestampMonotonic=0
InactiveEnterTimestamp=Thu 2015-04-16 14:18:32 PDT
InactiveEnterTimestampMonotonic=15216834686
CanStart=yes
CanStop=yes
CanReload=no
CanIsolate=no
Job=
StopWhenUnneeded=no
RefuseManualStart=no
RefuseManualStop=no
AllowIsolate=no
DefaultDependencies=yes
OnFailureJobMode=replace
IgnoreOnIsolate=no
IgnoreOnSnapshot=no
NeedDaemonReload=no
JobTimeoutUSec=0
ConditionResult=yes
ConditionTimestamp=Thu 2015-04-16 14:18:32 PDT
ConditionTimestampMonotonic=15216755836
Conditions=[unprintable]
LoadError= ""
Transient=no


$ systemctl --user show -a autocommit-org.timer
Unit=autocommit-org.service
TimersMonotonic=[unprintable]
TimersCalendar=[unprintable]
NextElapseUSecRealtime=0
NextElapseUSecMonotonic=4h 14min 6.757084s
LastTriggerUSec=45y 3month 2w 7h 48min 32.362544s
LastTriggerUSecMonotonic=4h 13min 36.755650s
Result=success
AccuracyUSec=1min
Persistent=no
WakeSystem=no
Id=autocommit-org.timer
Names=autocommit-org.timer
Following=
Requires=
RequiresOverridable=
Requisite=
RequisiteOverridable=
Wants=
BindsTo=
PartOf=
RequiredBy=
RequiredByOverridable=
WantedBy=
BoundBy=
ConsistsOf=
Conflicts=shutdown.target
ConflictedBy=
Before=autocommit-org.service timers.target shutdown.target
After=
OnFailure=
Triggers=autocommit-org.service
TriggeredBy=
PropagatesReloadTo=
ReloadPropagatedFrom=
JoinsNamespaceOf=
RequiresMountsFor=
Documentation=
Description=bla
LoadState=loaded
ActiveState=active
SubState=waiting
FragmentPath=/home/nikratio/.config/systemd/user/autocommit-org.timer
SourcePath=
DropInPaths=
UnitFileState=static
InactiveExitTimestamp=Thu 2015-04-16 14:18:00 PDT
InactiveExitTimestampMonotonic=15185348996
ActiveEnterTimestamp=Thu 2015-04-16 14:18:00 PDT
ActiveEnterTimestampMonotonic=15185348996
ActiveExitTimestamp=
ActiveExitTimestampMonotonic=0
InactiveEnterTimestamp=
InactiveEnterTimestampMonotonic=0
CanStart=yes
CanStop=yes
CanReload=no
CanIsolate=no
Job=
StopWhenUnneeded=no
RefuseManualStart=no
RefuseManualStop=no
AllowIsolate=no
DefaultDependencies=yes
OnFailureJobMode=replace
IgnoreOnIsolate=no
IgnoreOnSnapshot=no
NeedDaemonReload=no
JobTimeoutUSec=0
ConditionResult=yes
ConditionTimestamp=Thu 2015-04-16 14:18:00 PDT
ConditionTimestampMonotonic=15185348946
Conditions=[unprintable]
LoadError= ""
Transient=no


Best,
-Nikolaus
-- 
GPG encrypted emails preferred. Key id: 0xD113FCAC3C4E599F
Fingerprint: ED31 791B 2C5C 1613 AF38 8B8A D113 FCAC 3C4E 599F

             »Time flies like an arrow, fruit flies like a Banana.«


More information about the systemd-devel mailing list