10

I made a fresh install of Xubuntu 16.04 recently. Before I used 14.04 and mounted a a NFS share with the following line in the /etc/fstab

192.168.178.66:/media/user/drive /media/user/banana nfs rw 0 0

What should happen?

The nfs share should be mounted on startup into the given location.

What happens?

Boot takes very long and the nfs share is not mounted. A greyed symbol for the share appears on my desktop. When I click on it it says something like "Only root can mount". When I press an arrow during boot I can see the systemd log (I suppose) it says ~ "Startjob for /media/user/banane (30s/1,31s)" It wait’s the whole 91s and the it finally boots. Mounting the nfs manually works. But then shutdown does not end. Looking at the systemd output again: "Stop job for /media/netzwerkfreigabe (30s/2m)" The shutdown does not end at the given limit. Instead another longer limit appears. At least three times.

Additional Information

  • the package nfs-common is installed on the client computer
  • the nfs server is a BananaPi running BananianLinux (a modified Debian Jessy)
  • I can mount the nfs-share using the same /etc/fstab line from another computer using Xubuntu 14.04

As far as I know systemd is introduced in Ubuntu 16.04. This may be a systemd issues. Should my fstab config work? Do you mount nfs in a different way these days? I found several reports about similar problems of other users at other forums. Should I file a bug?

Thank you for your answer!

7
  • what version of nfs are you using nfs version 3/4. did you check the users UID in both machines
    – bhordupur
    Apr 25, 2016 at 16:03
  • I think you need to add the user option in fstab
    – bhordupur
    Apr 25, 2016 at 16:09
  • @bhordupur I don’t use UIDs I use the static IP adresses of my internal network. I do not specify the nfs version so I expect I use the newest (4) as either ubuntu (client) and server (client) are up to date systems. Apr 25, 2016 at 21:04
  • @bhordupur The user option did not help. Apr 25, 2016 at 21:22
  • I'm having the exact same issue but my machine also takes a very long time to shutdown also
    – Rick T
    May 7, 2016 at 11:15

8 Answers 8

8

I found the following solution here. Apparrently, you have to use specific systemd options in fstab.

servername:/home   /mountpoint/on/client  nfs  noauto,x-systemd.automount,x-systemd.device-timeout=10,timeo=14,x-systemd.idle-timeout=1min 0 0
3

Had the same problem and have read all the posts on askubuntu.com and elsewhere on it. I finally found a wiki https://wiki.ubuntu.com/systemd#Remote_filesystem_mounts explaining the issue quite well, except for little changes necessary for Ubuntu 16.04. What was not that clear to me after reading this, was that it seems to be necessary to have both, the entry in fstab (pretty standard) AND the .mount file in /etc/systemd/system.

Entry in my fstab:

myserver:/export/work    /mnt/work       nfs     auto    0       0

The mount unit file for systemd /etc/systemd/system/mnt-work.mount (mention the naming convention /mnt/work ==> mnt-work.mount

[Unit]
Description=/mnt/work
Wants=network-online.target rpc-statd.service
After=network-online.target rpc-statd.service

[Mount]
What=myserver:/export/work
Where=/mnt/work
Type=nfs
StandardOutput=syslog
StandardError=syslog
TimeoutSec=50

As you might note, I had to change statd.service to rpc-statd.service and network.target to network-online.target (which I don't know if its necessary).

In addition, I added a timeout of 50 seconds. Nevertheless, when I switch of networking via hardware switch, shutdown will hang.

My problem was, when the fstab entry is missing, the mount unit won't be executed on startup!

1
  • I think I am running into this now. I don't understand why an fstab entry is necessary if I've already systemctl enabled the mount unit file.
    – sheridp
    Jan 24, 2018 at 6:09
2

It took me ages to fix it, and meantime I was locked out of my nfs shares. I changed the 4th field in /etc/fstab from defaults to user. The problem is that only superuser can mount the shared files. Adding user means that anyone can mount files, including nfs.

1

I had the same problem, and found this very useful digitalocean article which gives the correct mount options

hostname:/path /mount/path nfs auto,nofail,noatime,nolock,intr,tcp,actimeo=1800 0 0
1
  • This finally worked for me on Ubuntu 16.04 LTS Jun 2, 2017 at 14:19
0

I had the exact same setup and it just worked for me. NFS export was on 14.04 and I mounted it using 16.04. I did it just like I've done older versions (and from what it sounds like, just what you have tried). Make sure you added the new machine to your exports.

0

I'm having the same problem but it also takes a long time to shutdown. I'm connecting my desktop to a rasberry pi running NFS:

try editing your /etc/fstab on your client machine to:

192.168.178.66:/media/user/drive /media/user/banana nfs soft,intr,rsize=8192,wsize=8192
0

In Ubuntu 16.04 just add user option to the appropriate line in /etc/fstab and try mounting as normal user, it should works (even for cifs mount).

1
  • If you have (like me) /home mounted with encrypted lvm and you're trying to mount a password protected network share, if you have smbcredentials file inside your home, may be changing the location of the credentials file outside the home partition fix the issue (for me, it did!).
    – cloud81
    May 27, 2016 at 15:33
0

[1] Create a file at:

/etc/network/if-up.d/fstab

[2] Add this to it:

#!/bin/sh
mount -a

[3] Make the file executable:

sudo chmod +x /etc/network/if-up.d/fstab

From this answer: https://ubuntuforums.org/showthread.php?t=2392742&p=13795542#post13795542

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .