[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: auto-mount NFS shares on boot



On 06/27/2015 08:02 PM, Jonas Meurer wrote:
> Am 27.06.2015 um 16:07 schrieb Christian Seiler:
>> Could you try to do the following:
>>
>> 1. create a directory /etc/systemd/system/remote-fs-pre.target.d
>> 2. create a file /etc/systemd/system/remote-fs-pre.target.d/nfs.conf
>>    with the following contents:
>>
>> [Unit]
>> After=nfs-common.service
>>
>> And then reboot your system? I would bet it should work then.
> 
> Perfect, that solution works like a charm. nfs-common is started before
> remote-fs, thus rpc.gssd runs already when the NFS share is mounted.

Great, glad I could solve your problem. :)

> I suggest to add this simple fix to Jessie by uploading it to
> stable-proposed-updates. What do you think? Also, do you think that
> /etc/systemd/system/remote-fs-pre.target.d/nfs.conf belongs to systemd
> package or to nfs-common? I would say it belongs to nfs-common as that
> one provides the required tools and services to mount NFS shares on a
> client.

So the fix I gave you is a fix that shouldn't be copied verbatim into
a Debian package. /etc/systemd is administrator territory, /lib/systemd
is package territory, so any proper fix of a package should go to /lib.

Furthermore, my suggestion for your problem was to add a drop-in that
augments the Debian-provided unit files (see man systemd.unit for how
drop-ins work) - which is great since you only want to extend the unit,
not completely replace it.

But in the packages themselves it is perfectly possible to modify the
unit files themselves, so a drop-in is not necessary at all for any
native unit.

So for Stretch:

 - assuming that nfs-common will have a native unit by then, the
   proper fix would be to simply add Before=remote-fs-pre.target
   to that unit, and that would fix that

For Jessie:

 - nfs-common is still an init script, so one cannot simply add
   Before=remote-fs-pre.target to that. But there are two other
   options:

 - just for Jessie: update systemd to change the original unit file
   remote-fs-pre.target to include After=nfs-common.service

 - or alternatively, package a drop-in in /lib in the nfs-common
   package, i.e.
   /lib/systemd/system/nfs-common.service.d/systemd-ordering.conf:
   [Unit]
   Before=remote-fs-pre.target

(IMHO at least, I'll defer to the maintainers of the respective
packages as to what they think is appropriate.)

Christian

Attachment: signature.asc
Description: OpenPGP digital signature


Reply to: