Bug 1009097

Summary: $local_fs dependencies in LSB init scripts are ignored by systemd
Product: [Fedora] Fedora Reporter: Andrew J. Schorr <aschorr>
Component: systemdAssignee: systemd-maint
Status: CLOSED NOTABUG QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 19CC: johannbg, lnykryn, mschmidt, msekleta, plautrba, systemd-maint, vpavlin, zbyszek
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2013-09-17 18:30:00 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Andrew J. Schorr 2013-09-17 16:48:00 UTC
Description of problem: I have an LSB init script that declares a dependency on $local_fs in the Required-Start header.  But systemd ignores this. This commit removed that translation in src/core/service.c:sysv_translate_facility

http://cgit.freedesktop.org/systemd/systemd/commit/?id=5d4caf565471ff3401bd9b53aa814c8545a18a93

I think this can lead to a race condition when shutting down the system.
My script mounts 2 filesystems as part of its service startup.  When
shutdown occurs, I think there's a race condition where systemd may unmount
those filesystems itself before running the init script stop command.  The
script would like to unmount those filesystems itself after copying
some information from them.  I don't see any dependencies that would prevent
systemd from starting to unmount local filesystems before my service stop
script is run.

Version-Release number of selected component (if applicable):
systemd-204-11.fc19.x86_64


How reproducible: run "systemctl show" for an LSB init service with a dependency on $local_fs and note that the After value does not include local-fs.target


Steps to Reproduce:
1. Install an LSB init script with $local_fs in Required-Start
2. Observer 'systemctl show' contents of the After field.
3.

Actual results: No dependency on local-fs.target


Expected results: A dependency on local-fs.target


Additional info:

Comment 1 Michal Schmidt 2013-09-17 17:59:09 UTC
Isn't there indirect ordering?:
your.service After basic.target After sysinit.target After local-fs.target

Comment 2 Andrew J. Schorr 2013-09-17 18:30:00 UTC
I think you are correct.  I experienced this problem on Fedora 16, and was attempting to troubleshoot whether it would also occur on Fedora 19.  I failed
to see the indirect ordering.  In Fedora 16, I think the problem was that
the .mount units created did not specify Before=local-fs.target.  So perhaps
everything will work properly in Fedora 19.

I now see that I should have run "systemctl --after list-dependencies <service>"

Sorry for the bother.  I am closing this.