D&C GLug - Home Page

[ Date Index ] [ Thread Index ] [ <= Previous by date / thread ] [ Next by date / thread => ]

Re: [LUG] Systemd NFS mount via fstab.

 

On 23/07/18 22:40, mr meowski wrote:
On 23/07/18 19:29, Julian Hall wrote:

Apologies for the unintentional confusion. Ironically I thought it
would make life easier in the long run.
Hey no problem, we'll get there in the end... This is the sort of thing
I could fix in a couple of minutes in person on your machine but there
are so many possible issues to account for without direct access it's a
lot more of a trial and error process as we try and eliminate all the
other conflicting variables.

On my 18.3 VM I didn't have the same issues as you but I suspect your
physical system is a lot, lot 'dirtier'. God only knows what you've done
to it over the course of all the fiddling and in place upgrades it's
had, and that of course is where the problem lies.

You don't seem to have multiple conflicting network services enabled
which is a good start. Before we dig much deeper I have another simpler
approach to try which conveniently will also switch the NFS mount(s) to
the recommended on-demand method as well. Keep double checking for typos
obviously and adapt to your system if I fat finger anything - I'm going
to ignore your other borked mount units and concentrate on just
media-julian-DEMETER initially.


1: check the state of current unit:
systemctl is-enabled media-julian-DEMETER.mount

2: disable it now:
sudo systemctl disable media-julian-DEMETER.mount

3: create the new automount unit:
sudo vi /etc/systemd/system/media-julian-DEMETER.automount

4: add the following contents to the unit file and save it:

[Unit]
Description=Automount DEMETER NFS

[Automount]
Where=/media/julian/DEMETER

[Install]
WantedBy=multi-user.target

5: sudo systemctl daemon-reload
6: sudo systemctl enable media-julian-DEMETER.automount
7: systemctl is-enabled media-julian-DEMETER.automount
8: sudo reboot

At this point you'll have a fresh start and your PC will _not_ have
tried to automatically mount the DEMETER share, which is correct. Check
carefully what happens when you do:

9: sudo systemctl status media-julian-DEMETER.automount
this should show it's loaded and enabled

10: mount | grep -i nfs
should show nothing at this point

11: ls -alh /media/julian/DEMETER
this will trigger the automount unit and show the directory listing!

12: sudo systemctl status media-julian-DEMETER.automount
13: mount | grep -i nfs

The last two commands will look different from the run before you caused
systemd to mount the NFS directory on demand - something like this will
show:

Jul 23 22:15:52 mint systemd[1]: media-ghost-FAILBOT.automount: Got
automount request for /media/ghost/FAILBOT, triggered by 2492 (ls)

And the filtered mount command output will now clearly show the NFS
filesystem attached.

You don't need any special group access for the user in this case and
everything should just happen automatically but let's see how you get on
first. *Anything* accessing the /media/julian/DEMETER directory will
trigger the mount from now on including pointing a file browser at it,
backup scripts, whatever.

Report back as usual chief.
That all worked as you described.. which is a good thing! It's not mounting at boot yet but I assume it isn't supposed to yet.

Cheers,

Julian

--
The Mailing List for the Devon & Cornwall LUG
https://mailman.dclug.org.uk/listinfo/list
FAQ: http://www.dcglug.org.uk/listfaq