• NFS mount prevents shuting down


    Hi

    I have a media server with shared NFS folders. I added in /etc/fstab the command to automatically mount them at start up like :
    ip_server:shared_folder_server /mnt/folder_client nfs defaults 0 0

    It works perfectly but I have then a weird behavior : when I ask for shutdown (by clicking on Gnome shutdown icon) I get a black screen but my laptop doesn’t shutdown as it should.
    I am able to reproduce this behavior meaning if I remove the NFS mount commands from /etc/fstab then, my laptop will shutdown as it should upon request…

    What did I do wrong ? Any idea of the log file to look at ?

    Thanks!

  • I ran into this issue on my own system recently. While it’s no longer a problem for me, I am not sure exactly why that is. Here’s what I did that seems to have fixed it:

    1. Add media server IP address to /etc/hosts and give it a domain and hostname. Here’s the line I added to mine:
      192.168.1.222 MEDIA-SERVER.WORKGROUP MEDIA-SERVER
    2. Replace the IP address with the hostname in fstab. This didn’t fully fix it for me so I had to do #3. You should check to see if this resolves it for you before moving on to #3.
    3. Create the following files. The names of the files are derived from the location of the mount point. My mount point is /data
    /etc/systemd/system/remote-fs.target.wants/data.mount
    /etc/systemd/system/remote-fs.target.wants/data.automount 
    

    If your mount point is in your home directory, the file name would look like this: home.username.data
    Here is the contents of each file:
    data.mount

    [Unit]
    Description=Data NFS Mount
    Requires=NetworkManager-wait-online.service network-online.target nfs-client.target
    After=NetworkManager-wait-online.service network-online.target nfs-client.target
    BindsTo=network-online.target nfs-client.target
    
    [Mount]
    What=MEDIA-SERVER.WORKGROUP:/i-data/cc0d9d84/nfs/dustin
    Where=/data
    Type=nfs
    Options=users,soft,nfsvers=3,suid,exec,dev,noauto,x-systemd.device-timeout=30,timeo=600,retrans=2,noatime,x-systemd.automount
    TimeoutSec=30
    TimeoutStopSec=15
    

    data.automount

    [Automount]
    Where=/data
    TimeoutIdleSec=2700
    
    1. Finally, remove the line that you have in fstab and enable the mount with systemctl:
    sudo systemctl enable data.mount data.automount
    

    Hope it helps! Cheers!

  • Hi

    at first, sorry for my late reply. I have been quite busy lately.

    I have read quite a lot on this subject and it seems to be a common issue with mainly Arch. I found one post though on Debian with unclear root cause analysis, except that it might be connected to sytemd (Debian post)

    I have used many of the tricks listed in the good Arch wiki in NFS (ArchWiki). Playing around with options or automatic mount handling service scripts have not helped so much. I might have missed something though in the way to activate the services or to tweak them for my environment.

    At the end, I read more in detail your own script (should have done that earlier but needed to gather more knowledge on this topic first). Then, I noticed you use the soft option when you mount your folder. It is actually the key point solving this issue despite it is not recommended to use it.

    Hence, by using following in /etc/fstab, my issue is solved. There is no need to create additional service:
    192.168.0.30:/home/server_folder /mnt/client_folder nfs4 soft,noauto,x-systemd.automount,x-systemd.device-timeout=10,timeo=14 0 0
    Again, what is key here is the option soft. The rest is based on the advise of the ArchWiki above.

    I have another family desktop computer running Linux Mint (I prefer of course Antergos on my laptop:smirk: ) and I don’t have any issue with the NFS client, without having to use the option soft.
    It sounds to me to be an Arch “bug”, maybe connected to systemd integration. Hope one day someone will solve that.

    See you around.

nfs2 shutdown18 Posts 3Views 1327
Log in to reply