rpcbind not started at boot on centos 7 with systemd

13,383

I've got the same problem on Debian 8 aka Jessie and, although systems are different, this solution could help, if you don't mind to alter configuration files.

Create file /etc/tmpfiles.d/rpcbind.conf:

#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 - -

Create /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

and enabled above unit:

# systemctl enable rpcbind.service

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

[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

Enable it with:

# systemctl enable nfs-common

Presumably, that should do the trick for CentOS as well.

It also looks like there is a newer version of rpcbind-0.2.3, which has native systemd support, but haven't try it...

Share:
13,383

Related videos on Youtube

Jan
Author by

Jan

Updated on September 18, 2022

Comments

  • Jan
    Jan over 1 year

    I need rpcbind service to be active after boot, so I installed it with yum, then started it by:

    systemctl start rpcbind
    

    it works. However after reboot it did not start. So I checked it with:

    systemctl is-enabled rpcbind
    

    and it showed: static which mean that some other service need it to boot, the service is rpcbind.socket, so I checked it and the rpcbind.socked showed that it is enabled (systemctl is-enabled rpcbind.socket returned enabled) but it does not work how it should

    after boot when i execute:

    systemctl status rpcbind
    

    it show: failed (dead)

    I have been searching for a while now this but without any luck, if anybody know a solution to this or faced this problem in the past then please help.

    I'm using centos 7.1

    if you need more information i can get it when i get to work tomorow

    • Admin
      Admin over 8 years
      What version of rpcbind are you using?
    • Admin
      Admin over 8 years
      Does disabling selinux temporality do anything different?
    • Admin
      Admin over 8 years
      You can garner some info on why it is failing by running journalctl -xn. If that is not enlightening (in my experience, hardly ever) you may: 1. search for error messages in /var/log: grep -nrI rpcbind. This will produce much output, you will have to wade thru it. 2. Start rcpbind by hand, rpcbind -dw, and study its output.
    • Admin
      Admin over 8 years
      Although I had a same problem but got an another error message, I solved here; unix.stackexchange.com/a/256232/152138 Hope this helps you.