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

Daan De Meyer daan.j.demeyer at gmail.com
Wed Jul 15 18:39:23 UTC 2020


> Well, --color means you request color no matter what, so this is not
surprising.

I actually only got color because TERM was set to xterm-256color. ls won't
output color if TERM is set to vt220. It checks against a hardcoded list of
terminals to determine whether it'll output colors or not. See
https://github.com/coreutils/coreutils/blob/6a3d2883fed853ee01079477020091068074e12d/src/dircolors.hin

> Again, I'd be happy to switch to a different default for serial
> terminals if we can find a reasonable one that is available widely in
> termcap, that does color, and is a subset of both TERM=linux and
> TERM=xterm.

So the vt220 was the first of the vt200 series and was a black and white
terminal. The vt241 was the model in that series that added colors. Problem
is that the vt241 is not in my terminfo database. The other problem is that
vt241 is not actually in ls's list of terminals that it should output
colors for so using that one is probably not a good idea. What would work
is vt100 since for some weird reason that one is in ls's list of terminals
with colors even though
https://invisible-island.net/ncurses/ncurses.faq.html#vt100_color
explicitly says the vt100 does not support colors. Switching to vt100 would
break pageup/pagedown however so that's not really an option either. I
didn't find any other alternatives that seemed viable.

I suppose I could make a coreutils PR that adds vt220 to the list of
terminals that support colors. vt100 is already in there and it doesn't
support colors so who knows maybe they'll add vt220 as well for the
pragmatic reason that systemd can't use anything else but it would still be
nice to have colors out of the box. I don't think that's likely to be
accepted though and it only fixes ls and not programs like ncurses which
adhere to whatever's in the terminfo database.

For now, the pragmatic solution for my use case (mkosi test VMs that only I
will ever use) is to simply make it easy to override TERM in the VM to
whatever TERM is in my host terminal via mkosi.

Daan




On Wed, 15 Jul 2020 at 17:09, Lennart Poettering <lennart at poettering.net>
wrote:

> On Di, 14.07.20 22:15, Daan De Meyer (daan.j.demeyer at gmail.com) wrote:
>
> > > About your other comments, systemd sits in user space and can query
> > (depend
> > > upon) terminfo.  Then, it should be able to support "whatever" terminfo
> > has
> > > defined.... which could include custom terminals by the way that an end
> > user has
> > > added.  And while all of that sounds incredibly ancient/old, I was on a
> > project
> > > post 2000 that had to do exactly that (of course, even that might sound
> > too old).
> >
> > Interestingly enough, systemd's colors work even when TERM is set to
> vt220,
> > probably because it uses ansi escape codes regardless of the TERM
> setting.
> > I think there's probably lots of applications doing this except for ls in
> > coreutils which has an explicit list of terminals with color support
> > encoded in the dircolors configuration file.  If TERM isn't one of those,
> > you don't get colors. There's probably others that do this as well. I
> don't
> > think changing the default in systemd is a good idea since it might break
> > other stuff. I'm going to submit a mkosi PR instead that adds an option
> > that overrides serial-getty at ttyS0 with whatever terminal the user wants.
> > Colors won't work out of the box but at least it shouldn't be too hard to
> > find out how to get them to work when using mkosi.
>
> Again, I'd be happy to switch to a different default for serial
> terminals if we can find a reasonable one that is available widely in
> termcap, that does color, and is a subset of both TERM=linux and
> TERM=xterm.
>
> Lennart
>
> --
> Lennart Poettering, Berlin
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/systemd-devel/attachments/20200715/07a4832c/attachment.htm>


More information about the systemd-devel mailing list