我为我们的foo服务组装了一个foo.service文件,作为守护进程运行.当我运行systemctl start foo(和stop)但
systemtcl enable foo结果时,服务运行正常Failed to issue method call: Invalid argument.单元文件放在/etc/systemd/system/foo.service,并具有权限0755.将systemd设置为debug并运行enable give
Looking for unit files in (highest priority first):`
/etc/systemd/system
/run/systemd/system
/usr/local/lib/systemd/system
/usr/lib/systemd/system
Looking for SysV init scripts in:
/etc/rc.d/init.d
Looking for SysV rcN.d links in:
/etc/rd.c
Failed to issue method call: Invalid argument
Run Code Online (Sandbox Code Playgroud)
谷歌搜索似乎没有找到.service文件.有什么方法可以验证吗?如果是这样,我该如何解决?关于可能出错的其他任何想法?我可以启用更多调试吗?给出的调试信息并没有真正帮助我缩小问题的范围.
foo.service看起来像:
[Unit]
Description=Blah Blah Blah
[Service]
ExecStart=/usr/bar/doof/foo
Type=simple
PIDFile=/var/run/foo.pid
[Install]
WantedBy=multi-user.target,graphical.target
Run Code Online (Sandbox Code Playgroud)
编辑:是的,我确实跑了systemctl daemon-reload.
小智 26
我通过谷歌发现了这个问题,搜索“systemctl unit not found”
就我而言,我通过 podman 生成了一个 *.service 文件,无论我做什么,systemctl 都找不到该服务文件。
解决方案是检查 selinux 并设置正确的标签。例子:
/sbin/restorecon -v /etc/systemd/system/container_httpd.service
Run Code Online (Sandbox Code Playgroud)
Mar*_*ark 16
对于谷歌的人:
sudo systemd-analyze verify NAME.service/etc/systemd/system/*.servicesudo systemctl daemon-reload改变后做确保如果您将单元放入.config/systemd/user/*.service您运行命令的用户文件夹中
systemd --user <command>
Run Code Online (Sandbox Code Playgroud)
(注意--user)
就我而言,问题是文件是从另一个分区进行符号链接的,而systemd不支持该链接。
Unit files have to reside on a partition that is mounted at the moment the host PID 1 is invoked. i.e. either on the root partition or some other partition that the initrd premounts.
我正在回答一个老问题,因为这是在搜索该问题时的最佳结果,可能会帮助某人
| 归档时间: |
|
| 查看次数: |
23792 次 |
| 最近记录: |