<div dir="ltr"><div>> <span class="gmail-im"></span>Well, --color means you request color no matter what, so this is not surprising.<span class="gmail-im"><br></span></div><div><span class="gmail-im"><br></span></div><div><span class="gmail-im">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 <a href="https://github.com/coreutils/coreutils/blob/6a3d2883fed853ee01079477020091068074e12d/src/dircolors.hin">https://github.com/coreutils/coreutils/blob/6a3d2883fed853ee01079477020091068074e12d/src/dircolors.hin</a></span></div><div><br></div><div>> Again, I'd be happy to switch to a different default for serial</div>> terminals if we can find a reasonable one that is available widely in<br>> termcap, that does color, and is a subset of both TERM=linux and<br><div>> TERM=xterm.</div><div><br></div><div>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 <a href="https://invisible-island.net/ncurses/ncurses.faq.html#vt100_color">https://invisible-island.net/ncurses/ncurses.faq.html#vt100_color</a> 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.</div><div><br></div><div>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.</div><div><br></div><div>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.<br></div><div><br></div><div>Daan<br></div><br><div><br></div><div><br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Wed, 15 Jul 2020 at 17:09, Lennart Poettering <<a href="mailto:lennart@poettering.net">lennart@poettering.net</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">On Di, 14.07.20 22:15, Daan De Meyer (<a href="mailto:daan.j.demeyer@gmail.com" target="_blank">daan.j.demeyer@gmail.com</a>) wrote:<br>
<br>
> > About your other comments, systemd sits in user space and can query<br>
> (depend<br>
> > upon) terminfo. Then, it should be able to support "whatever" terminfo<br>
> has<br>
> > defined.... which could include custom terminals by the way that an end<br>
> user has<br>
> > added. And while all of that sounds incredibly ancient/old, I was on a<br>
> project<br>
> > post 2000 that had to do exactly that (of course, even that might sound<br>
> too old).<br>
><br>
> Interestingly enough, systemd's colors work even when TERM is set to vt220,<br>
> probably because it uses ansi escape codes regardless of the TERM setting.<br>
> I think there's probably lots of applications doing this except for ls in<br>
> coreutils which has an explicit list of terminals with color support<br>
> encoded in the dircolors configuration file. If TERM isn't one of those,<br>
> you don't get colors. There's probably others that do this as well. I don't<br>
> think changing the default in systemd is a good idea since it might break<br>
> other stuff. I'm going to submit a mkosi PR instead that adds an option<br>
> that overrides serial-getty@ttyS0 with whatever terminal the user wants.<br>
> Colors won't work out of the box but at least it shouldn't be too hard to<br>
> find out how to get them to work when using mkosi.<br>
<br>
Again, I'd be happy to switch to a different default for serial<br>
terminals if we can find a reasonable one that is available widely in<br>
termcap, that does color, and is a subset of both TERM=linux and<br>
TERM=xterm.<br>
<br>
Lennart<br>
<br>
--<br>
Lennart Poettering, Berlin<br>
</blockquote></div>