Bug 1468001

Summary: systemd presets have no effect on fedora-readonly.service
Product: [Fedora] Fedora Reporter: John Florian <trailtotale>
Component: initscriptsAssignee: David Kaspar // Dee'Kej <deekej>
Status: CLOSED DUPLICATE QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 25CC: deekej, jonathan, kdudka, lnykryn, zbyszek
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2017-10-11 16:47:09 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 John Florian 2017-07-05 18:35:02 UTC
Description of problem:
I wish to replace/augment the fedora-readonly.service with one of my own design.  Despite having a systemd presets file which has disables fedora-readonly.service and enables mine, I find that fedora-readonly.service remains active.


Version-Release number of selected component (if applicable):
initscripts-9.69-1.fc25.x86_64


How reproducible:
always

Steps to Reproduce:
1. create a presets file (e.g., /usr/lib/systemd/system-preset/00-test.preset) containing at least "disable fedora-readonly.*".
2. reboot
3. systemctl status fedora-readonly.service

Actual results:
● fedora-readonly.service - Configure read-only root support
   Loaded: loaded (/usr/lib/systemd/system/fedora-readonly.service; static; vendor preset: disabled)
   Active: active (exited) since Wed 2017-07-05 14:02:06 EDT; 8min ago
<snip>

Expected results:
Notice that the vendor preset indicates "disabled" (good) but that the service is "active" (bad).

Additional info:
I believe the fault rests with initscripts shipping /lib/systemd/system/local-fs.target.wants/fedora-readonly.service when it would be preferable to simply have the following in the fedora-readonly.service unit file:

"""
[Install]
WantedBy=local-fs.target
"""

Comment 1 Zbigniew Jędrzejewski-Szmek 2017-07-05 19:22:30 UTC
There's two things here:

1. Changing presets and rebooting does not change whether the service is enabled or not. Presets are only used when a package is initially installed (or when systemctl preset is called manually). So for your 00-test.preset config to take effect, you'd need to call systemctl preset yourself.

2. If we ignore point 1., it is true that fedora-readonly.service is enabled "permanently" and cannot be configured through presets. It probably should. To do that, we'll need two changes: first add fedora-readonly.service to the presets distributed in fedora-release, and then update the initscripts package to enable it using presets.

Considering that properly fixing this is going to take a while, for now you can just do 'systemctl mask fedora-readonly.service' to disable it.

Comment 2 John Florian 2017-07-05 19:37:48 UTC
I concur and think this should happen.  It took me a while to hunt this down with everything seemingly contradicting my expectations.  Point #1 is valid, but not really the issue here for me because this is all occurring in a live spin used for embedded systems.  Thus the package is being installed anew for my tests.

Thanks for the quick feedback!

Comment 3 John Florian 2017-07-10 12:46:58 UTC
Is there anything I can help do to move this along?  (I don't have any authority to improve Fedora packages beyond providing patches -- I've long meant to go through the steps but never quite get there.  Still I'm willing to help in any way I can.)

Comment 4 Zbigniew Jędrzejewski-Szmek 2017-07-10 14:06:38 UTC
Thanks for the offer to help. In this particular case the change is simple, but it's spread out over multiple components (fedora-release, initscripts), so the trouble is in coordinating all the changes. I just heard back from the initscripts maintainers and I'll be pushing those changes through.

If you want to get involved in Fedora, I'd be happy to help. I'm a "packaging sponsor". If you are interested, please drop a note (my bugzilla e-mail is OK), what you are interested in, and we can work something out.

Comment 5 Zbigniew Jędrzejewski-Szmek 2017-07-10 23:42:00 UTC
https://pagure.io/fedora-release/pull-request/109

Comment 6 Zbigniew Jędrzejewski-Szmek 2017-10-11 16:47:09 UTC
Let's consolidate the two bugs.

*** This bug has been marked as a duplicate of bug 1493479 ***