[systemd-devel] How to get systemd boot messages on serial console and screen?
Lennart Poettering
lennart at poettering.net
Fri Apr 17 10:26:30 PDT 2015
On Fri, 17.04.15 13:57, Frank Steiner (fsteiner-mail1 at bio.ifi.lmu.de) wrote:
> Lennart Poettering wrote
>
> > We write the status output to /dev/console, see status_vprintf():
> >
> > http://cgit.freedesktop.org/systemd/systemd/tree/src/shared/terminal-util.c#n643
> >
> > Usually the kernel will forward what is written to /dev/console to all
> > console= terminals listed on the kernel cmdline.
> >
> > Check the contents of /sys/class/tty/console/active to see which
> > ttys those currently are.
>
> I can see both (tty0 and ttyS4) there, but as far as I understand from
> reading the documentation /dev/console is always only connected to the
> last-specified console. Thus writing to /dev/console will only print
> to one console. See kernel/Documentation/serial-console.txt:
>
> "You can specify multiple console= options on the kernel command line.
> Output will appear on all of them. The last device will be used when
> you open /dev/console. So, for example:
>
> console=ttyS1,9600 console=tty0
>
> defines that opening /dev/console will get you the current foreground
> virtual console, and kernel messages will appear on both the VGA
> console and the 2nd serial port (ttyS1 or COM2) at 9600 baud."
>
> That would exactly match what I see, i.e., kernel messages on both
> ttys, systemd always only on the last one.
>
> I'm not sure how one can write to all consoles in parallel from user
> space, I think in SLES 11 blogd was used for this. It would be nice
> if systemd could print to all consoles without helper programs like
> plymouth etc.
Ah, sorry, yeah I was confused a bit. Indeed, /dev/console actually
will give you only the primary console tty.
The kernel's own logs will show up on all configured consoles
however. This is implemented in the kernel's kmsg subsystem which
pushes the kernel logs to all consoles. You can test this by echoing
something into /dev/kmsg, it should end up on all consoles as well as
the kernel log buffer.
However /dev/kmsg is not a tty, hence not really suitable for the
status output we do or even running a getty on...
Lennart
--
Lennart Poettering, Red Hat
More information about the systemd-devel
mailing list