Bug 802770

Summary: Systemd starts a "Requires" dependency on "start" but not on "restart"
Product: [Fedora] Fedora Reporter: Peter Rajnoha <prajnoha>
Component: systemdAssignee: systemd-maint
Status: CLOSED ERRATA QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: medium Docs Contact:
Priority: unspecified    
Version: rawhideCC: chaowang, johannbg, metherid, mschmidt, notting, plautrba, systemd-maint, zkabelac
Target Milestone: ---   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2012-05-29 10:33:58 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Peter Rajnoha 2012-03-13 13:23:10 UTC
Description of problem:
While having a dependency between units defined by the "Requires" tag, the dependency is started automatically on "systemctl start", but it's not started on "systemctl restart" if they're not running yet.

Version-Release number of selected component (if applicable):
systemd-43-2.fc18.x86_64

Steps to Reproduce:
1. considering two units (e.g. dm-event.socket and dm-event.service which has Requires=dm-event.socket and After=dm-event.socket)

2. systemctl stop dm-event.service dm-event.socket

3. systemctl restart dm-event.service

Actual results:
dm-event.service started and dm-event.socket not started

Expected results:
dm-event.socket should be started as well since it is a required dependency

Comment 1 Michal Schmidt 2012-04-16 23:59:21 UTC
*** Bug 808724 has been marked as a duplicate of this bug. ***

Comment 2 Michal Schmidt 2012-04-17 00:11:52 UTC
https://bugzilla.redhat.com/show_bug.cgi?id=808724#c4:
> Looks like we need to add dependency jobs for JOB_RESTART in
> transaction_add_job_and_dependencies(), the same as "type == JOB_START" has.

It's the right thing to do, but it will expose a bug:
If A.service requires B.service, both are running, and the user requests a restart of B.service, the following jobs will be added:
B.service/restart (the anchor)
A.service/restart (dependency from B's UNIT_REQUIRED_BY)
B.service/start   (dependency from A's UNIT_REQUIRES)

B.service/restart and B.service/start will be merged, but unfortunately the one that gets deleted is the anchor. systemctl will not notice the completion of the job.

Comment 3 Bill Nottingham 2012-04-19 15:51:14 UTC
Is this bug that would be exposed related to https://bugzilla.redhat.com/show_bug.cgi?id=753586#c21?

Comment 4 Michal Schmidt 2012-04-20 12:40:21 UTC
No, it is different.
I'm rewriting systemd's transaction code a bit. This bug should get fixed in the process.

Comment 5 Michal Schmidt 2012-04-20 15:20:24 UTC
Upstream fix:
http://cgit.freedesktop.org/systemd/systemd/commit/?id=65304075249449a713b4e4842b8538ef4aa1c725
In depends on previous patches.

Comment 6 Fedora Update System 2012-05-18 23:38:19 UTC
systemd-44-9.fc17 has been submitted as an update for Fedora 17.
https://admin.fedoraproject.org/updates/systemd-44-9.fc17

Comment 7 Fedora Update System 2012-05-18 23:57:37 UTC
systemd-37-20.fc16 has been submitted as an update for Fedora 16.
https://admin.fedoraproject.org/updates/systemd-37-20.fc16

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

Comment 9 Fedora Update System 2012-05-29 10:33:58 UTC
systemd-44-12.fc17 has been pushed to the Fedora 17 stable repository.  If problems still persist, please make note of it in this bug report.

Comment 10 Fedora Update System 2012-06-05 23:10:56 UTC
systemd-37-25.fc16 has been pushed to the Fedora 16 stable repository.  If problems still persist, please make note of it in this bug report.