View Issue Details

IDProjectCategoryView StatusLast Update
0007894CentOS-7systemdpublic2014-12-02 17:30
Reporterphlack Assigned To 
PriorityhighSeveritymajorReproducibilityalways
Status newResolutionopen 
PlatformVirtualBox VMOSCentOSOS Version7
Product Version7.0-1406 
Summary0007894: Unit files do not seem to respect StopWhenUnneeded=true/yes
DescriptionI'm attempting to set several services up to require an authentication service and it should die if none of them are running. Here are the contents of the .service file for the auth service:

##############################################################

root@centos7 [~]# cat /etc/systemd/system/authdaemond.service
[Unit]
ConditionPathExists=!/etc/eximdisable
ConditionPathExists=!/var/cpanel/dnsonly
Description=Courier authentication daemon
#PartOf=courier-imapd.service courier-imapd-ssl.service courier-pop3d.service courier-pop3d-ssl.service exim.service
StopWhenUnneeded=true

[Service]
Type=forking
PIDFile=/var/spool/authdaemon/pid
EnvironmentFile=/etc/authlib/authdaemonrc
ExecStart=/usr/sbin/courierlogger -pid=/var/spool/authdaemon/pid $LOGGEROPTS -start /usr/libexec/courier-authlib/authdaemond

[Install]
WantedBy=multi-user.target

##############################################################

These are the requires I mentioned:

##############################################################

root@centos7 [~]# grep authdaemond /etc/systemd/system/{courier,exim}* | grep Requires
/etc/systemd/system/courier-imapd.service:Requires=authdaemond.service
/etc/systemd/system/courier-imapd-ssl.service:Requires=authdaemond.service
/etc/systemd/system/courier-pop3d.service:Requires=authdaemond.service
/etc/systemd/system/courier-pop3d-ssl.service:Requires=authdaemond.service
/etc/systemd/system/courier.service:Requires=authdaemond.service
/etc/systemd/system/exim.service:Requires=authdaemond.service

##############################################################

Stopping all of those services has no effect on authdaemond:



root@centos7 [~]# systemctl status authdaemond courier courier-imapd courier-imapd-ssl courier-pop3d courier-pop3d-ssl exim | egrep "\.service -|Active"
authdaemond.service - Courier authentication daemon
   Active: active (running) since Mon 2014-11-17 12:29:24 EST; 31min ago
courier-imapd.service - Courier IMAP Mail Server
   Active: active (running) since Mon 2014-11-17 13:00:06 EST; 23s ago
courier-imapd.service - Courier IMAP Mail Server
   Active: active (running) since Mon 2014-11-17 13:00:06 EST; 23s ago
courier-imapd-ssl.service - Courier IMAP SSL Mail Server
   Active: active (running) since Mon 2014-11-17 13:00:06 EST; 23s ago
courier-pop3d.service - Courier POP3 Mail Server
   Active: active (running) since Mon 2014-11-17 13:00:06 EST; 23s ago
courier-pop3d-ssl.service - Courier IMAP SSL Mail Server
   Active: active (running) since Mon 2014-11-17 13:00:06 EST; 23s ago
exim.service - Exim is a Mail Transport Agent, which is the program that moves mail from one machine to another.
   Active: active (running) since Mon 2014-11-17 13:00:06 EST; 23s ago



root@centos7 [~]# systemctl stop courier-imapd courier-imapd-ssl courier-pop3d courier-pop3d-ssl exim
root@centos7 [~]# systemctl daemon-reload
root@centos7 [~]# systemctl status authdaemond courier courier-imapd courier-imapd-ssl courier-pop3d courier-pop3d-ssl exim | egrep "\.service -|Active"
authdaemond.service - Courier authentication daemon
   Active: active (running) since Mon 2014-11-17 12:29:24 EST; 31min ago
courier-imapd.service - Courier IMAP Mail Server
   Active: inactive (dead) since Mon 2014-11-17 13:01:09 EST; 9s ago
courier-imapd.service - Courier IMAP Mail Server
   Active: inactive (dead) since Mon 2014-11-17 13:01:09 EST; 9s ago
courier-imapd-ssl.service - Courier IMAP SSL Mail Server
   Active: inactive (dead) since Mon 2014-11-17 13:01:09 EST; 9s ago
courier-pop3d.service - Courier POP3 Mail Server
   Active: inactive (dead) since Mon 2014-11-17 13:01:09 EST; 9s ago
courier-pop3d-ssl.service - Courier IMAP SSL Mail Server
   Active: inactive (dead) since Mon 2014-11-17 13:01:09 EST; 9s ago
exim.service - Exim is a Mail Transport Agent, which is the program that moves mail from one machine to another.
   Active: inactive (dead) since Mon 2014-11-17 13:01:09 EST; 9s ago

##############################################################

I've attempted daemon-reload, waiting to see if it finally catches on. The setting is visible in systemctl show authdaemond. I've attached the output.

There are several bug reports out on this for FC.

https://bugzilla.redhat.com/show_bug.cgi?id=997031
https://bugzilla.redhat.com/show_bug.cgi?id=704197

I was not able to find any mention of this in the changelog in the rpm. Though, I could have missed it.

Steps To ReproduceSetup a service to require another. Then, attempt to use StopWhenUnneeded in the dependency. It will not work on this version of systemd.

root@centos7 [~]# rpm -qa | grep systemd
systemd-libs-208-11.el7_0.4.x86_64
systemd-208-11.el7_0.4.x86_64
systemd-sysv-208-11.el7_0.4.x86_64

