On my Raspbian (based on Debian Jessie), I need to start at boot rpcbind and nfs-common services because I need them to start autofs at boot for a NFS mount.

Since Debian Jessie now has moved to systemd, I want to know the best way to start those 3 services (rpcbind, nfs-commond, autofs) in the correct order to avoid issues.

If I manually mount the NFS share it works. And it also works when using the autofs service with rpcbind and nfs-common already up and running.

autofs uses a systemd unit script. About the other 2 services, should I make init.d scripts or do I have to create systemd unit files? How can I write them?

  • hint: the fact that Jessie moved by default to systemd, does not oblige you to move to now. I am giving it some more time. Commented Feb 15, 2016 at 8:45
  • 1
    It should all just work, whether you use System V init or systemd, so you shouldn't need to write any scripts. autofs provides a systemd unit as you point out, and even though rpcbind and nfs-common don't (yet), their init.d scripts are taken into account by systemd. (I use all three and didn't need to fix anything after upgrading to Jessie and switching to systemd.) Is there a specific problem you're seeing? Commented Feb 15, 2016 at 9:23
  • @StephenKitt I only need to be sure that rpcbind and nfs-common are loaded before autofs. It should be easier to do with systemd unit file since you can specify dependecies and so the correct order. But I never used systemd before and never wrote a systemd unit file, so I don't know how to do that the right way. Otherwise how is it possible to assure this with init.d? Commented Feb 15, 2016 at 9:39
  • Have you tried it? With init.d, the order is defined by the BEGIN INIT INFO comments (Required-Start, Should-Start etc.). On my systems, running System V init or systemd, the scripts are automatically ordered such that rpcbind and nfs-common are started before autofs. Commented Feb 15, 2016 at 10:07
  • @StephenKitt I tried your solution, so I used sudo update-rc.d rpcbind enable and sudo update-rc.d nfs-common enable. Only nfs-common starts at boot correctly but rpcbind not. So I tried also sudo update-rc.d rpcbind defaults but no way. The only workaround is to add service rpcbind start inside the /etc/rc.local script but it's not the proper way... Any suggestion? Commented Feb 17, 2016 at 10:59

1 Answer 1


The reason for the problem is the lack of systemd configuration files. Base on a post by Matt Grant on debian-devel these are the steps you need to perform.

1. Create /etc/systemd/system/nfs-common.service

cat >/etc/systemd/system/nfs-common.service <<\EOF
Description=NFS Common daemons

ExecStart=/etc/init.d/nfs-common start
ExecStop=/etc/init.d/nfs-common stop


2. Create /etc/systemd/system/rpcbind.service

cat >/etc/systemd/system/rpcbind.service <<\EOF
Description=RPC bind portmap service

ExecStart=/sbin/rpcbind -f -w


3. Create /etc/tmpfiles.d/rpcbind.conf

cat >/etc/tmpfiles.d/rpcbind.conf <<\EOF
#Type Path        Mode UID  GID  Age Argument
d     /run/rpcbind 0755 root root - -
f     /run/rpcbind/rpcbind.xdr 0600 root root - -
f     /run/rpcbind/portmap.xdr 0600 root root - -

4. Configure the services to run at startup

systemctl enable rpcbind.service
systemctl enable nfs-common

You must log in to answer this question.

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