3

The nfs server has been working without issue through a couple versions of Ubuntu now.

Today I was rebuilding one of my exported disks so stopped the nfs server, rebuilt the disk, then attempted to restart the nfs server. System complained:

proc-fs-nfsd.mount is masked

I found this question below which identifies the issue as a null service definition, and this is the explanation I found in other links. However in my case the service definition link is not to /dev/null so I don't know what's going on my case. (I don't see how the other answers to the linked question apply)

systemctl, how to unmask

Below you can see that the service link points to an actual file.

systemctl start nfs-kernel-server
  Failed to start nfs-kernel-server.service: Unit proc-fs-nfsd.mount is masked.
systemctl unmask proc-fs-nfsd.mount
systemctl start nfs-kernel-server
  Failed to start nfs-kernel-server.service: Unit proc-fs-nfsd.mount is masked.
file /lib/systemd/system/proc-fs-nfsd.mount
/lib/systemd/system/proc-fs-nfsd.mount: ASCII text

Originally put as answer but failed after reboot

The most common fix I've seen is to remove the link to /dev/null, but

 file /lib/systemd/system/proc-fs-nfsd.mount
 /lib/systemd/system/proc-fs-nfsd.mount: ASCII text

However I deleted this file anyway and discovered that lib/systemd/system/proc-fs-nfsd.mount was linked to /dev/null, so I deleted that and reloaded the daemons.

 sudo rm /lib/systemd/system/proc-fs-nfsd.mount
 sudo systemctl daemon-reload

And then restarted the nfs service

 sudo systemctl restart nfs-kernel-server.

This succeeded.

Server worked well until it was restarted. It then failed:

systemctl start nfs-kernel-server
Failed to start nfs-kernel-server.service: Unit proc-fs-nfsd.mount not found

The currently working fix is

 sudo cp /etc/exports ~
 sudo apt purge nfs-kernel-server
 sudo apt install nfs-kernel-server
 sudo cp /etc/exports ~/exports.installed
 sudo cp ~/exports /etc
 sudo systemctl restart nfs-kernel server
 systemctl status nfs-kernel-server

There is now a working NFS server.

 rm ~/exports ~/exports.installed

However I am not confident that all is well so I will not put this as an answer.

  • 1
    Did you try the top answer? From your post, it looks like you tried the same thing the other person tried in their question, not the answer. could you clarify? – Jeff May 07 '19 at 01:43
  • @Jeff Ah yes, thank you, I will clarify the question. In my case I followed the procedure to the point where I discover that the link is not to /dev/null but to an actual file. So I took that to mean that the answer did not apply to my case. – Stephen Boston May 07 '19 at 03:41
  • Your answer worked for me, thank you. – Sridhar Sarnobat Apr 18 '20 at 05:02

2 Answers2

1

I'm not a systemd expert, but I think that worked for me :

rm /run/systemd/system/proc-fs-nfsd.mount
systemctl daemon-reload

Systemd is complaining that proc-fs-nfsd.mount is unmasked, which I assume is because there is a /run/systemd/system/proc-fs-nfsd.mount file which points to /dev/null and prevents systemd from mounting /proc/fs/nfsd.

I have no idea how that file ended up being created tough nor why NFS stopped working. I went through a lot of tries/error so I can't say for sure the two lines above are the ones that worked, but that's my understanding at this point.

0

I had a similar problem following a hard disk change, the content of my /etc/exports becoming incorrect.

Even after fixing /etc/exports, nfs did not start.

The problem is that there were a lot of links to /dev/null in /run/systemd/system/.

The solution was to do

sudo rm /run/systemd/system/*.mount

then to restart nfs.

Thomas
  • 6,223