[systemd-devel] Antw: [EXT] Re: vt220 default for serial console still relevant?

Ulrich Windl Ulrich.Windl at rz.uni-regensburg.de
Tue Jul 14 07:46:02 UTC 2020


>>> Lennart Poettering <lennart at poettering.net> schrieb am 11.07.2020 um 21:04
in
Nachricht <20200711190418.GA178957 at gardel-login>:
> 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 think "ansi" was modeled after the (at those times) very popular "vt100",
and "ansi" knows about colors (even MS-DOS had an ANSI.SYS driver to support
those ESC sequences). I think "linux" is a superset of "ansi".

> 
>> 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...

I think there is an "identifying sequence" command defined (you send an ESC
sequence to the terminal, and the terminal responds with an identifier). The
"tack" utility can identify some terminals...

Regards,
Ulrich

> 
> Lennart
> 
> ‑‑
> Lennart Poettering, Berlin
> _______________________________________________
> systemd‑devel mailing list
> systemd‑devel at lists.freedesktop.org 
> https://lists.freedesktop.org/mailman/listinfo/systemd‑devel 





More information about the systemd-devel mailing list