12

I'm attempting to set up my Raspberry Pi with Wheezy Raspbian 2013-02-09 as an NFS server (client will be Ubuntu 12.10). I have followed these instructions.

I can't start the service and get the following message:

$ sudo service nfs-kernel-server restart
[ ok ] Stopping NFS kernel daemon: mountd nfsd.
[ ok ] Unexporting directories for NFS kernel daemon....
[ ok ]   Exporting directories for NFS kernel daemon....
[....] Starting NFS kernel daemon: nfsd
[warn] Not starting: portmapper is not running ... (warning).
$ rpcinfo -p
<br>rpcinfo: can't contact portmapper: RPC: Remote system error - No such file or directory

Not sure what is missing?

9

A moderator in this forum post said that this command would work:

sudo update-rc.d rpcbind enable && sudo update-rc.d nfs-common enable
  • 1
    confirmed as a working solution. with an eye towards the move to systemd equivalent command is sudo systemctl enable rpcbind && sudo systemctl enable nfs-common (although both of these services do appear to still use init.d style startup). – ben_wing Jul 8 '17 at 15:51
  • i think i also needed to explicitly start the services, and that ordering was important with nfs-common needing to be 1st. i used sudo systemctl start nfs-common then sudo systemctl start rpcbind – ben_wing Jul 8 '17 at 16:01
10

I had to restart rpcbind service to work:

$ sudo service rpcbind restart

I've found it out in this thread

  • 1
    You somehow didn't link to the thread, I've fixed it for you. Glad to see new users involved! Also, pop into the chat from time to time and stay a bit, it's always nice to have someone new to talk to :D – RPiAwesomeness Mar 5 '14 at 13:22
  • This made NFS work for me not the other answer. – Mauvis Ledford Apr 9 '14 at 3:11
8
$ sudo service rpcbind restart

...does work, but the "portmapper is not running" problem will reappear on the next reboot.

The bottom of this page has a fix that will survive a reboot, but be aware it will delete your /etc/exports. In short, backup your /etc/exports then:

sudo apt-get purge rpcbind
sudo apt-get install nfs-kernel-server

Then restore your /etc/exports.

  • using your answer combined with this: pihomeserver.fr/en/2013/06/21/… did the trick for me. – Chasester Feb 13 '15 at 14:22
  • This solved for me. For some reason the NFS kernel server was wrongly installed. Thanks. – hgf Feb 22 '15 at 21:38
  • I've seen the same sort of issues on other Debian distros (I run them on my Home PCs) - somehow rpcbind is the replacement for portmapper but the aliasing does not seem to have been completed (or it is a superficial issue masking a deeper one!) Also, I run a systemd free household - so faulty init.d scripts are likely for me to have issues with. – SlySven Feb 3 '16 at 21:22
6

I am running Raspbian Jessie Lite (released on Mar 18, 2016), and got the same issue. Here is my steps to completely fix this issue, even if after a reboot.

Firstly have a look at the init file for /etc/init.d/nfs-kernel-server, you should notice its start runlevel is 2,3,4,5.

Also look at the following files' start runlevel, which is S only. I changed its runlevel to 2,3,4,5.

/etc/init.d/nfs-common
/etc/init.d/rpcbind

Then try to update-rc.d the changed init scripts with defaults. First try fails. The trick is to remove and add them again.

update-rc.d -f rpcbind remove
update-rc.d rpcbind defaults

update-rc.d -f nfs-common remove
update-rc.d nfs-common defaults

update-rc.d -f nfs-kernel-server remove
update-rc.d nfs-kernel-server defaults

After that, check the order of the services. It should be rpcbind, nfs-common, and nfs-kernel-server.

I also posted a blog for this. You can also find it here.

  • After months of attempting to fix this through various other means, I'd resigned myself to manually restarting NFS at boot. This solution works. Thank you! – boneskull Jan 15 '17 at 9:52
  • This is THE fix. All the other ones posted did not fix the problem. Thank you very much for posting this! – chaoticslacker May 29 '17 at 15:37
2

The underlying problem is the symlinks in /etc/rc*.d are scattered around a bit. Some of the suggestions above rely on remaking these links and, perhaps, they get made with more appropriate order. Sometimes. Try -

for i in rpcbind nfs-common nfs-kernel-server ; do find /etc/rc* -name "S*$i*"; done

to see when they are started. In reality, you only need them started at level 3, so I edited /etc/init.d/rcpbind, /etc/init.d/nfs-common and /etc/init.d/nfs-kernel-server so "# Default-Start: 3" and ran this to enforce it -

for i in rpcbind nfs-common nfs-kernel-server ; do update-rc.d -f "$i" remove; update-rc.d "$i" defaults; done

Note that update-rc.d will not change an existing entry and silently fails to remove an entry (if script still exists) unless you add the -f. Ideally you will end up with something like this -

/etc/rc3.d/S01rpcbind
/etc/rc3.d/S02nfs-common
/etc/rc3.d/S03nfs-kernel-server

And it will now boot cleanly. An update to NFS may well overwrite your good work...

  • This is the best answer IMHO. Gives a direct approach understanding the issue. – Daan Mar 6 '17 at 0:29
1

I was struggling with the same issue as well. The above solutions didn't work. In my case it came from an issue with my locales. The following line popped up in the terminal during installation of: nfs-kernel-server nfs-common rpcbind.

perl: warning: Setting locale failed.

Make sure you don't see an error about your locales during the installation of these packages. I fixed my locales, reinstalled the packages and now it works.

  • It does seem possible to me that the installing those packages twice may have fixed the issue anyhow, rather than sorting out your locales - though of course that is a good thing to have straightened out anyhow! – SlySven Feb 3 '16 at 21:25
  • I agree. Anyhow, after fixing the locales the second installation looked way more safe without all the errors. – Rotareti Feb 4 '16 at 12:25
1

This works for me. Clean and resists reboots.

You have to setup systemd to do the order properly

cat <<EOF | sudo tee -a /etc/systemd/system/nfs-common.services
[Unit]
Description=NFS Common daemons
Wants=remote-fs-pre.target
DefaultDependencies=no

[Service]
Type=oneshot
RemainAfterExit=yes
ExecStart=/etc/init.d/nfs-common start
ExecStop=/etc/init.d/nfs-common stop

[Install]
WantedBy=sysinit.target
EOF

cat <<EOF | sudo tee -a /etc/systemd/system/rpcbind.service
[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
EOF

sudo systemctl enable nfs-common
sudo systemctl enable rpcbind
sudo reboot

taken from here

https://github.com/geerlingguy/raspberry-pi-dramble/issues/65#issuecomment-283046966

0

I fixed it with: $ sudo service portmap start Then restart nfs service: $ sudo service nfs-kernel-server restart

and it works.

0

I have tested most of the previous solutions, they don't work after a restart of the Raspberry Pi ( the command rpcinfo -p | grep nfs gave me nothing ).

Solution :

echo service nfs-kernel-server restart | sudo tee -a /etc/rc.local

or

sudo vi /etc/rc.local
service nfs-kernel-server restart

To verify :

> sudo shutdown -r now

> rpcinfo -p | grep nfs

Tested on Raspian 8 (jessie)

Not the answer you're looking for? Browse other questions tagged or ask your own question.