wopper
Posts: 4
Joined: Thu Oct 01, 2015 6:09 am

NFS automount /etc/fstab with Jessie

Thu Oct 01, 2015 6:46 am

Hi!

Im installing a fresh new Jessie image to my second Pi, a linux beginner im copy the config from the running Wheezy on to the new Jessie. So far so good but whith the NFS mounts in /etc/fstab it will not start, an mount by cli works like a charme.


Old and working wheezy /etc/fstab config:

Code: Select all

172.16.1.2:/volume1/pi /mnt/backup nfs rw,relatime,vers=3,rsize=131072,wsize=131072,namlen=255,hard,proto=tcp,timeo=600,retrans=2,sec=sys,mountaddr=172.16.1.2,mountvers=3,mountport=892,mountproto=udp,local_lock=none,addr=172.16.1.2
Exports on the synology:

Code: Select all

/volume1/pi	172.16.1.0/24(rw,async,no_wdelay,no_root_squash,insecure_locks,sec=sys,anonuid=1025,anongid=100)
if i mount by cli it works with this command

Code: Select all

sudo mount -t nfs  172.16.1.2:/volume1/pi /mnt/backup
Any idea why its not working, and where to find logging for it? tnx

wopper
Posts: 4
Joined: Thu Oct 01, 2015 6:09 am

Re: NFS automount /etc/fstab with Jessie

Thu Oct 01, 2015 10:10 am

Changed the nic settings from DHCP to static and it works fine, looks like a timing issue when loading the different services.

User avatar
PeterO
Posts: 4516
Joined: Sun Jul 22, 2012 4:14 pm

Re: NFS automount /etc/fstab with Jessie

Thu Oct 01, 2015 11:16 am

