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?

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.


Just set another TERM, For example






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.

| improve this answer | |

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! :)

| improve this answer | |
  • 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

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.
| improve this answer | |

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.