To enable a serial console on Linux, one uses
getty (most usually, its variant
agetty). This binary takes as argument, among other, the value to initialize the TERM variable with.
On Debian, with Sys V init, the default was vt100. With systemd, the default used to be vt102, and nowadays it's vt220.
After playing a bit with QEMU virtual machines and
virt-viewer, as well as
virsh console command, I noticed some things:
- With vt100,
ls --colordisplays colors, but
vim's syntax highlighting doesn't work
- with vt102 or vt220, neither of them displays colors
- Only with TERM variable set to linux, do both
So I guess that independently of the actual "color support", each application looks at the TERM variable and acts accordingly, which would explain the differences noted above.
After reading the Serial Console HOWTO, I understand that the value of the TERM variable should depend on the actual model of physical terminal which would be connected to the serial port, according to its capabilities.
Note that, according to Lennart Poettering's blog, TERM should be set to linux only with real virtual terminals (as opposed to serial ones). On the other hand, Arch Linux' Wiki doesn't seem to mind (see the
/etc/inittab lines it proposes).
So my questions are:
In a general case, what happens if the TERM variable is set to linux on a console connected to a less-capable terminal, like a DEC VT100, VT102 or VT220, or some RS-232 software terminal emulators like
More realistically (in my particular case), is it OK to set the TERM variable to linux in a "virtual" serial console on a QEMU VM, to which I will connect through
virsh console ?