[systemd-devel] vt220 default for serial console still relevant?

Lennart Poettering lennart at poettering.net
Sat Jul 11 19:04:18 UTC 2020


On Sa, 11.07.20 17:51, Daan De Meyer (daan.j.demeyer at gmail.com) wrote:

> Hi,
>
> I was playing around with mkosi's qemu support, more specifically adding
> the -nographic option to have the virtual machine output in my terminal
> instead of a separate window. After figuring out that I had to add
> console=ttyS0 to mkosi's kernel command line, I got the output from the vm
> in my terminal as expected. However, because systemd defaults to TERM=vt220
> for serial consoles, the output is not colorized. I searched around a bit
> and found that this is done for compatibility reasons. Will there ever be a
> point where we can switch the default to something that supports colors
> (like TERM=linux)?

TERM=linux means Linux console, but that's just too much, as it not
only implies a multitude of ESC sequences specific to the Linux
console, but also indicates that certain ioctls might work. In our own
code we also bind certain behaviour to TERM=linux, as indicator if we
are on the Linux console.

I am not aware of any widely-supported TERM value that would be a
reasonable subset of all currently used terminals and does color.

> I managed to get around the problem by overriding serial-getty at ttyS0 and
> setting Environment=TERM=linux explicitly but it's a bit of a pain and has
> to be added to every rootfs that wants to support colored output on its
> serial console.

Unfortunately we can't guess the right terminal, we cannot propagate
TERM=xterm or TERM=linux depending if you invoke qemu on an xterm or
from a Linux console, hence the best thing we can do is stick to a
reasonably powerful subset that is likely going to exist everywhere,
and that's vt220 right now, as noone had a better suggestion so far...

Lennart

--
Lennart Poettering, Berlin


More information about the systemd-devel mailing list