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

Daan De Meyer daan.j.demeyer at gmail.com
Sat Jul 11 19:31:17 UTC 2020


> 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 did some more research and it turns out VT220 does support colors. My
terminal emulator (Konsole) just doesn't seem to support it. I installed
xterm (which explicitly advertises support for VT220 escape codes) and got
colored output as expected.  I guess this means it's up to Konsole to
support more of VT220 if I want this to work seamlessly (or I switch
terminals to xterm).

Thanks for the extra info and context.

Daan

On Sat, 11 Jul 2020 at 20:04, Lennart Poettering <lennart at poettering.net>
wrote:

> 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
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/systemd-devel/attachments/20200711/77ac6231/attachment.htm>


More information about the systemd-devel mailing list