wopper wrote:Changed the nic settings from DHCP to static and it works fine, looks like a timing issue when loading the different services.
But that is not a generally applicable solution :-( Systemd should be able to deal with this but doesn't :-(
PeterO
Discoverer of the PI2 XENON DEATH FLASH!
Interests: C,Python,PIC,Electronics,Ham Radio (G0DZB),1960s British Computers.
"The primary requirement (as we've always seen in your examples) is that the code is readable. " Dougie Lawson

dom
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 5227
Joined: Wed Aug 17, 2011 7:41 pm
Location: Cambridge

Re: NFS automount /etc/fstab with Jessie

Thu Oct 01, 2015 11:20 am

I hit this issue and with a lot of searching found adding ",noauto,x-systemd.automount" to the end of the options fixed it for me.

User avatar
DougieLawson
Posts: 35021
Joined: Sun Jun 16, 2013 11:19 pm
Location: Basingstoke, UK
Contact: Website Twitter

Re: NFS automount /etc/fstab with Jessie

Thu Oct 01, 2015 6:12 pm

dom wrote:I hit this issue and with a lot of searching found adding ",noauto,x-systemd.automount" to the end of the options fixed it for me.
That's the solution I'm going to test this weekend when my main 24/7 running server gets a reboot for Jessie. I've got two systems already running Jessie (although one has crashed and I'm 80 miles from home so it hasn't been restarted). Four other systems are still running Wheezy and will be upgraded this weekend if that test works.
Note: Having anything remotely humorous in your signature is completely banned on this forum.

Any DMs sent on Twitter will be answered next month.

This is a hippy & doctor free zone.

Cecil
Posts: 3
Joined: Fri Oct 02, 2015 3:42 am

Re: NFS automount /etc/fstab with Jessie

Fri Oct 02, 2015 3:52 am

Yes! the noauto,x-systemd.automount options do work!

Thank you

dom
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 5227
Joined: Wed Aug 17, 2011 7:41 pm
Location: Cambridge

Re: NFS automount /etc/fstab with Jessie

Fri Oct 02, 2015 9:24 pm

An alternative that seems to work too is to launch dhcpcd in a systemd friendly way.

Code: Select all

sudo rm /etc/init.d/dhcpcd
cat | sudo tee /etc/systemd/system/multi-user.target.wants/dhcpcd.service << EOF
[Unit]
Description=dhcpcd on all interfaces
Wants=network.target
Before=network.target

[Service]
Type=forking
PIDFile=/run/dhcpcd.pid
ExecStart=/sbin/dhcpcd -q -t 0
ExecStop=/sbin/dhcpcd -x

[Install]
WantedBy=multi-user.target
EOF
Now it seems to mount without ",noauto,x-systemd.automount".
Note: assuming this is reported as working, there will be an update to make this the default.

User avatar
Dandelion
Posts: 3
Joined: Tue Oct 02, 2012 1:07 pm
Location: Cheadle, Cheshire, UK

Re: NFS automount /etc/fstab with Jessie

Mon Oct 05, 2015 12:50 pm

The use of the "noauto,x-systemd.automount" instructions in fstab works here too. Looks like the dependencies at boot are not correct (rpcbind not starting until after the nfs mount failure). Once booted, the system will mount the NFS share no problem using:
sudo mount -a
Looks like I need to do a bit of reading about how to influence boot sequencing and how to add explicit dependencies under systemd.

timrowledge
Posts: 1235
Joined: Mon Oct 29, 2012 8:12 pm
Location: Vancouver Island
Contact: Website

Re: NFS automount /etc/fstab with Jessie

Mon Oct 05, 2015 5:51 pm

Just as an extra datapoint, adding the neat stuff works nicely for me too. I end up with -

Code: Select all

192.168.1.65:/Users/tim /home/pi/DizietFS nfs rsize=8192,wsize=8192,timeo=14,intr,noauto,x-systemd.automount 0 0
Making Smalltalk on ARM since 1986; making your Scratch better since 2012

rbn
Posts: 136
Joined: Tue Dec 27, 2011 8:32 pm
Location: Near Peterborough
Contact: Website

Re: NFS automount /etc/fstab with Jessie

Sat Oct 10, 2015 7:49 am

This is great. I've been trying to get auto mount of my nfs share to work since moving to Jesse, and it always hung because the wireless network was not fully up when it was called.
adding noauto,x-systemd.automount to the fstab entry sorted it.
Many thanks

Malakesher
Posts: 4
Joined: Fri Jan 31, 2014 12:06 pm

Re: NFS automount /etc/fstab with Jessie

Mon Oct 12, 2015 1:25 pm

dom wrote:An alternative that seems to work too is to launch dhcpcd in a systemd friendly way.

Code: Select all

sudo rm /etc/init.d/dhcpcd
cat | sudo tee /etc/systemd/system/multi-user.target.wants/dhcpcd.service << EOF
[Unit]
Description=dhcpcd on all interfaces
Wants=network.target
Before=network.target

[Service]
Type=forking
PIDFile=/run/dhcpcd.pid
ExecStart=/sbin/dhcpcd -q -t 0
ExecStop=/sbin/dhcpcd -x

[Install]
WantedBy=multi-user.target
EOF
Now it seems to mount without ",noauto,x-systemd.automount".
Note: assuming this is reported as working, there will be an update to make this the default.
I would just like to say that after over 3 hours of trying to successfully mount a networked drive (which should have taken me a couple of minutes) your solution is the only one that worked for me.

Including ",noauto,x-systemd.automount" not working.

Thank you very much and I hope this gets fixed very soon.

rubikwizard
Posts: 95
Joined: Tue Jan 10, 2012 10:37 pm
Location: West Yorkshire
Contact: Website

Re: NFS automount /etc/fstab with Jessie

Mon Oct 12, 2015 8:11 pm

Thanks Dom

Code: Select all

,noauto,x-systemd.automount
This worked for me too. Only 'problem' is that the mounted volume appears twice on my desktop (using different icons). It only used to appear once. Both of them work. Any idea how to remove one of them?
Image

wopper
Posts: 4
Joined: Thu Oct 01, 2015 6:09 am

Re: NFS automount /etc/fstab with Jessie

Wed Oct 21, 2015 5:38 am

Hi guys

i reinstalled the Pi again, as a newbee you make mistakes ;-)

