13

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?

d2le
  • 133
  • 1
  • 1
  • 4

9 Answers9

10

I had to restart rpcbind service to work:

$ sudo service rpcbind restart

I've found it out in this thread

RPiAwesomeness
  • 3,021
  • 4
  • 31
  • 52
Bubu
  • 101
  • 1
  • 3
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
benathon
  • 391
  • 3
  • 11
syb0rg
  • 8,178
  • 4
  • 38
  • 51
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.

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.

lesca
  • 173
  • 1
  • 5
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...

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.

Rotareti
  • 189
  • 4
  • 11
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

nachoparker
  • 141
  • 4
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)

Stéphane B.
  • 123
  • 5