Bug 860464 - systemd does not recognize dash after ExecStart
systemd does not recognize dash after ExecStart
Status: CLOSED ERRATA
Product: Fedora
Classification: Fedora
Component: systemd (Show other bugs)
18
Unspecified Unspecified
unspecified Severity unspecified
: ---
: ---
Assigned To: systemd-maint
Fedora Extras Quality Assurance
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2012-09-25 17:44 EDT by Morten Stevens
Modified: 2013-02-25 21:43 EST (History)
8 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2013-02-25 21:43:54 EST
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description Morten Stevens 2012-09-25 17:44:53 EDT
Description of problem:

Due a bug, the pdns daemon returns exit code 1 when stopping the pdns service. To work around this problem you set a dash after ExecStart in the systemd unit file.

Version-Release number of selected component (if applicable):

systemd-192-1.fc18.x86_64
systemd-44-17.fc17.x86_64

How reproducible:

1. install a daemon (like pdns 3.1-2 or lower) which returns exit code 1 when stopping the service
2. configure a pdns backend like mysql
3. edit the systemd unit file:
For example:
ExecStart=-/usr/sbin/pdns_server --daemon --guardian=yes   
instead of
ExecStart=/usr/sbin/pdns_server --daemon --guardian=yes
4. start and stop the daemon
  
Actual results:

systemd does not recognize the dash after ExecStart.

Expected results:

systemd should report no error

Additional info:

FC18:

[root@fc18 ~]# rpm -q systemd
systemd-192-1.fc18.x86_64
[root@fc18 pdns]# cat /etc/systemd/system/multi-user.target.wants/pdns.service
[Unit]
Description=PDNS DNS Server
After=network.target

[Service]
Type=forking
ExecStart=-/usr/sbin/pdns_server --daemon --guardian=yes
ExecReload=/usr/bin/pdns_control cycle
ExecStop=/usr/bin/pdns_control quit

[Install]
WantedBy=multi-user.target
[root@fc18 pdns]# systemctl --system daemon-reload
[root@fc18 pdns]# systemctl start pdns.service
[root@fc18 pdns]# systemctl stop pdns.service
[root@fc18 pdns]# systemctl status pdns.service
pdns.service - PDNS DNS Server
          Loaded: loaded (/usr/lib/systemd/system/pdns.service; enabled)
          Active: failed (Result: exit-code) since Tue, 25 Sep 2012 23:24:56 +0200; 4s ago
         Process: 1087 ExecStop=/usr/bin/pdns_control quit (code=exited, status=0/SUCCESS)
         Process: 1040 ExecStart=/usr/sbin/pdns_server --daemon --guardian=yes (code=exited, status=0/SUCCESS)
        Main PID: 1041 (code=exited, status=1/FAILURE)
          CGroup: name=systemd:/system/pdns.service


[root@fc18 pdns]# cat /var/log/messages
Sep 25 23:24:56 fc18 systemd[1]: Stopping PDNS DNS Server...
Sep 25 23:24:56 fc18 pdns[1041]: Scheduling exit on remote request
Sep 25 23:24:56 fc18 pdns_control[1087]: Scheduling exit
Sep 25 23:24:56 fc18 pdns[1041]: Guardian is killed, taking down children with us
Sep 25 23:24:56 fc18 systemd[1]: pdns.service: main process exited, code=exited, status=1
Sep 25 23:24:56 fc18 systemd[1]: Stopped PDNS DNS Server.
Sep 25 23:24:56 fc18 systemd[1]: Unit pdns.service entered failed state.


FC17:

[root@fc17 ~]# rpm -q systemd
systemd-44-17.fc17.x86_64
[root@fc17 pdns]# cat /etc/systemd/system/multi-user.target.wants/pdns.service
[Unit]
Description=PDNS DNS Server
After=network.target

[Service]
Type=forking
ExecStart=-/usr/sbin/pdns_server --daemon --guardian=yes
ExecReload=/usr/bin/pdns_control cycle
ExecStop=/usr/bin/pdns_control quit

[Install]
WantedBy=multi-user.target
[root@fc17 pdns]# systemctl --system daemon-reload
[root@fc17 pdns]# systemctl start pdns.service
[root@fc17 pdns]# systemctl stop pdns.service
[root@fc17 pdns]# systemctl status pdns.service
pdns.service - PDNS DNS Server
          Loaded: loaded (/usr/lib/systemd/system/pdns.service; enabled)
          Active: failed (Result: exit-code) since Tue, 25 Sep 2012 23:30:24 +0200; 3s ago
         Process: 18382 ExecStop=/usr/bin/pdns_control quit (code=exited, status=0/SUCCESS)
         Process: 18335 ExecStart=/usr/sbin/pdns_server --daemon --guardian=yes (code=exited, status=0/SUCCESS)
        Main PID: 18336 (code=exited, status=1/FAILURE)
          CGroup: name=systemd:/system/pdns.service

[root@fc17 pdns]# cat /var/log/messages
Sep 25 23:30:24 fc17 pdns[18336]: Scheduling exit on remote request
Sep 25 23:30:24 fc17 pdns_control[18382]: Scheduling exit
Sep 25 23:30:24 fc17 pdns[18336]: Guardian is killed, taking down children with us
Sep 25 23:30:24 fc17 systemd[1]: pdns.service: main process exited, code=exited, status=1
Sep 25 23:30:24 fc17 systemd[1]: Unit pdns.service entered failed state.
Comment 1 Lennart Poettering 2013-01-14 14:47:37 EST
Well, so what happens here is that systemd applies the dash only to the process systemd actualyl spawned, but not the the main process of the service. You use Type=forking, hence the destinction: systemd will ignore the return value of the starter process, but not of the forkedd of bg process.

Not sure what we should about this. The simplest solution might be to simply copy the ignore flag from the starter process' setting to the main service process' setting. That would then make it work the way you expect.
Comment 3 Fedora Update System 2013-01-28 14:12:53 EST
systemd-197-1.fc18.2 has been submitted as an update for Fedora 18.
https://admin.fedoraproject.org/updates/systemd-197-1.fc18.2
Comment 4 Fedora Update System 2013-01-29 19:34:16 EST
Package systemd-197-1.fc18.2:
* should fix your issue,
* was pushed to the Fedora 18 testing repository,
* should be available at your local mirror within two days.
Update it with:
# su -c 'yum update --enablerepo=updates-testing systemd-197-1.fc18.2'
as soon as you are able to.
Please go to the following url:
https://admin.fedoraproject.org/updates/FEDORA-2013-1590/systemd-197-1.fc18.2
then log in and leave karma (feedback).
Comment 5 Fedora Update System 2013-02-22 20:02:03 EST
Package initscripts-9.42.2-1.fc18, systemd-197-1.fc18.2:
* should fix your issue,
* was pushed to the Fedora 18 testing repository,
* should be available at your local mirror within two days.
Update it with:
# su -c 'yum update --enablerepo=updates-testing initscripts-9.42.2-1.fc18 systemd-197-1.fc18.2'
as soon as you are able to.
Please go to the following url:
https://admin.fedoraproject.org/updates/FEDORA-2013-1590/initscripts-9.42.2-1.fc18,systemd-197-1.fc18.2
then log in and leave karma (feedback).
Comment 6 Fedora Update System 2013-02-25 21:43:58 EST
initscripts-9.42.2-1.fc18, systemd-197-1.fc18.2 has been pushed to the Fedora 18 stable repository.  If problems still persist, please make note of it in this bug report.

Note You need to log in before you can comment on or make changes to this bug.