Command wraps around same line after 80 characters
Solution 1
This worked for me. The target shell needs to be set to check window size and to be set to the correct size of your console gui. After connecting via serial with either putty or minicom:
shopt -s checkwinsize
resize
Solution 2
When you are connected via a serial line, there is no way for the system to negotiate the window size with the terminal (NAWS - Negotiate About Window Size is RFC 1073). In that case you can get either a system default for the size, or even just zeros. Either would confuse the shell's line editor, which needs to know the actual width of the terminal to work with its wraparound feature.
bash gets confused, thinking it has wrapped due to terminal's autowrap feature and moves to the beginning of the current (wrong) line as part of the line-editing/display.
As a workaround, most of the terminals (including minicom — see source) which you would use with a serial interface can respond to the cursor position report escape sequence used by resize
to find the window size — and as a side effect set the system's idea of how large your terminal window is.
Related videos on Youtube
Oliver G.
Updated on September 18, 2022Comments
-
Oliver G. almost 2 years
I have an annoying problem with minicom connected to a serial console to a Yocto Linux machine.
The command that I enter wraps around on the same line after 80th character. This becomes very inconvenient to work with. Everything I entered at the beginning of the line gets overwritten by the last chars of that line.
A SSH connection to the same machine works just fine. After 80th characters ssh go to the next line.
This is the stty setting:
stty -a speed 115200 baud; rows 24; columns 80; line = 0; intr = ^C; quit = ^\; erase = ^?; kill = ^U; eof = ^D; eol = <undef>; eol2 = <undef>; swtch = <undef>; start = ^Q; stop = ^S; susp = ^Z; rprnt = ^R; werase = ^W; lnext = ^V; flush = ^O; min = 1; time = 0; -parenb -parodd cs8 hupcl -cstopb cread clocal -crtscts -ignbrk -brkint -ignpar -parmrk -inpck -istrip -inlcr -igncr icrnl ixon ixoff -iuclc -ixany -imaxbel iutf8 opost -olcuc -ocrnl onlcr -onocr -onlret -ofill -ofdel nl0 cr0 tab0 bs0 vt0 ff0 isig icanon -iexten echo echoe echok -echonl -noflsh -xcase -tostop -echoprt echoctl echoke
The -w option of minicom has no effect. Still the same behavior
minicom -w
The
resize
command is not available on that machine. To which package does it belong? Maybe I can install it.How can I fix that behavior?
-
Oliver G. over 7 yearsecho $TERM xterm
-
Arkadiusz Drabczyk over 7 yearsshow output of
stty -a
executed insideminicom
-
Arkadiusz Drabczyk over 7 yearsDoes running
minicom
with-w
help? -
Oliver G. over 7 yearsIf I use
putty
instead ofminicom
as serial terminal program and enable the terminal setting "implicit LF in every CR" the behavior is gone. -
Oliver G. over 7 yearsStart
minicom
CTRL-A
then pressZ
In the menu: Add a linefeed:A
so pressA
-
stigskov about 6 yearsMaybe 'B' option is what you need (scroll Back)? CTRL A Z B
-
-
dirkt over 7 yearsI'd still be curious why it wraps around on the same line, instead of into the next line.
-
TheMeaningfulEngineer over 5 yearsThis seems to have worked for me but am not clear how this was done or how to apply it as a general rule.
-
Mark Inderhees over 5 yearsAdd this to your .bashrc on the target: "shopt -s checkwinsize" and "eval `
resize
`" -
mhck over 2 yearsIt can be run as one command for simplicity:
shopt -s checkwinsize;resize