That might not have been as clear on (e-)paper as it sounded in my head. I've added a serial device to a Debian VM and configured the VM to use it as a terminal via serial-getty. I'm able to interact with the VM via the web-based xterm.js, so that's all working.
However, I"m not quite getting the output I want. The Debian defaults appear to be enforcing a strict 80 column width (I used nano to figure out how many characters wide my display was). I've attached a picture below.
Is there something I can modify in the .service file for the ttyS0-based serial-getty service to overcome this? I see that I can do things like tell it what sort of terminal to emulate, but I'm too unfamiliar with terminal standards to know what to do with that, and googling has been challenging as once you start googling terminal standards everyone seems to think you have an actual VT100 in your bedroom and want to make it do stuff.
![1721938170989.png 1721938170989.png](https://forum.proxmox.com/data/attachments/71/71562-9b44cf3f84c0ea97d89d73e3a6c577ae.jpg)
EDIT: I still need to test it, but it looks like getting this into your bashrc is the answer.
See: https://unix.stackexchange.com/questions/16578/resizable-serial-console-window/680244#680244
EDIT 2: There was a typo in that last IF statement. It needed double-brackets for some reason.
EDIT 3: I can confirm that when added to /etc/bashrc.bash (the global .bashrc), the code below fixes the issue.
Of course, this doesn't do anything for the lack of color vs. an SSH terminal or the standard NoVNC interface, but that's not really an issue so much as a lack of tweaking on my end.
However, I"m not quite getting the output I want. The Debian defaults appear to be enforcing a strict 80 column width (I used nano to figure out how many characters wide my display was). I've attached a picture below.
Is there something I can modify in the .service file for the ttyS0-based serial-getty service to overcome this? I see that I can do things like tell it what sort of terminal to emulate, but I'm too unfamiliar with terminal standards to know what to do with that, and googling has been challenging as once you start googling terminal standards everyone seems to think you have an actual VT100 in your bedroom and want to make it do stuff.
![1721938170989.png 1721938170989.png](https://forum.proxmox.com/data/attachments/71/71562-9b44cf3f84c0ea97d89d73e3a6c577ae.jpg)
EDIT: I still need to test it, but it looks like getting this into your bashrc is the answer.
See: https://unix.stackexchange.com/questions/16578/resizable-serial-console-window/680244#680244
EDIT 2: There was a typo in that last IF statement. It needed double-brackets for some reason.
EDIT 3: I can confirm that when added to /etc/bashrc.bash (the global .bashrc), the code below fixes the issue.
Of course, this doesn't do anything for the lack of color vs. an SSH terminal or the standard NoVNC interface, but that's not really an issue so much as a lack of tweaking on my end.
Bash:
# resize function for connected serial console
resize() {
old=$(stty -g)
stty raw -echo min 0 time 5
printf '\0337\033[r\033[999;999H\033[6n\0338' > /dev/tty
IFS='[;R' read -r _ rows cols _ < /dev/tty
stty "$old"
#echo "cols:$cols"
#echo "rows:$rows"
stty cols "$cols" rows "$rows"
}
ALL_COMMANDS_FINISHED=1
PreCommands() {
if [ "$ALL_COMMANDS_FINISHED" = '1' ]; then
ALL_COMMANDS_FINISHED=0
resize
#echo "1->0"
fi
}
PostCommands() {
ALL_COMMANDS_FINISHED=1
}
# if login thru tty*
if [[ $(tty) = /dev/tty* ]]; then
# PreCommands is called before every single command on a command line
trap PreCommands DEBUG
# PostCommands is called after all commands on a command line are finished
PROMPT_COMMAND="PostCommands"
fi
Last edited: