Bug 1088057

Summary: RequiresMountsFor doesn't do anything
Product: [Fedora] Fedora Reporter: Cristian Ciupitu <cristian.ciupitu>
Component: systemdAssignee: systemd-maint
Status: CLOSED ERRATA QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: medium Docs Contact:
Priority: unspecified    
Version: 20CC: johannbg, lnykryn, msekleta, ohadlevy, plautrba, systemd-maint, vpavlin, zbyszek
Target Milestone: ---   
Target Release: ---   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: systemd-208-19.fc20.x86_64 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2014-06-28 16:00:41 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 Cristian Ciupitu 2014-04-16 00:14:46 UTC
Description of problem:
systemd does not mount directories specified by RequiresMountsFor when
the service is started.

Version-Release number of selected component (if applicable):
systemd-208-16.fc20.x86_64

How reproducible:
Every time

Steps to Reproduce:
1. Create /etc/systemd/system/libvirtd.service with this content:
.include /usr/lib/systemd/system/libvirtd.service

[Unit]
RequiresMountsFor=/var/lib/libvirt /var/lib/libvirt/images/ram

2. Add these 2 entries to /etc/fstab:
/dev/hermesVG/libvirt  /var/lib/libvirt             xfs    noauto,relatime  0 2
none                   /var/lib/libvirt/images/ram  tmpfs  noauto,noatime,nosuid,nodev,mode=0711,rootcontext=system_u:object_r:virt_image_t:s0  0 0

3. Run systemctl daemon-reload

4. Run systemctl start libvirtd

Actual results:
The directories aren't mounted.

Expected results:
The directories should be mounted

Additional info:
In case it's relevant I'm using libvirt-daemon-1.2.3-2.fc20.x86_64.

Comment 1 Zbigniew Jędrzejewski-Szmek 2014-04-16 00:32:11 UTC
This is probably because of the 'noauto'. The semantics of noauto are basically that it will not be mounted automatically... This is a bit of a corner case.
You might want to replace 'RequiresMountsFor=...' with 'Requires=var-lib-libvirt.mount var-lib-libvirt-images-ram.mount'.

Comment 2 Cristian Ciupitu 2014-04-16 01:02:58 UTC
That worked. Thank you for the workaround.

Nevertheless the issue remains. Perhaps the behavior for noauto should
be changed a bit or the systemd.unit(5) man page should mention this
corner case.

Comment 3 Zbigniew Jędrzejewski-Szmek 2014-04-17 02:27:17 UTC
I added a note to systemd.unit(5) in http://cgit.freedesktop.org/systemd/systemd/commit/?id=5d2abc0.

Comment 4 Fedora Update System 2014-06-19 13:19:34 UTC
systemd-208-18.fc20 has been submitted as an update for Fedora 20.
https://admin.fedoraproject.org/updates/systemd-208-18.fc20

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

Comment 6 Fedora Update System 2014-06-22 23:55:40 UTC
Package systemd-208-19.fc20:
* should fix your issue,
* was pushed to the Fedora 20 testing repository,
* should be available at your local mirror within two days.
Update it with:
# su -c 'yum update --enablerepo=updates-testing systemd-208-19.fc20'
as soon as you are able to.
Please go to the following url:
https://admin.fedoraproject.org/updates/FEDORA-2014-7512/systemd-208-19.fc20
then log in and leave karma (feedback).

Comment 7 Zbigniew Jędrzejewski-Szmek 2017-02-09 01:22:30 UTC
The change to documentation will be reverted upstream. It seems the intended behaviour was to have RequiresMountsFor pull in units which have noauto set, and the actual code has been doing that since a long while.

https://lists.freedesktop.org/archives/systemd-devel/2017-January/038192.html