Linux 将systemd脚本输出重定向到控制台

Linux 将systemd脚本输出重定向到控制台,linux,embedded-linux,systemd,Linux,Embedded Linux,Systemd,如何将systemd ExecStart脚本运行的脚本输出重定向到引导控制台 我需要调试脚本的错误,直到引导,但我不能使用journalctl,因为它是带有ROM rootfs的嵌入式linux 现在,我的.service文件如下所示: [Unit] Description=Init script After=network.target Before=getty@tty1.service [Service] Type=oneshot ExecStart=/usr/lib/systemd/te

如何将systemd ExecStart脚本运行的脚本输出重定向到引导控制台

我需要调试脚本的错误,直到引导,但我不能使用journalctl,因为它是带有ROM rootfs的嵌入式linux

现在,我的.service文件如下所示:

[Unit]
Description=Init script
After=network.target
Before=getty@tty1.service

[Service]
Type=oneshot
ExecStart=/usr/lib/systemd/test_init_script
ExecStartPre=/usr/bin/echo -e \033%G
ExecReload=/bin/kill -HUP $MAINPID
WorkingDirectory=/
Enviroment=TERM=xterm

[Install]
WantedBy=multi-user.target
测试初始化脚本:

#!/bin/sh -
echo "Test!"
但它不起作用,启动后我收到消息:

#systemctl status test_init_script.service
test_init_script.service - Init script
 Loaded: loaded (/usr/lib/systemd/test_init_script.service)
 Active: failed (Result: exit-code) Since Thu 1970-01-01 08:26:03 CST; 19s ago
Process: 170 ExecStartOre=/usr/bin/echo -e -G (code=exited, status=203/EXEC)

有人知道如何将脚本输出重定向到终端吗?

好的,所以我通过使用更改的文件构建图像来解决这个问题:

/etc/journald.conf
其中,我将存储选项更改为volatile:

Storage=volatile
此选项意味着所有日志数据都将存储在RAM中,因此这是只读文件系统的一种解决方法

请参阅日志手册页查看更多选项。

您看到了吗?