systemd 启动后,ubuntu 云镜像实例如何持续写入控制台?

systemd 启动后,ubuntu 云镜像实例如何持续写入控制台?

我正在为 ubuntu 创建云图像,试图弄清楚它在云中运行时如何将所有信息写入串行控制台。

我用的是这个图片: https://cloud-images.ubuntu.com/xenial/current/xenial-server-cloudimg-amd64-disk1.img

当我尝试在我的图像上重新创建该行为时,它会在 journald 启动后停止写入

[   11.192345] systemd[1]: Starting Create list of required static device nodes for the current kernel...
[   11.362003] systemd[1]: Mounted RPC Pipe File System.
[   11.461612] systemd[1]: Mounted POSIX Message Queue File System.
[   11.555519] systemd[1]: Mounted Huge Pages File System.
[   11.649353] systemd[1]: Mounted Debug File System.
[   11.743620] systemd[1]: Started Journal Service.
^[[r^[[H^[[2J

Ubuntu 16.04.1 LTS euca-10-254-38-28 ttyS0

euca-10-254-38-28 login: Ubuntu 16.04.1 LTS euca-10-254-38-28 ttyS0

我想要类似这样的东西:

[    3.469429] systemd[1]: Started Nameserver information manager.
[^[[0;32m  OK  ^[[0m] Started Nameserver information manager.
[    3.475530] iscsi: registered transport (tcp)
[    3.492282] systemd[1]: Started Journal Service.
[^[[0;32m  OK  ^[[0m] Started Journal Service.
[    3.511329] iscsi: registered transport (iser)
[^[[0;32m  OK  ^[[0m] Started LVM2 metadata daemon.
         Starting Create Static Device Nodes in /dev...
         Starting Load/Save Random Seed...
         Starting Flush Journal to Persistent Storage...
         Starting udev Coldplug all Devices...
[^[[0;32m  OK  ^[[0m] Started Set console keymap.
[^[[0;32m  OK  ^[[0m] Started Load Kernel Modules.
[^[[0;32m  OK  ^[[0m] Started Load/Save Random Seed.
[^[[0;32m  OK  ^[[0m] Started Create Static Device Nodes in /dev.

我在 grub 中添加了“console=tty0 console=ttyS0”。我以为这在 /etc/systemd/journald.conf 中已经更改,但那里的一切都还是默认的。

答案1

我认为一旦systemd启动,它会将输出发送到journal而不是tty。在 中/etc/systemd/system.conf,尝试设置DefaultStandardOutput=journal+consoletty。重新启动以进行测试。

man systemd.directives您可以通过从 开始并查找指令来获取任何 systemd 指令的文档。

相关内容