rxvt-256color) to DietPi SSH servertput: unknown terminal "rxvt-256color"xterm or another terminal, that is supported on with ncurses-base.[[ $SSH_TTY ]] && [[ $TERM =~ 256 ]] && export TERM='xterm-256color' €: Better include a quick check if $TERM is unsupported, before assigning a supported term string!Connection > Data > Terminal-type stringCheck for supported terminals: toe -a, e.g. toe -a | grep -q "$TERM"
As manually changing the $TERM variable, thus faking a different terminal that what actually is connected, is not the best long term practice:
ncurses-term installed.[[ $TERM =~ 256 ]]) is faked for the current session.PR is up for testing: https://github.com/Fourdee/DietPi/pull/2049
Note to self:
@MichaIng
Yep seems fine, although, been unable to test with any "incompatible terminal" as i know of none 🤣 .
@Fourdee
I tested with PuTTY and changed the terminal string in Connection > Data.
But another test that makes sense is to use another system with an exotic terminal emulator installed and SSH from within it.
I will try this today.
€: Indeed hard to test. Installed a desktop and some random terminal emulator to use for SSH client. On LXDE all terminal emulators seem to set TERM=xterm, no matter which additional emulator I use. Maybe different desktops use different default TERM variables, or Xserver based desktops all use xterm (?), not sure. Still, if manually export TERM=somethingElse and then ssh root@DietPiSSHServer, the solution works great, faking TERM=xterm or =xterm-256color, showing hint with option to install ncurses-term for extended support.
I guess if the terminal is totally incompatible to xterm, has a totally different char, color and/or command set (not sure which parts are defined in the terminal definition files, as they are not plain text), the method can still fail, e.g. whiptail menu being unreadable or format/color being wrong. But since xterm seems to be the most common and most supported terminal definition and the issue is anyway a very rare one, it should be good enough and there is not more we can do.
@MichaIng
But since xterm seems to be the most common and most supported terminal definition and the issue is anyway a very rare one, it should be good enough and there is not more we can do.
Yep agree 👍
Great work, I believe this is the best we can do for now and should prevent the initial issue on this ticket. If additional work is required, it could be a question of "is the SSH client, following the standards correctly, if not, another SSH client should be used"?
I'll mark as completed. Please reopen if required.