You are not logged in.
For complicated reasons, I'm ssh'ing from my Mac (Terminal.app) into an Arch Linux box, where I need to run ckermit or screen over USB to have a console on a second Linux box.
This works, but somewhere in between information about terminal size and and some other things get lost, so I cannot really run an interactive editor such as vi on the second Linux box: the display is completely misformatted, making editing impossible. E.g. "vi foo" shows:
line 1
line 2
line 3I assume this can be made to work somehow, and I'm hoping to learn how.
All three (Mac, Linux 1, Linux 2) have "export TERM=vt100". I run screen as "screen /dev/ttyUSB0 115200". Everything is fine between the Mac and the first Linux box.
Offline
All three (Mac, Linux 1, Linux 2) have "export TERM=vt100".
You shouldn't be exporting TERM anywhere, it's known to cause issues.
Offline
You shouldn't be exporting TERM anywhere, it's known to cause issues.
Without, the Mac and first Linux box have TERM=vt100 and the second Linux box has TERM=vt220. I figured that could cause problems. But setting all of them to vt100 or vt220 causes no change in behavior. (As I write this, I realize that I might not understand how $TERM actually works.)
Offline
But setting all of them to vt100 or vt220 causes no change in behavior.
He said don't set them at all. Get rid of any "TERM=..." anywhere in any of your shellrc or related files. That should only be set by the terminal itself, and ideally would be a read-only setting, but environment variables can't be made read-only. When you change the setting of TERM, you are interrupting normal communication channels and effectively lying to client programs - so it's no surprise if they don't work right.
Last edited by Trilby (2017-10-04 19:24:25)
"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman
Offline
I have restarted everything without any manual settings of TERM, also checked "grep TERM ~/.??*". No change in behavior.
My guess would be that the $TERM info does not make it across the serial/USB/screen connection? Or do I need to do something with stty?
On the Mac "stty -a" says:
speed 9600 baud; 35 rows; 155 columns;
lflags: icanon isig iexten echo echoe -echok echoke -echonl echoctl
-echoprt -altwerase -noflsh -tostop -flusho pendin -nokerninfo
-extproc
iflags: -istrip icrnl -inlcr -igncr ixon -ixoff ixany imaxbel iutf8
-ignbrk brkint -inpck -ignpar -parmrk
oflags: opost onlcr -oxtabs -onocr -onlret
cflags: cread cs8 -parenb -parodd hupcl -clocal -cstopb -crtscts -dsrflow
-dtrflow -mdmbuf
cchars: discard = ^O; dsusp = ^Y; eof = ^D; eol = <undef>;
eol2 = <undef>; erase = ^?; intr = ^C; kill = ^U; lnext = ^V;
min = 1; quit = ^\; reprint = ^R; start = ^Q; status = ^T;
stop = ^S; susp = ^Z; time = 0; werase = ^W;On Linux 1:
speed 9600 baud; rows 35; columns 155; line = 0;
intr = ^C; quit = ^\; erase = ^?; kill = ^U; eof = ^D; eol = M-^?; eol2 = M-^?; swtch = <undef>; start = ^Q; stop = ^S; susp = ^Z; rprnt = ^R; werase = ^W;
lnext = ^V; discard = ^O; min = 1; time = 0;
-parenb -parodd -cmspar 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 -flusho -extprocOn Linux 2:
speed 0 baud; rows 0; columns 0; 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; discard = ^O; min = 1; time = 0;
-parenb -parodd -cmspar cs5 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 -flusho -extprocI do not know what all these things mean, but there clearly are differences, like "cs5" vs "cs8" (which apparently means character size). Unfortunately "stty cs8" on Linux 2 says "stty: 'standard input': unable to perform all requested operations" -- whatever that means.
BTW, what does "M-^?" mean? I tried to set it, but it says I need an integer argument.
Offline
My guess is that screen is messing up the TERM variable (again)
https://bbs.archlinux.org/viewtopic.php?id=230308
echo $TERMOffline
My guess is that screen is messing up the TERM variable (again)
Given the above values for $TERM, what would you suggest I should try?
Offline
This is only a problem when using screen.
First check the actual values of $TERM
If it's vt100 (and you really don't cause this by exporting the value somewhere), run "toe | grep Terminal.app" and pick one that looks reasonable. Export that and see what happens.
Offline
Here's what I did. On the Mac:
$ toe | grep Terminal.app
nsterm AppKit Terminal.app
nsterm+7 AppKit Terminal.app v41+ basic capabilities w/ASCII charset
...and lots of variations. On the Mac:
export TERM=nstermThen I ssh into Linux box 1, and see that $TERM=nsterm. So far so good.
Now I do my "screen /dev/ttyUSB0" and on Linux box 2, I'm back at "TERM=vt220" so it did not propagate. Now I tried both leaving this value, and setting it to nsterm, but in both cases, I get the same corrupted vi output as always. I tried some other values for TERM, but same behavior.
Offline
Just noticed that vim works, but vi still does not -- both regardless of various values of $TERM in various places.
So my immediate problem (editing remote files) seems to be solved.... but I'd still like to know how to solve this properly.
Add-on: well, "works" is relative. It allows me to edit the files I need to edit, but it thinks the terminal has a different size than it does, as does "more" and other tools. So I'm hobbled although not fatally so any more.
Last edited by jernst (2017-10-04 23:11:57)
Offline