Centos – Cannot start NFS in Centos 7: Failed to issue method call: No such file or directory

centosnfs

I can't start an NFS server in CentOS7.

The packages downloaded:

yum -y install nfs-utils
yum -y install nfs-utils-lib

Enable/start services

systemctl enable/start rpcbind
systemctl enable/start nfs-server
systemctl enable/start nfs-lock
systemctl enable/start nfs-idmap

Which leads to :

systemctl enable nfs-lock
Failed to issue method call: No such file or directory
systemctl enable nfs-idmap
Failed to issue method call: No such file or directory

Created the share:

mkdir -p /test
chmod 777 /test

exported fine:

exportfs
/test           clientip/24

However, when performing systemctl restart nfs-server, it fails with dependency error, journalctl shows:

[user@server /]# journalctl -xn | grep failed
-- Subject: Unit proc-fs-nfsd.mount has failed
-- Unit proc-fs-nfsd.mount has failed.
-- The result is failed.
Jun 23 17:06:41 server systemd[1]: Dependency failed for NFS server and services.
-- Subject: Unit nfs-server.service has failed
-- Unit nfs-server.service has failed.
Jun 23 17:06:41 server systemd[1]: Dependency failed for NFS Mount Daemon.
-- Subject: Unit nfs-mountd.service has failed
-- Unit nfs-mountd.service has failed.
Jun 23 17:06:41 open

And the systemctl list-units status also show failure

systemctl list-units | grep nfs
proc-fs-nfsd.mount                      loaded failed failed    NFSD configuration filesystem
var-lib-nfs-rpc_pipefs.mount            loaded failed failed    RPC Pipe File System
nfs-config.service                      loaded active exited    Preprocess NFS configuration
nfs-idmapd.service                      loaded failed failed    NFSv4 ID-name mapping service

/var/log/messages:

Jun 23 17:06:41 server systemd: Dependency failed for RPC security service for NFS server.
Jun 23 17:06:41 server systemd: Dependency failed for RPC security service for NFS client and server.
Jun 23 17:06:41 server systemd: Unit var-lib-nfs-rpc_pipefs.mount entered failed state.
Jun 23 17:06:41 server systemd: nfs-idmapd.service: control process exited, code=exited status=1
Jun 23 17:06:41 server systemd: Unit nfs-idmapd.service entered failed state.
Jun 23 17:06:41 server systemd: proc-fs-nfsd.mount mount process exited, code=exited status=32
Jun 23 17:06:41 server systemd: Dependency failed for NFS server and services.
Jun 23 17:06:41 server systemd: Dependency failed for NFS Mount Daemon.
Jun 23 17:06:41 server systemd: Unit proc-fs-nfsd.mount entered failed state.
Jun 23 17:12:53 server mount: mount: unknown filesystem type 'nfsd'
Jun 23 17:12:53 server systemd: proc-fs-nfsd.mount mount process exited, code=exited status=32
Jun 23 17:12:53 server rpc.idmapd[842]: main: open(/var/lib/nfs/rpc_pipefs//nfs): No such file or directory
Jun 23 17:12:53 server systemd: Dependency failed for NFS server and services.
Jun 23 17:12:53 server systemd: Dependency failed for NFSv4 ID-name mapping service.
Jun 23 17:12:53 server systemd: Dependency failed for NFS Mount Daemon.
Jun 23 17:12:53 server systemd: Unit proc-fs-nfsd.mount entered failed state.

The client reports, and I assume it's normal as per the errors above:

RPC: Remote system errorRPC: Port mapper failure - RPC: Timed out.

Best Answer

I solved this problem with @user136564 's post.

This solved my issue https://www.centos.org/forums/viewtopic.php?f=47&t=53896

I found my problem was rpcbind won't start on boot even though I enabled it in systemd and I could start it manually.

These commands are what I did on CentOS Linux release 7.2.1511 (Core)

Install nfs-utils

yum install -y nfs-utils

Append text to /etc/fstab

192.168.1.100:/mnt/nfs-server /mnt/nfs-client nfs defaults,nofail,x-systemd.automount 0 0

Some articles said noauto,x-systemd.automount is better, but it worked without noauto for me.

Check whether mount works

systemctl start rpcbind
systemctl enable rpcbind
mount -a

Fix the problem CentOS 7 won't auto-mount NFS on boot

Append text to the end of /usr/lib/systemd/system/nfs-idmap.service
[Install]
WantedBy=multi-user.target
Append text to the end of /usr/lib/systemd/system/nfs-lock.service
[Install]
WantedBy=nfs.target

Enable related services

systemctl enable nfs-idmapd.service 
systemctl enable rpc-statd.service 

systemctl enable rpcbind.socket

systemctl status nfs-idmapd.service -l
systemctl status rpc-statd.service –l

Then restarted the OS, I got it.

shutdown -r now
Related Question