Error opening terminal: xterm-256color

GiH picture GiH · Jul 22, 2011 · Viewed 33.2k times · Source

When I try to nano something on my server I'm getting this error "Error opening terminal: xterm-256color." that I've never seen before, and on top of that nano used to work fine last week. Even when I use vi, the file will open but I can't manipulate using normal vi commands. When I press i to activate insert mode and then try to navigate the document, it just types an A or B or something.

The only thing that changed is I lost my private key and had to generate a new one, so I had to upload the new public key to my server. Anyone know why this is happening?

The server is running Ubuntu 8.04 Hardy.


SOLUTION

Open Terminal, select from the menu Terminal > Preferences > Settings > Advanced and under Emulation select "Declare terminal as: xterm-color not xterm-256color"

Reference: http://ricochen.wordpress.com/2011/07/23/mac-os-x-lion-terminal-color-remote-access-problem-fix/

Answer

Pablo Castellazzi picture Pablo Castellazzi · Jul 22, 2011

xterm-256color is a reference to a terminfo entry. It should be in /usr/share/terminfo/x/. I believe in ubuntu, the package containing the file is ncurses-term.

If the file is corrupted or missing reinstalling the package should fix it. You can also take a look at the files /usr/share/terminfo and set your TERM variable to a supported emulation by your server (xterm is usually a good choice).

About why this happend, the file may be corrupted or missing (check your filesystem), but i think the most likely reason is you changed your terminal emulator or its settings.