5

I'm trying to make an ssh connection (via lsh) from one Ubuntu host to another from within screen. If I try to run mc right after that I get the following error:

Unknown terminal: screen-256color-s
Check the TERM environment variable.
Also make sure that the terminal is defined in the terminfo database.
Alternatively, set the TERMCAP environment variable to the desired
termcap entry.

The question is - who's causing this failure? Is it local host? remote? some package missing (which?), something not done by lsh-server? or client?

  • slm and I edited your question to improve punctuation and formatting for readability. It's worth taking the time to edit your question so that it's easier for others to read. Also: providing more information about relevant software configuration and showing that you've researched the problem before asking your question will get you better responses. See unix.stackexchange.com/help/how-to-ask – Anthony Geoghegan Jul 3 '15 at 14:46
  • Just to be clear - I don't want workarounds like "TERM=xterm mc", I want to be able to use visual themes which support 256 colors on the (remote) console. – god Jul 6 '15 at 10:46
4

Just set another TERM, For example

TERM="rxvt"

or

TERM="xterm"

or

TERM="vt102"

Maybe an export TERM helps too.

The TERM variable is used by curses and termcap programs, such as mc or dialog, to read the terminal escape codes from the terminfo/termcap databases, where the command is executed, so in your case in the remote system.

To support the "screen-256color-s" TERM type this terminal type must be installed in the database.

As a good starting point read man 5 terminfo.

4

GNU screen is setting $TERM locally, and ssh is passing that value to the remote side. There are a few things you can do.

  • Detect the screen-256-color-s on the remote side and set to a more sane. From that you can have case $TERM in screen-256*) TERM=screen;; esac.
  • From the local side, have screen set the terminal. In your ~/.screenrc file have: term screen.
  • If you have a screen command to open the ssh call, then add a -T option: screen -T screen ssh user@host
  • In you local ~/.bashrc, set the terminal if it detects the incompatible one similar to the remote side one above.
4

Finally, I've managed to figure out "obvious" package which supply screen-256-color-s (got to be installed on remote machine):

sudo apt install ncurses-term

fixed the problem for me: nice 256 colors and no need for ugly workarounds with environment variables. Hooray! :)

  • didn't work for me on an old ubuntu 12.04. ncurses-term installed fine but I still get 'screen.xterm-256color': unknown terminal type. – Calimo Jul 22 '18 at 9:09

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.