Bug 89048

Summary: DOC: the man pages should clarify that "systemctl daemon-reload" is the way to make systemd reread /etc/fstab
Product: systemd Reporter: Arch <archont>
Component: generalAssignee: systemd-bugs
Status: RESOLVED FIXED QA Contact: systemd-bugs
Severity: normal    
Priority: medium    
Version: unspecified   
Hardware: Other   
OS: All   
Whiteboard:
i915 platform: i915 features:

Description Arch 2015-02-09 19:54:20 UTC
Hi,

http://www.freedesktop.org/software/systemd/man/systemd.mount.html#fstab reads that:

Mount units may either be configured via unit files, or via /etc/fstab (see fstab(5) for details). Mounts listed in /etc/fstab will be converted into native units dynamically at boot and when the configuration of the system manager is reloaded. In general, configuring mount points through /etc/fstab is the preferred approach. See systemd-fstab-generator(8) for details about the conversion.

Once the user modifies the /etc/fstab, it is difficult to find out how to regenerate the units. Usual advice given by many is to reload the configuration "systemctl daemon-reload", which does not do the trick.

Running "/usr/lib/systemd/system-generators/systemd-fstab-generator" does not change existing units ("systemctl list-units --all") either.

Someone on Arch Linux forum adviced that "/usr/lib/systemd/system-generators/systemd-fstab-generator /run/systemd/generator '' ''" should work.

Not obvious from the man pages of systemd-fstab-generator, which mentions something in Examples, but without any reference to the actual location.

"systemd-fstab-generator converts /etc/fstab into native mount units. It uses argv[1] as location to place the generated unit files in order to allow the user to override fstab with his own native unit files, but also to ensure that /etc/fstab overrides any vendor default from /usr."

Looking at it from today's perspective, it may seem clear - just read and understand a buch of man pages. But without knowing the actual command argument syntax, I guess I would have to stay with the easy-to-carry-out reboots of the computer. The old style was simply "mount -a", written directly in the man page.

How about an equivalent for systemd-fstab-generator, which would simply carry out the default task, which is done during boot?
Comment 1 Lennart Poettering 2015-02-10 11:16:19 UTC
The right way to reload fstab is via "systemctl daemon-reload". The generators should not be invoked directly, except for debugging purposes, and doing so is not sufficient, as they just write out new configuration but PID 1 won't read it in...

But yeah, the docs should clarify this.
Comment 2 Arch 2015-02-10 13:21:11 UTC
Then, it appears there is a bug, since 'systemctl daemon-reload' does not work for me and other Arch Linux users:

https://bbs.archlinux.org/viewtopic.php?id=192991
Comment 3 Lennart Poettering 2015-02-10 14:43:38 UTC
What is "does not work for me" supposed to mean? What precisely doesn't work? What precisely do you expect it to do that it doesn't do? What precisely does it do that you don't expect?

Note that "daemon-reload" among other things invokes the generators. Hence, if you invoke them directly you do less than the "daemon-reload" does...
Comment 4 Arch 2015-02-10 17:14:16 UTC
Hm, I did test it all again and this time it seems to work. I.e.

1. Modify fstab (added cifs automount in my case)

2. 'systemctl daemon-reload'

3. 'systemctl list-units --all | grep "automount"' lists the new mounts

4. 'systemctl start my-share.automount'

5. 'ls -la /path/to/my-share' shows the files

Similarly, it works for removing the shares from fstab and stopping the automount service.

Sorry for the fuss. When I tested few days ago, I may have not used the '--all' switch, otherwise I cannot explain it to myself. I have also updated the OS in the meantime, though I guess it would be quite a coincidence if there was a bug earlier and resolved now.


To sum it up, I'd propose to modify the man page to make it clear that point 2 and 4 must be run manually after fstab is modified.

Thanks for your work.
Comment 5 Zbigniew Jedrzejewski-Szmek 2015-02-11 04:27:23 UTC
I added generator documentation in http://cgit.freedesktop.org/systemd/systemd/commit/?id=432d59656b. I think it makes things clear enough.

Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.