D&C GLug - Home Page

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

Re: [LUG] systemd and NFS shares

 

On 28/08/2021 16:43, comrade meowski wrote:
On 28/08/2021 14:43, Julian Hall wrote:
Hi All,

After several months in hospital - having simply turned my PC off when I last used it - I had the expectation that it would work when i powered it back up. After all the PC when off shouldn't care if the next time it is turned on is a minute or a month later. The NAS shares however refuse to mount properly.


Hope you're feeling better after getting back out of hospital chief.
Getting there slowly :)
You and NFS shares between that NAS and your Mint PC have a loooooong history don't they? We seem to have done this several times before at this point...
You could say that.. and you'd be right. What I don't understand is why I always seem to end up with a different solution to the same problem.

Delete ALL of the old crap - get rid of the weird .mount and .automount files, clean fstab and check through your systemd units to find and remove any old references.
I think I did that and used 'grep -r' to look for file mentions. In seems init.d still lists autofs as a service despite purging autos off the system? Is that harmless?

Add this as a one-liner for each share you want to add to /etc/fstab:

192.168.1.2:/NFSSHARE   /mountpoint/on/client  nfs _netdev,noauto,x-systemd.automount,x-systemd.mount-timeout=10,timeo=14,x-systemd.idle-timeout=1min 0 0

Then either reboot or run:

sudo systemctl daemon-reload
sudo systemctl restart remote-fs.target
Reboot shows nothing mounted (desktop options are set to show mounts). Systemctl commands mount the share but behave as I was getting, no access to content unless I am root.

That'll sort you out and provide on-access instant mounting of the NFS share(s). If you insist on having desktop icon shortcuts to the shared drives then fair enough - get rid of whatever is there now and issue per share:

ln -s /mountpoint/on/client /home/julian/Desktop/

That will give you an old fashioned symbolic link to the shares and clicking on them will trigger the automount behaviour through the fstab entry which seems to be what you want.
What can I say, I'm old and stuck in my ways :)

It is a bit weird that after just a short period sitting your PC's existing mount setup had stopped working - did you immediately run a big fat apt upgrade on it perhaps and update a ton of software once you started using it again? Maybe in those months of software upgrades there was a systemd upgrade or something that retired the mount behaviour you were using... ¯\_(ツ)_/¯

Yes I did run an upgrade on everything but only /after/ it was already not working so I discounted those updates.

Julian

--
“The great tragedy of Science — the slaying of a beautiful hypothesis by an ugly 
fact.”

― Thomas Henry Huxley


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