每当我尝试启动 NFS 挂载时,我都会得到:
Feb 12 00:02:19 martin-xps.lico.nl rpc.statd[23582]: Version 1.3.2 starting
Feb 12 00:02:19 martin-xps.lico.nl rpc.statd[23582]: Flags: TI-RPC
Feb 12 00:02:19 martin-xps.lico.nl rpc.statd[23582]: Running as root. chown /var/lib/nfs to choose different user
Feb 12 00:02:19 martin-xps.lico.nl rpc.statd[23582]: failed to create RPC listeners, exiting
Feb 12 00:02:19 martin-xps.lico.nl systemd[1]: rpc-statd.service: control process exited, code=exited status=1
Feb 12 00:02:19 martin-xps.lico.nl systemd[1]: Failed to start NFS status monitor for NFSv2/3 locking..
Feb 12 00:02:19 martin-xps.lico.nl systemd[1]: Unit rpc-statd.service entered failed state.
Feb 12 00:02:19 martin-xps.lico.nl systemd[1]: rpc-statd.service failed.
Feb 12 00:02:19 martin-xps.lico.nl rpc.statd[23584]: Version 1.3.2 starting
Feb 12 00:02:19 martin-xps.lico.nl rpc.statd[23584]: Flags: TI-RPC
Feb 12 00:02:19 martin-xps.lico.nl rpc.statd[23584]: Running as root. chown /var/lib/nfs to choose different user
Feb 12 00:02:19 martin-xps.lico.nl rpc.statd[23584]: failed to create RPC listeners, exiting
我尝试了chown
/var/lib/nfs
,rpc
这只是给了我减去“以 root 身份运行”行的错误:
Feb 12 00:05:09 martin-xps.lico.nl rpc.statd[23773]: Version 1.3.2 starting
Feb 12 00:05:09 martin-xps.lico.nl rpc.statd[23773]: Flags: TI-RPC
Feb 12 00:05:09 martin-xps.lico.nl rpc.statd[23773]: failed to create RPC listeners, exiting
Feb 12 00:05:09 martin-xps.lico.nl systemd[1]: rpc-statd.service: control process exited, code=exited status=1
Feb 12 00:05:09 martin-xps.lico.nl systemd[1]: Failed to start NFS status monitor for NFSv2/3 locking..
Feb 12 00:05:09 martin-xps.lico.nl systemd[1]: Unit rpc-statd.service entered failed state.
Feb 12 00:05:09 martin-xps.lico.nl systemd[1]: rpc-statd.service failed.
Feb 12 00:05:09 martin-xps.lico.nl rpc.statd[23775]: Version 1.3.2 starting
Feb 12 00:05:09 martin-xps.lico.nl rpc.statd[23775]: Flags: TI-RPC
Feb 12 00:05:09 martin-xps.lico.nl rpc.statd[23775]: failed to create RPC listeners, exiting
我尝试重新安装 nfs-utils:
$ pacman -R nfs-utils
$ rm -r /var/lib/nfs
$ pacman -S nfs-utils
然后,它会在 root 用户的许可下重新创建该目录。我什至不确定这个错误是否与rpc.statd
未启动有关。
我也尝试在 shell 中运行rpc.statd -F --no-notify
,但只是以代码 1 退出。没有错误,什么也没有。联机帮助页中没有记录详细或调试标志。
我也尝试清空我的/etc/exports
,并且我的系统是最新的(pacman -Syu
)。我没有改变任何东西,它只是在几个小时前停止工作。
注意使用mount -o nolock /data
作品;所以其余的 NFS/rpc 守护进程似乎都很好。
答案1
这里同样的问题,rpc-stad
自上次更新以来失败(我的所有计算机在更新后都有问题)。
为了解决这个问题,我刚刚启用并启动了 rpcbind:
sudo systemctl enable rpcbind.service # for the next reboot
sudo systemctl start rpcbind.service
sudo systemctl restart rpcbind.service
答案2
看来 rpcbind systemd 单元文件丢失了:
$ find /usr/lib/systemd -name 'rpcbind*'
# no output
重新安装解决了这个问题:
$ pacman -S rpcbind
# [...]
$ find /usr/lib/systemd -name 'rpcbind*
/usr/lib/systemd/system/rpcbind.service
/usr/lib/systemd/system/rpcbind.target
/usr/lib/systemd/system/rpcbind.socket
$ systemctl enable rpcbind
$ systemctl start rpcbind
$ systemctl restart nfs-server
不确定这些文件是如何丢失的;也许是 FS 损坏问题?
奇怪的是,nfsd 仍在运行,但 statd 没有运行。重新启动后,nfsd 也无法工作(因为它需要rpcbind
)。就好像这些文件在系统运行时就消失了。
不幸的是,systemd
没有给出关于此类错误的明确错误消息(即依赖项rpcbind
加载失败),这将使调试更容易:-(
答案3
我遇到过一些 /var/lib/nfs 或 /var/lib/nfs/statd 丢失的情况,这会导致某些 NFS 守护进程退出并显示错误代码,但不打印任何消息。修复方法很简单,就是这样:
$ sudo mkdir -p /var/lib/nfs/statd
但有点奇怪的是,守护进程和 systemd 服务文件不会尝试创建目录或打印有关它的任何错误消息。
答案4
解决方案:
对于我的情况,这些工作:
mount.nfs4 -vvvv -o nfsvers=3 192.168.9.3:/mnt/SSD128/nfs /mnt/test
chmod +r /etc/netconfig
mount.nfs -vvvv -o nfsvers=3 192.168.9.3:/mnt/SSD128/nfs /mnt/test
我试图将 ac86u 上的 nfs 安装到 rpi4b8g(Ubuntu 20.0 4LTS),但mount -t nfs -o nfsvers=3
没有成功,但mount.nfs4 -o nfsvers=3
成功了。奇怪的是,我的另一个 rpi4b4g(Ubuntu 20.0 4LTS) 确实可以使用mount.nfs
,感谢KurtB
的回答,我找到了第二个解决方案。
不良案例:
mount.nfs4 -vvvv -o nfsvers=3 192.168.9.3:/mnt/SSD128/nfs /mnt/ssd128
一开始这也不起作用,但我在日志中看到这个错误
May 31 21:30:41 RPI4B8G systemd[1]: mnt-ssd128.mount: Unit is bound to inactive unit dev-disk-by\x2dpartlabel-SSD128.device. Stopping, too.
提醒我,我在没有卸载的情况下拔出了我的128G SSD,所以我rm /mnt/ssd128
然后mkdir /mnt/test
挂载到/mnt/test
.这两个也不起作用:
apt --reinstall install nfs-common rpcbind
mount.nfs -vvvv -o nfsvers=3 192.168.9.3:/mnt/SSD128/nfs /mnt/ssd128
最终我发现许可/etc/netconfig
被搞乱了。
ls -al /etc/netconfig
-rw------- 1 root root 767 Dec 27 2019 /etc/netconfig
-rw-r--r-- 1 root root
错误日志:
May 31 21:36:13 RPI4B8G systemd[1]: Starting Preprocess NFS configuration...
May 31 21:36:14 RPI4B8G systemd[1]: nfs-config.service: Succeeded.
May 31 21:36:14 RPI4B8G systemd[1]: Finished Preprocess NFS configuration.
May 31 21:36:14 RPI4B8G systemd[1]: Starting Notify NFS peers of a restart...
May 31 21:36:14 RPI4B8G systemd[1]: Starting NFS status monitor for NFSv2/3 locking....
May 31 21:36:14 RPI4B8G sm-notify[45518]: Version 1.3.3 starting
May 31 21:36:14 RPI4B8G sm-notify[45518]: Already notifying clients; Exiting!
May 31 21:36:14 RPI4B8G systemd[1]: rpc-statd-notify.service: Succeeded.
May 31 21:36:14 RPI4B8G systemd[1]: Started Notify NFS peers of a restart.
May 31 21:36:14 RPI4B8G rpc.statd[45520]: Version 1.3.3 starting
May 31 21:36:14 RPI4B8G rpc.statd[45520]: Flags: TI-RPC
May 31 21:36:15 RPI4B8G rpc.statd[45520]: Failed to access local netconfig database: Netconfig database not found
May 31 21:36:15 RPI4B8G rpc.statd[45520]: failed to create RPC listeners, exiting
May 31 21:36:15 RPI4B8G systemd[1]: rpc-statd.service: Control process exited, code=exited, status=1/FAILURE
May 31 21:36:15 RPI4B8G systemd[1]: rpc-statd.service: Failed with result 'exit-code'.
May 31 21:36:15 RPI4B8G systemd[1]: Failed to start NFS status monitor for NFSv2/3 locking..
May 31 21:36:15 RPI4B8G rpc.statd[45529]: Version 1.3.3 starting
May 31 21:36:15 RPI4B8G rpc.statd[45529]: Flags: TI-RPC
May 31 21:36:15 RPI4B8G rpc.statd[45529]: Failed to access local netconfig database: Netconfig database not found
May 31 21:36:15 RPI4B8G rpc.statd[45529]: failed to create RPC listeners, exiting