root@centos7 [~]# uname -a
Linux centos7.vanilla.me 3.10.0-123.el7.x86_64 #1 SMP Mon Jun 30 12:09:22 UTC 2014 x86_64 x86_64 x86_64 GNU/Linux

root@centos7 [~]# cat /etc/redhat-release
CentOS Linux release 7.0.1406 (Core)
TagsNo tags attached.
abrt_hash
URL

Activities

phlack

phlack

2014-11-17 23:55

reporter  

Here.txt (3,446 bytes)   
Id=authdaemond.service
Names=authdaemond.service
Requires=basic.target
Wants=system.slice
RequiredBy=exim.service courier-pop3d-ssl.service courier-imapd.service courier-pop3d.service courier-imapd-ssl.service
WantedBy=multi-user.target
Conflicts=shutdown.target
Before=courier-pop3d-ssl.service courier-imapd.service courier-pop3d.service courier-imapd-ssl.service shutdown.target multi-user.target
After=systemd-journald.socket basic.target system.slice
Description=Courier authentication daemon
LoadState=loaded
ActiveState=active
SubState=running
FragmentPath=/etc/systemd/system/authdaemond.service
UnitFileState=enabled
InactiveExitTimestamp=Mon 2014-11-17 13:06:04 EST
InactiveExitTimestampMonotonic=440246477192
ActiveEnterTimestamp=Mon 2014-11-17 13:06:04 EST
ActiveEnterTimestampMonotonic=440246495905
ActiveExitTimestamp=Mon 2014-11-17 13:06:04 EST
ActiveExitTimestampMonotonic=440246413556
InactiveEnterTimestamp=Mon 2014-11-17 13:06:04 EST
InactiveEnterTimestampMonotonic=440246475175
CanStart=yes
CanStop=yes
CanReload=no
CanIsolate=no
StopWhenUnneeded=yes
RefuseManualStart=no
RefuseManualStop=no
AllowIsolate=no
DefaultDependencies=yes
OnFailureIsolate=no
IgnoreOnIsolate=no
IgnoreOnSnapshot=no
NeedDaemonReload=no
JobTimeoutUSec=0
ConditionTimestamp=Mon 2014-11-17 13:06:04 EST
ConditionTimestampMonotonic=440246476525
ConditionResult=yes
Transient=no
Slice=system.slice
ControlGroup=/system.slice/authdaemond.service
Type=forking
Restart=no
PIDFile=/var/spool/authdaemon/pid
NotifyAccess=none
RestartUSec=100ms
TimeoutStartUSec=1min 30s
TimeoutStopUSec=1min 30s
WatchdogUSec=0
WatchdogTimestampMonotonic=0
StartLimitInterval=10000000
StartLimitBurst=5
StartLimitAction=none
ExecStart={ path=/usr/sbin/courierlogger ; argv[]=/usr/sbin/courierlogger -pid=/var/spool/authdaemon/pid $LOGGEROPTS -start /usr/libexec/courier-authlib/authdaemond ; ignore_errors=no ; start_time=[Mon 2014-11-17 13:06:04 EST] ; stop_time=[Mon 2014-11-17 13:06:04 EST] ; pid=14784 ; code=exited ; status=0 }
PermissionsStartOnly=no
RootDirectoryStartOnly=no
RemainAfterExit=no
GuessMainPID=yes
MainPID=14788
ControlPID=0
Result=success
EnvironmentFile=/etc/authlib/authdaemonrc (ignore_errors=no)
UMask=0022
LimitCPU=18446744073709551615
LimitFSIZE=18446744073709551615
LimitDATA=18446744073709551615
LimitSTACK=18446744073709551615
LimitCORE=18446744073709551615
LimitRSS=18446744073709551615
LimitNOFILE=4096
LimitAS=18446744073709551615
LimitNPROC=7858
LimitMEMLOCK=65536
LimitLOCKS=18446744073709551615
LimitSIGPENDING=7858
LimitMSGQUEUE=819200
LimitNICE=0
LimitRTPRIO=0
LimitRTTIME=18446744073709551615
OOMScoreAdjust=0
Nice=0
IOScheduling=0
CPUSchedulingPolicy=0
CPUSchedulingPriority=0
TimerSlackNSec=50000
CPUSchedulingResetOnFork=no
NonBlocking=no
StandardInput=null
StandardOutput=journal
StandardError=inherit
TTYReset=no
TTYVHangup=no
TTYVTDisallocate=no
SyslogPriority=30
SyslogLevelPrefix=yes
SecureBits=0
CapabilityBoundingSet=18446744073709551615
MountFlags=0
PrivateTmp=no
PrivateNetwork=no
SameProcessGroup=no
IgnoreSIGPIPE=yes
NoNewPrivileges=no
KillMode=control-group
KillSignal=15
SendSIGKILL=yes
SendSIGHUP=no
CPUAccounting=no
CPUShares=1024
BlockIOAccounting=no
BlockIOWeight=1000
MemoryAccounting=no
MemoryLimit=18446744073709551615
DevicePolicy=auto
ExecMainStartTimestamp=Mon 2014-11-17 13:06:04 EST
ExecMainStartTimestampMonotonic=440246495846
ExecMainExitTimestampMonotonic=0
ExecMainPID=14788
ExecMainCode=0
ExecMainStatus=0
Here.txt (3,446 bytes)   
phlack

phlack

2014-12-02 17:30

reporter   ~0021841

This is also true for targets. This makes targets pretty useless as the target shows active when all of it's underlying services are dead.

Issue History

Date Modified Username Field Change
2014-11-17 23:52 phlack New Issue
2014-11-17 23:55 phlack File Added: Here.txt
2014-12-02 17:30 phlack Note Added: 0021841