Bug 1009097 - $local_fs dependencies in LSB init scripts are ignored by systemd
Summary: $local_fs dependencies in LSB init scripts are ignored by systemd
Keywords:
Status: CLOSED NOTABUG
Alias: None
Product: Fedora
Classification: Fedora
Component: systemd
Version: 19
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: systemd-maint
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2013-09-17 16:48 UTC by Andrew J. Schorr
Modified: 2013-09-17 18:30 UTC (History)
8 users (show)

Fixed In Version:
Clone Of:
Environment:
Last Closed: 2013-09-17 18:30:00 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)

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.


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