Systemd 文档指出每个用户单元可以添加到多个位置:请参阅手册页上的表 2:
https://www.freedesktop.org/software/systemd/man/systemd.unit.html
例如,其中包括~/.config/systemd/user
。
但是,在我的 Ubuntu 18.04 机器上,systemd 似乎没有在那里查找,只在部分位置查找(...因为strace
在尝试启动我的服务时显然使用了 systemd 进程):
openat(AT_FDCWD, "/run/user/1000/systemd/system.control/parsec.service", O_RDONLY|O_NOCTTY|O_NOFOLLOW|O_CLOEXEC) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/run/user/1000/systemd/transient/parsec.service", O_RDONLY|O_NOCTTY|O_NOFOLLOW|O_CLOEXEC) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/etc/systemd/user/parsec.service", O_RDONLY|O_NOCTTY|O_NOFOLLOW|O_CLOEXEC) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/usr/lib/systemd/user/parsec.service", O_RDONLY|O_NOCTTY|O_NOFOLLOW|O_CLOEXEC) = -1 ENOENT (No such file or directory)
为什么?另外,我怎样才能让它从用户可写位置拾取单元?