But i'm unable to autostart "rpcbind" with RC.D because of the missing RC config parameters in the default rpcbind script, i now inserted it to rc.local and that works.

But i can't stand it, that i had it working on Jessie with the previous installation, could you tell me how to start the NFS service in a decent way?

The " noauto,x-systemd.automount " works fine with reboot.

User avatar
DougieLawson
Posts: 35021
Joined: Sun Jun 16, 2013 11:19 pm
Location: Basingstoke, UK
Contact: Website Twitter

Re: NFS automount /etc/fstab with Jessie

Wed Oct 21, 2015 9:47 am

You shouldn't need to do that. Adding rpcbind to rc.local is a bad idea.

If you've got all of the NFS stuff installed correctly then

Code: Select all

192.168.1.230:/nfs/home /home  nfs defaults,noatime,noauto,x-systemd.automount 0 0
192.168.1.230:/nfs/shared /shared nfs defaults,noatime,noauto,x-systemd.automount 0 0
192.168.1.230:/nfs/server /srv nfs defaults,noatime,noauto,x-systemd.automount 0 0
should encourage your Jessie systemd to start rpcbind for you. The important thing is that x-systemd.automount clause.

With Wheezy you'd enable rpcbind with
sudo update-rc.d rpcbind defaults
sudo update-rc.d rpcbind enable


Those commands should work with your Jessie systemd installation to create the right systemd service files.
Note: Having anything remotely humorous in your signature is completely banned on this forum.

Any DMs sent on Twitter will be answered next month.

This is a hippy & doctor free zone.

wopper
Posts: 4
Joined: Thu Oct 01, 2015 6:09 am

Re: NFS automount /etc/fstab with Jessie

Wed Oct 21, 2015 10:49 am

Hi Dougie

you completely right! It works even without the rpc bind rc.local or rc.update code.

Many thanks! (it even works with DHCP)

nitrosont
Posts: 1
Joined: Wed Jan 14, 2015 4:16 pm

Re: NFS automount /etc/fstab with Jessie

Thu Feb 18, 2016 1:25 pm

I've got the similar problem. At my Raspberry running Jessie I cannot add a nfs share.
I put the following in my /etc/fstab

Code: Select all

192.168.1.3:/volume1/folder /home/pi/nas/folder nfs defaults,noatime,noauto,x-systemd.automount 0 0
This results in the following: I get the folder "folder" with owner:group = root:root.
Of course I cannot enter the folder and not access it.

Anyone an idea?

amb1ent
Posts: 1
Joined: Mon Apr 04, 2016 12:40 pm

Re: NFS automount /etc/fstab with Jessie

Mon Apr 04, 2016 12:45 pm

I can confirm only the systemd configuration file change worked for me, the fstab options had no effect.

sancho_mic
Posts: 4
Joined: Thu Apr 07, 2016 8:53 pm

Re: NFS automount /etc/fstab with Jessie

Fri Apr 08, 2016 9:40 am

hi,

Got exact same issues as OP.

I tried the option from Dougie - no luck...But it worked on wheezy. Now on jessie not working anymore...
EDIT: had to reverse "wheezy" with "jessie" in the above statement - got confused which one is older)

I tried with the noauto,x-systemd.automount, no luck...

I tried with the option from dom - no luck

I tried changing the /etc/exports of the nfs server (synology) - the "insecure_locks" vs "insecure" - i'm not even sure if this trick is required on DSM5.2 and for wheezy. I know for sure it was required for openelec to access nfs shares @ synology in the past.


At certain point, my raspberry was behaving in a very quantum-ish way :)
the systemctl status mnt-mynfsshare.mount command was showing it as failed.

However when i was trying to access the mount it was working. Reissuing the systemctl status mnt check was showing now as active...
So i guess it has to do with the automount thing.2

