linux systemd 的"Where= setting doesn't match

2019-01-03 03:15发布

问题:

systemctl 启动 systemd 单元时出现下面的错误

# systemctl start aliyun-nas.mount
Failed to start aliyun-nas.mount: Unit is not loaded properly: Invalid argument.
See system logs and 'systemctl status aliyun-nas.mount' for details.

# systemctl status aliyun-nas.mount
systemd[1]: aliyun-nas.mount's Where= setting doesn't match unit name. Refusing.

请问如何解决?

回答1:

这里涉及2个问题:

  • systemd 的 unit 文件名要与 Where 中的挂载路径一致,对于 aliyun-nas.mount ,Where 中要写 Where=/aliyun/nas
  • 如果连字符作为目录名的一部分,需要进行编码,对于 aliyun-nas.mount ,unit 文件名要用 aliyun\x2dnas.mount ,Where 中要写 Where="/aliyun-nas"(注:一定要加双引号)


标签: