Discussion:
[systemd-devel] How to get systemd boot messages on serial console and screen?
Frank Steiner
2015-04-14 11:36:31 UTC
Permalink
Hi,

when adding "console=tty0 console=ttyS4,115200" as kernel parameter
on my SLES 12 systems I get all kernel messages both on the physical
screen and over the serial console.
But the systemd messages about the services started appear only on
ttyS4.

When I switch the order, i.e. tty0 after ttyS4, I still get kernel
messages on both, but the systemd messages only show up on the screen.
Gettys are always started on both consoles.

The SuSE support told me I must have plymouth installed and indeed,
when doing so, the systemd messages are printed on ttyS4 and the screen.
But plymouth causes others problems on my systems so I would like
to avoid it.

Is there a way (without plymouth) to make systemd print its boot messages
on all consoles specified in the kernel parameters? From the man pages
and googling around I'm not sure if systemd should be doing this by
default or not.

cu,
Frank
--
Dipl.-Inform. Frank Steiner Web: http://www.bio.ifi.lmu.de/~steiner/
Lehrstuhl f. Bioinformatik Mail: http://www.bio.ifi.lmu.de/~steiner/m/
LMU, Amalienstr. 17 Phone: +49 89 2180-4049
80333 Muenchen, Germany Fax: +49 89 2180-99-4049
* Rekursion kann man erst verstehen, wenn man Rekursion verstanden hat. *
Lennart Poettering
2015-04-14 15:57:02 UTC
Permalink
Post by Frank Steiner
Hi,
when adding "console=tty0 console=ttyS4,115200" as kernel parameter
on my SLES 12 systems I get all kernel messages both on the physical
screen and over the serial console.
But the systemd messages about the services started appear only on
ttyS4.
When I switch the order, i.e. tty0 after ttyS4, I still get kernel
messages on both, but the systemd messages only show up on the screen.
Gettys are always started on both consoles.
The SuSE support told me I must have plymouth installed and indeed,
when doing so, the systemd messages are printed on ttyS4 and the screen.
But plymouth causes others problems on my systems so I would like
to avoid it.
Is there a way (without plymouth) to make systemd print its boot messages
on all consoles specified in the kernel parameters? From the man pages
and googling around I'm not sure if systemd should be doing this by
default or not.
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 know the the suse folks patched around in this area of systemd,
please consider asking them for details in this areas!

Lennart
--
Lennart Poettering, Red Hat
Frank Steiner
2015-04-17 11:57:24 UTC
Permalink
Post by Lennart Poettering
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.

cu,
Frank
--
Dipl.-Inform. Frank Steiner Web: http://www.bio.ifi.lmu.de/~steiner/
Lehrstuhl f. Bioinformatik Mail: http://www.bio.ifi.lmu.de/~steiner/m/
LMU, Amalienstr. 17 Phone: +49 89 2180-4049
80333 Muenchen, Germany Fax: +49 89 2180-99-4049
* Rekursion kann man erst verstehen, wenn man Rekursion verstanden hat. *
Lennart Poettering
2015-04-17 17:26:30 UTC
Permalink
Post by Frank Steiner
Post by Lennart Poettering
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
"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
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
Loading...