Ubuntu NFS: 解决 'Unit nfs-common.service is masked' 错误

在Ubuntu系统中修改 /etc/default/nfs-common 文件 (例如,设置 NEED_STAT=yesSTATDOPTS='--p 32768') 后,您可能会遇到 systemctl restart nfs-common 命令失败并显示 'Failed to restart nfs-common.service: Unit nfs-common.service is masked' 错误。

原因:

此错误意味着系统已禁用 nfs-common 服务,因为它可能使用其他机制(例如 systemd)来管理 NFS。

解决方案:

  1. 检查 NFS 服务状态:

    bash systemctl status nfs-common

    如果服务被禁用,输出将显示 'Loaded: masked'.

  2. 解除 NFS 服务的禁用状态:

    bash sudo systemctl unmask nfs-common

  3. 启动 NFS 服务:

    bash sudo systemctl start nfs-common

  4. 验证 NFS 服务状态:

    bash systemctl status nfs-common

    确保服务已成功启动并正常运行。

修改 NFS 配置:

完成上述步骤后,您可以再次尝试修改 /etc/default/nfs-common 文件。请记住,在大多数情况下,您不需要手动启动或重启 nfs-common 服务,因为 systemd 会在需要时自动处理它。

注意: 建议您查阅 Ubuntu 和 NFS 文档,以获取有关管理 NFS 服务的最佳实践和安全建议的更多信息。

Ubuntu NFS: 解决 'Unit nfs-common.service is masked' 错误

原文地址: https://www.cveoy.top/t/topic/laxq 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录