Fedora

如何在 Fedora 17 上掛載 NFS 3 卷?

  • April 17, 2019

我安裝了軟體包nfs-utils並通過以下方式進行了嘗試:

# mount -t nfs server:/mnt /mnt
mount.nfs: rpc.statd is not running but is required for remote locking.
mount.nfs: Either use '-o nolock' to keep locks local, or start statd.
mount.nfs: an incorrect mount option was specified

好的,可能需要通過 systemd 啟動它,對嗎?

# systemctl start nfs-lock.service 
Job failed. See system journal and 'systemctl status' for details.
# journalctl
Jun 15 23:22:18 host rpc.statd[24339]: Version 1.2.6 starting
Jun 15 23:22:18 host rpc.statd[24339]: Opening /var/run/rpc.statd.pid failed:
                                        Permission denied
[..]
Jun 15 23:22:18 host systemd[1]: nfs-lock.service: control process exited, 
                                        code=exited status=1
Jun 15 23:22:18 host systemd[1]: Unit nfs-lock.service entered failed state.

看起來像 SELinux 相關的問題?

Jun 15 23:22:18 host setroubleshoot[3211]: analyze_avc()
  avc=scontext=system_u:system_r:rpcd_t:s0
  tcontext=unconfined_u:object_r:var_run_t:s0
  access=['unlink'] tclass=file tpath=rpc.statd.pid
Jun 15 23:22:18 host setroubleshoot[3211]: SELinux is preventing
  /usr/sbin/rpc.statd from unlink access on the file rpc.statd.pid.
Jun 15 23:22:18 host setroubleshoot[3211]: analyze_avc()
  avc=scontext=system_u:system_r:rpcd_t:s0
  tcontext=unconfined_u:object_r:var_run_t:s0
  access=['write'] tclass=file tpath=rpc.statd.pid
Jun 15 23:22:18 host setroubleshoot[3211]: SELinux is preventing
  /usr/sbin/rpc.statd from write access on the file rpc.statd.pid.

好的 - 現在的問題是:我必須更改什麼 SELinux 配置或什麼文件標籤?

# systemctl status nfs-lock.service
nfs-lock.service - NFS file locking service.
     Loaded: loaded (/usr/lib/systemd/system/nfs-lock.service; enabled)
     Active: failed (Result: exit-code) since Fri, 15 Jun 2012 23:22:18 +0200;
             13min ago
    Process: 24338 ExecStart=/sbin/rpc.statd $STATDARG
             (code=exited, status=1/FAILURE)
    Process: 24334 ExecStartPre=/usr/lib/nfs-utils/scripts/nfs-lock.preconfig
             (code=exited, status=0/SUCCESS)
     CGroup: name=systemd:/system/nfs-lock.service

是否缺少包裹 - 還是我使用了錯誤的服務?

不確定這是否會有所幫助,因為我沒有看到任何 SElinux 錯誤。

安裝 Fedora 17 後,我升級到最新版本但沒有重新啟動。由於幾個 gnome 軟體包的更新,我確實註銷並重新登錄。(我沒有註意到更新也包括更新systemd。)

為了掛載我安裝的 NFS 共享nfs-utils並嘗試啟動 rpcbind 服務:

sudo systemctl start rpcbind.service

我收到以下錯誤:

Failed to issue method call: Unit var-run.mount failed to load: No such file or directory. See system logs and 'systemctl status var-run.mount' for details.

var-run.mount 最近似乎已被刪除yum whatprovides,顯示systemd-44-8.fc17仍有它。

其他幾個 NFS 服務也拋出了同樣的錯誤。

就我而言,只需重新啟動即可。因此,您可能需要更新到最新的軟體包並重新啟動。(如果有人知道如何讓 systemd 在不重新啟動的情況下重新讀取它的配置,請告訴我。)

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