When connecting to the Pi by the serial console, I'd like to have the default TERM
be xterm
, rather than the current default of vt102
:
pi@raspberrypi:~$ echo $TERM
vt102
pi@raspberrypi:~$ tty
/dev/ttyS0
I know I could add this to .bashrc
, etc. - but I only want to change the current default, and to otherwise not impact other types of connections.
https://www.debian.org/releases/jessie/i386/ch05s03.html.en seems to indicate that I should be able to add TERM=xterm
to the boot parameters - which are at /boot/cmdline.txt
. As such, I tried updating the following:
dwc_otg.lpm_enable=0 console=serial0,115200 console=tty1 root=/dev/mmcblk0p2 rootfstype=ext4 elevator=deadline fsck.repair=yes rootwait
to:
dwc_otg.lpm_enable=0 console=serial0,115200 TERM=xterm console=tty1 root=/dev/mmcblk0p2 rootfstype=ext4 elevator=deadline fsck.repair=yes rootwait
... and then rebooting, but with no change. Now, http://man7.org/linux/man-pages/man7/bootparam.7.html indicates that this may be a "(useless?) example" (for reasons I don't understand).
Now, I did find /lib/systemd/system/serial-getty@.service
, which contains the following:
[Service]
ExecStart=-/sbin/agetty --keep-baud 115200,38400,9600 %I $TERM
... but I can't find where the default $TERM
is being defined.
I did add the following here:
Environment=TERM=xterm
This is working - but it seems that I'm still missing part of the puzzle here, as to where this is defaulting to vt102
, or why this can't be set in cmdline.txt
.
(Other sources I've already referenced:)
TERM=vt102
, but work withTERM=xterm
. Look at how many bashrc and such files are checking forTERM=xterm
various things... – ziesemer Aug 26 '16 at 20:21TERM=xterm
(orxterm*
with pattern matching). The question here is/was how to change the defaultTERM
environment variable for serial console connections, not whether or not it is required (please). – ziesemer Aug 26 '16 at 21:15TERM=vt102
(and not beingTERM=xterm
. Once connected to the Pi, I can send itexport TERM=xterm
to enable color support and other functionality. All this Q/A was intended for was how to have this properly set by default, respecting the considerations listed. – ziesemer Aug 27 '16 at 12:22