nfs安装与配置(debian)
好吧,这个错误浪费了我今天几个小时的时间,必须把它记录下来。
问题是这样的,在启动更新了portmap,exportfs,一些没问题后,在做/etc/init.d/nfs-kernel-server restart 出现
/etc/init.d/nfs-kernel-server start
Exporting directories for NFS kernel daemonexportfs: /etc/exports [1]:
Neither 'subtree_check' or 'no_subtree_check' specified for export
"foobar".
Assuming default behaviour ('no_subtree_check').
NOTE: this default has changed since nfs-utils version 1.0.x
.
Starting NFS kernel daemon: nfsd
Not starting: portmap daemon is not running (warning).
警告提示portmap is not running
好吧,检查一下portmap
/home/mnt/index# ps aux | grep portmap
daemon 31478 0.0 0.0 2052 624 ? Ss 13:59 0:00 /sbin/portmap
portmap的状态已经是running,在googling后,发现网上有人说是
This is the problem, portmap is not actually running, causing rpc.statd
看来问题还是出现rpc上,最主要的进程rpc.mountd无法启动
好吧,接下来打开/etc/init.d/nfs-kernel-server这个启动脚本进行查看
# See if portmap or rpcbind are running
(cat </dev/null >/dev/tcp/localhost/111) 2>/dev/null
RET=$?
if [ $RET != 0 ]; then
echo
log_warning_msg "Not starting: portmap daemon is not running"
exit 0
fi
看来问题就出来这个,什么叫“/dev/tcp/localhost/111”,还是googling,网上有人说
I find that this is a bashism, but the init-script is marked as a bash script at the
top:
!/bin/bash
再man Bash,发现
Bash, as packaged for Debian, does not support using the /dev/tcp and /dev/udp files
应该很清楚了,如果按照这里的分析,那么我们需要对上面的这个启动脚本进行一下修改就可以完成我们的目的,最直接的就是把exit 0注释掉,另外说一点,这个脚本也有些写得不大合理,既然是log_warning_msg,一个warning,就不应该直接的exit 0