Bug 704197 - StopWhenUnneeded=yes does not work
Summary: StopWhenUnneeded=yes does not work
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Fedora
Classification: Fedora
Component: systemd
Version: 15
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: systemd-maint
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks: 696611
TreeView+ depends on / blocked
 
Reported: 2011-05-12 12:15 UTC by Michal Hlavinka
Modified: 2012-01-31 22:05 UTC (History)
6 users (show)

Fixed In Version: systemd-26-14.fc15
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2012-01-30 20:58:09 UTC


Attachments (Terms of Use)

Description Michal Hlavinka 2011-05-12 12:15:46 UTC
Description of problem:
I have 2 service files: ups-driver.service and ups-daemon.service Driver should start when starting daemon and should stop when stopping daemon. Right now, it is started automatically when starting daemon, but it does not stop after daemon is stopped. There is also unexpected systemd message about stopping driver when daemon is started.

Version-Release number of selected component (if applicable):
systemd-26-1.fc15.x86_64

How reproducible:
always

Steps to Reproduce:
1.you need configured nut and nut-client
2. cat /lib/systemd/system/ups-driver.service 
[Unit]
Description=Network UPS Tools - driver
After=local-fs.target network.target
StopWhenUnneeded=yes

[Service]
ExecStart=/sbin/upsdrvctl start
ExecStop=/sbin/upsdrvctl stop
Type=forking

3.cat /lib/systemd/system/ups-daemon.service 
[Unit]
Description=Network UPS Tools - daemon
After=local-fs.target network.target ups-driver.service
Requires=ups-driver.service

[Service]
EnvironmentFile=/etc/sysconfig/ups
ExecStart=/usr/sbin/upsd $UPSD_OPTIONS
Type=forking

[Install]
WantedBy=multi-user.target

4.systemctl --system daemon-reload
5.systemctl start ups-daemon.service
  
-> both ups-driver and ups-daemon are running, but /var/log/messages contains odd messages from systemd:
14:08:42 systemd[1]: Service ups-driver.service is not needed anymore. Stopping.
14:08:42 krles systemd[1]: Requested transaction contradicts existing jobs: File exists
14:08:42 usbhid-ups[3903]: Startup successful
14:08:42 systemd[1]: Service ups-driver.service is not needed anymore. Stopping.
14:08:42 systemd[1]: Requested transaction contradicts existing jobs: File exists
14:08:42 upsd[3904]: listening on 127.0.0.1 port 3493
14:08:42 upsd[3904]: listening on ::1 port 3493
14:08:42 upsd[3904]: Connected to UPS [myups]: usbhid-ups-myups
14:08:42 upsd[3905]: Startup successful

(usbhid-ups is started by upsdrvctl from usp-driver.service)

6.systemctl stop ups-daemon.service
7.systemctl status ups-driver.service

Actual results:
ups-driver running:
ups-driver.service - Network UPS Tools - UPS information server
          Loaded: loaded (/lib/systemd/system/ups-driver.service)
          Active: active (running) since Thu, 12 May 2011 14:08:42 +0200; 2min 32s ago
         Process: 3901 ExecStart=/sbin/upsdrvctl start (code=exited, status=0/SUCCESS)
        Main PID: 3903 (usbhid-ups)
          CGroup: name=systemd:/system/ups-driver.service
                  └ 3903 /sbin/usbhid-ups -a myup

there are no extra messages in /var/log/messages, just ups-daemon messages about termination

Expected results:
ups-driver stopped


Additional info:

Comment 1 Michal Hlavinka 2011-07-25 14:05:16 UTC
ping, is additional info required?

Comment 2 Fedora Admin XMLRPC Client 2011-10-20 16:27:13 UTC
This package has changed ownership in the Fedora Package Database.  Reassigning to the new owner of this component.

Comment 4 Fedora Update System 2012-01-11 15:00:27 UTC
systemd-37-6.fc16 has been submitted as an update for Fedora 16.
https://admin.fedoraproject.org/updates/systemd-37-6.fc16

Comment 5 Fedora Update System 2012-01-11 20:56:51 UTC
Package systemd-37-6.fc16:
* should fix your issue,
* was pushed to the Fedora 16 testing repository,
* should be available at your local mirror within two days.
Update it with:
# su -c 'yum update --enablerepo=updates-testing systemd-37-6.fc16'
as soon as you are able to.
Please go to the following url:
https://admin.fedoraproject.org/updates/FEDORA-2012-0409/systemd-37-6.fc16
then log in and leave karma (feedback).

Comment 6 Fedora Update System 2012-01-16 02:24:29 UTC
Package systemd-37-7.fc16:
* should fix your issue,
* was pushed to the Fedora 16 testing repository,
* should be available at your local mirror within two days.
Update it with:
# su -c 'yum update --enablerepo=updates-testing systemd-37-7.fc16'
as soon as you are able to.
Please go to the following url:
https://admin.fedoraproject.org/updates/FEDORA-2012-0409/systemd-37-7.fc16
then log in and leave karma (feedback).

Comment 7 Fedora Update System 2012-01-17 13:13:46 UTC
systemd-26-14.fc15 has been submitted as an update for Fedora 15.
https://admin.fedoraproject.org/updates/systemd-26-14.fc15

Comment 8 Fedora Update System 2012-01-17 20:22:13 UTC
Package systemd-37-8.fc16:
* should fix your issue,
* was pushed to the Fedora 16 testing repository,
* should be available at your local mirror within two days.
Update it with:
# su -c 'yum update --enablerepo=updates-testing systemd-37-8.fc16'
as soon as you are able to.
Please go to the following url:
https://admin.fedoraproject.org/updates/FEDORA-2012-0409/systemd-37-8.fc16
then log in and leave karma (feedback).

Comment 9 Fedora Update System 2012-01-30 20:58:09 UTC
systemd-37-11.fc16 has been pushed to the Fedora 16 stable repository.  If problems still persist, please make note of it in this bug report.

Comment 10 Fedora Update System 2012-01-31 22:05:29 UTC
systemd-26-14.fc15 has been pushed to the Fedora 15 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.