Nfs

無法在 Alpine Linux LXC 上啟動 NFS 伺服器

  • November 27, 2017

我正在嘗試按照此處概述的說明在 Proxmox 上執行的 Alpine Linux LXC 上設置 NFS 伺服器,但rpc.statd拒絕啟動。/var/log/messages這是顯示錯誤的摘錄:

Nov 26 03:08:25 nfs daemon.notice rpc.statd[226]: Version 2.1.1 starting
Nov 26 03:08:25 nfs daemon.warn rpc.statd[226]: Flags: TI-RPC 
Nov 26 03:08:25 nfs daemon.err rpc.statd[226]: Unable to prune capability 0 from bounding set: Operation not permitted
Nov 26 03:08:25 nfs daemon.err /etc/init.d/rpc.statd[224]: start-stop-daemon: failed to start `/sbin/rpc.statd'
Nov 26 03:08:25 nfs daemon.err /etc/init.d/rpc.statd[210]: ERROR: rpc.statd failed to start
Nov 26 03:08:25 nfs daemon.err /etc/init.d/nfs[228]: ERROR: cannot start nfs as rpc.statd would not start

我已經為 LXC(在此處找到)創建了一個自定義 apparmor 配置文件,以賦予該服務足夠的執行權限,但這並沒有幫助。

事實證明,我需要CAP_SETPCAP執行 NFS 伺服器的能力。

這可以通過編輯容器的配置文件來完成/etc/pve/lxc/CTID.confCTID您的容器 ID 在哪裡),如下所示:

....
# clear cap.drop
lxc.cap.drop:

# copy drop list from /usr/share/lxc/config/common.conf
lxc.cap.drop = mac_admin mac_override sys_time sys_module sys_rawio

# copy drop list from /usr/share/lxc/config/alpine.common.conf with setpcap commented

lxc.cap.drop = audit_write
lxc.cap.drop = ipc_owner
lxc.cap.drop = mknod
# lxc.cap.drop = setpcap
lxc.cap.drop = sys_nice
lxc.cap.drop = sys_pacct
lxc.cap.drop = sys_ptrace
lxc.cap.drop = sys_rawio
lxc.cap.drop = sys_resource
lxc.cap.drop = sys_tty_config
lxc.cap.drop = syslog
lxc.cap.drop = wake_alarm

瞧!

引用自:https://unix.stackexchange.com/questions/407148