[systemd-devel] RequiresMountsFor and the noauto option.

NeilBrown neilb at suse.com
Mon Jan 23 00:13:52 UTC 2017


hi,
 according to "man systemd.unit" :

       RequiresMountsFor=
           Takes a space-separated list of absolute paths.
           Automatically adds dependencies of type Requires= and
           After= for all mount units required to access the
           specified path.

           Mount points marked with noauto are not mounted
           automatically and will be ignored for the purposes of
           this option. If such a mount should be a requirement for
           this unit, direct dependencies on the mount units may be
           added (Requires= and After= or some other combination).


 I understand this to mean that if a mount point has the "noauto" option in
 /etc/fstab, and if a systemd service has RequiresMountsFor the path to
 that mount point, then the service will *not* require the mount point,
 and it will start even if that mountpoint cannot be mounted.

 I recently made a change to nfs-utils to make use of this
 functionality.  A generator creates RequiresMountsFor dependences for
 nfs-server so that it won't start until all exported filesystems
 (listed in /etc/exports) are mounted.  I assumed this would not trigger
 the mounting of filesystems marked as "noauto".  I really want After
 functionality, but not Requires.

 However, this is not how it works.

 The "noauto" option stops a "Requires" dependency being created for
 local-fs.target, but does not stop a "Requires" dependency being
 created for a service which "RequiresMountsFor".  There is no checking
 for "noauto" in unit_add_mount_dependencies().

 If this a bug in the documentation, or a bug in the code?  I'm hoping
 the later, otherwise I'll need to find a different solution for
 nfs-utils, and that will probably require having my generator read
 /etc/fstab and duplicate the work of fstab-generator.c

 If the documentation is wrong, and the code is correct, would it be
 possible to get "AfterMountsFor=" as that is the functionality that I
 really want.

Thanks,
NeilBrown
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 832 bytes
Desc: not available
URL: <https://lists.freedesktop.org/archives/systemd-devel/attachments/20170123/fdc235ee/attachment.sig>


More information about the systemd-devel mailing list