无法在Centos 7中启动NFS:无法发出方法调用:没有这样的文件或目录


8

我无法在CentOS7中启动NFS服务器。

下载的软件包:

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

启用/启动服务

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

这导致 :

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

创建了共享:

mkdir -p /test
chmod 777 /test

出口罚款:

exportfs
/test           clientip/24

但是,在执行systemctlrestart时nfs-server,它失败并journalctl显示依赖性错误,显示:

[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

并且systemctl列表单元状态也显示失败

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.

客户报告,并且我认为根据上述错误是正常的:

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

1
发现了可能是根本原因。服务器是openvz环境的一部分,并且正在运行“ stab”内核:Linux版本2.6.32-042stab106.4有更多经验的人可以确认它,但是我认为这是问题所在:此内核/环境的NFS功能有限。
user2575509

1
也可能与systemd有关;参见:bugzilla.redhat.com/show_bug.cgi?id=1159308
Jeff Schaller

1
这解决了我的问题centos.org/forums/viewtopic.php?f=47&t=53896希望这对您有所帮助!
user136564 2015年

Answers:


4

我用@ user136564的帖子解决了这个问题。

这解决了我的问题https://www.centos.org/forums/viewtopic.php?f=47&t=53896

我发现我的问题是,即使我在systemd中启用了rpcbind,它也不会在启动时启动,我可以手动启动它。

这些命令是我在CentOS Linux版本7.2.1511(核心)上执行的操作

安装nfs-utils

yum install -y nfs-utils

将文字附加到 /etc/fstab

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

有些文章说noauto,x-systemd.automount更好,但是noauto对我来说却没有效果。

检查安装是否正常

systemctl start rpcbind
systemctl enable rpcbind
mount -a

解决了CentOS 7在启动时不会自动挂载NFS的问题

将文本追加到/usr/lib/systemd/system/nfs-idmap.service的末尾
[Install]
WantedBy=multi-user.target
将文本追加到/usr/lib/systemd/system/nfs-lock.service的末尾
[Install]
WantedBy=nfs.target

启用相关服务

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

然后重新启动操作系统,我明白了。

shutdown -r now

1
你刚刚救了我的命。
iTayb
By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.