Chr*_*rts 32 permissions systemd systemctl journalctl ubuntu-16.04
我在 Ubuntu 16.04 LTS 中运行用户级服务。例如,我的 test.service 位于~/.config/systemd/user/test.service
.
我能够通过这样做来运行服务
systemctl --user start test.target
Run Code Online (Sandbox Code Playgroud)
但是,当我尝试使用 读取其日志时journalctl
,收到以下错误消息:
journalctl --user -u test.service
Hint: You are currently not seeing messages from other users and the system.
Users in the 'systemd-journal' group can see all messages. Pass -q to
turn off this notice.
No journal files were opened due to insufficient permissions.
Run Code Online (Sandbox Code Playgroud)
如何journalctl
用于用户的特定单位?
小智 21
在较旧的 systemd 版本上,您必须使用journalctl --user --user-unit=SERVICENAME
(在较新的版本上journalctl --user -u SERVICENAME
可以正常工作)。
但是,这仅在Storage
of[Journal]
部分的指令/etc/systemd/journald.conf
设置为persistent
(而不是auto
or volatile
)时才有效。编辑完配置文件后重启,用户就可以看到日志了。
更多信息:https : //www.freedesktop.org/software/systemd/man/journald.conf.html https://lists.freedesktop.org/archives/systemd-devel/2016-October/037554.html