In my scenario, i run a script @reboot via crontab - this script needs to access the nfs mount.
Script fails and stops because nfs mount fails initially during reboot.

Any suggestion?

Maybe there is better practice than to use the @reboot in crontab, but it was simple to implement - i'm just noob...

Many thanks,
-s
Last edited by sancho_mic on Fri Apr 08, 2016 12:08 pm, edited 1 time in total.

DirkS
Posts: 9777
Joined: Tue Jun 19, 2012 9:46 pm
Location: Essex, UK

Re: NFS automount /etc/fstab with Jessie

Fri Apr 08, 2016 11:25 am

sancho_mic wrote:I tried the option from Dougie - no luck...But it worked on jessie. Now on wheezy not working anymore...
:?: Did you downgrade from Jessie to Wheezy?

sancho_mic
Posts: 4
Joined: Thu Apr 07, 2016 8:53 pm

Re: NFS automount /etc/fstab with Jessie

Fri Apr 08, 2016 12:16 pm

thanks for the fast reply DirkS...
i edited my post, got confused with the jessie wheezy thing...

So i'm running jessie, the latest, and i'm facing issues.
Was working ok in wheezy...

eponymous
Posts: 3
Joined: Sat Apr 09, 2016 3:53 am

Re: NFS automount /etc/fstab with Jessie

Sat Apr 09, 2016 4:06 am

Code: Select all

,noauto,x-systemd.automount
was not working for me and the raspbian jessie image I downloaded was already starting dhcpcd with a systemd service file.

I finally got rpcbind to reliably start by disabling it through systemd, moving /etc/init.d/rpcbind to different directory (it's not clear to me why, but it would otherwise still try to start even after I'd disabled it), and finally by creating and enabling an rpcbind.service file based on https://lists.debian.org/debian-devel/2 ... 00618.html:

Code: Select all

[Unit]
Description=RPC bind portmap service
After=systemd-tmpfiles-setup.service
Wants=remote-fs-pre.target
Before=remote-fs-pre.target
DefaultDependencies=no

[Service]
ExecStart=/sbin/rpcbind -f -w
KillMode=process
Restart=on-failure

[Install]
WantedBy=sysinit.target
Alias=portmap
I also created the directory /run/rpcbind/, which rpcbind seemed to want based on some non-fatal errors it was issuing.

User avatar
DougieLawson
Posts: 35021
Joined: Sun Jun 16, 2013 11:19 pm
Location: Basingstoke, UK
Contact: Website Twitter

Re: NFS automount /etc/fstab with Jessie

Sat Apr 09, 2016 10:00 am

Try this
sudo apt-get purge rpcbind
sudo apt-get install rpcbind nfs-common
Note: Having anything remotely humorous in your signature is completely banned on this forum.

Any DMs sent on Twitter will be answered next month.

This is a hippy & doctor free zone.

sancho_mic
Posts: 4
Joined: Thu Apr 07, 2016 8:53 pm

Re: NFS automount /etc/fstab with Jessie

Sat Apr 09, 2016 9:54 pm

Dougie hi

Your purge did the trick!
Now all ok :)
Mount is done during boot (and my script starts writing to the nfs mount since boot)

Many thanks!
-s

sancho_mic
Posts: 4
Joined: Thu Apr 07, 2016 8:53 pm

Re: NFS automount /etc/fstab with Jessie

Sat Apr 09, 2016 9:57 pm

@eponymous
thanks for the suggestion, will give it a try on next reinstall.
cheers
-s

lsrmgr
Posts: 1
Joined: Mon May 02, 2016 7:13 pm

Re: NFS automount /etc/fstab with Jessie

Mon May 02, 2016 7:36 pm

dom wrote:I hit this issue and with a lot of searching found adding ",noauto,x-systemd.automount" to the end of the options fixed it for me.
Dom, thank you for posting this. I works nicely for me with Debian Jessie. I have been trying to get nfs automount to work since installing Jessie when it first came out.

Return to “Troubleshooting”