调试 systemd-tmpfiles-setup.service

调试 systemd-tmpfiles-setup.service

我很难得到临时文件配置文件在 下创建一个目录/run。如果我运行,systemd-tmpfiles --create则会创建该目录,但重启后它就不存在了。

因此,为了弄清楚发生了什么,我想在运行时打开调试systemd-tmpfiles-setup.service。所以我添加了一个文件来设置SYSTEMD_LOG_LEVEL服务上的环境变量。(我看到这是redhat 文档

# /etc/systemd/system/systemd-tmpfiles-setup.service.d/override.conf
[Service]
Environment=SYSTEMD_LOG_LEVEL=debug

重新启动...日志中没有任何内容。

如果我手动运行它,那么我会得到调试输出:

SYSTEMD_LOG_LEVEL=debug systemd-tmpfiles --create 
Looking for configuration files in (higher priority first):
    /etc/tmpfiles.d
    /run/tmpfiles.d
    /usr/local/lib/tmpfiles.d
    /usr/lib/tmpfiles.d
    /lib/tmpfiles.d
Skipping overridden file '/usr/lib/tmpfiles.d/screen-cleanup.conf'.
Reading config file "/etc/tmpfiles.d/bpm-vnc.conf"…
Reading config file "/usr/lib/tmpfiles.d/colord.conf"…
Reading config file "/usr/lib/tmpfiles.d/cryptsetup.conf"…
<snip lots of debug logs>

但是如果我手动运行它并通过管道传输输出,我将得不到调试日志:

# SYSTEMD_LOG_LEVEL=debug systemd-tmpfiles --create 2>&1 | tee
<No output>

似乎它可能正在检测输出是否是 tty,如果不是 tty,则关闭调试日志记录。

知道如何在作为服务运行时从 systemd-tmpfiles 获取调试日志吗?

....

相关内容