Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Error opening terminal: xterm-256color

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/

like image 710
GiH Avatar asked Jul 22 '11 09:07

GiH


People also ask

How do you set xterm-256color?

To enable colors on XTerm you will need to run the configure scripts with the --enable-256-color switch, in addition you may also need to set your TERM environment variable to xterm-256color .

What is xterm-256color?

xterm-256color describes Xterm with support for 256 colors enabled. xterm-color describes an older branch of Xterm that supports eight colors. xterm-color is not recommended, since it describes a variant of Xterm that's less functional and that you're not likely to be using.


2 Answers

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.

like image 120
Pablo Castellazzi Avatar answered Oct 13 '22 17:10

Pablo Castellazzi


Probably due to a Lion upgrade/install. Did you do that recently @Gih?

Possible duplicate (with fix) at nano error: Error opening terminal: xterm-256color

EDIT:

Easiest fix (takes 10 seconds)...from Michael:

There is a solution much easier: http://ricochen.wordpress.com/2011/07/23/mac-os-x-lion-terminal-color-remote-access-problem-fix/

like image 28
jbnunn Avatar answered Oct 13 '22 16:10

jbnunn