nfs安裝與配置(debian)
好吧,這個錯誤浪費了我今天幾個小時的時間,必須把它記錄下來。
問題是這樣的,在啟動更新了portmap,exportfs,一些沒問題后,在做/etc/init.d/nfs-kernel-server restart 出現
/etc/init.d/nfs-kernel-server start
Exporting directories for NFS kernel daemon
exportfs: /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).
Exporting directories for NFS kernel daemon

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