简体   繁体   中英

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/

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.

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/

You can first try typing: export TERM=xterm If it did not work then you can try:

export TERM=linux

It works even in kernel with virgin system.

Snow Leopard doesn't have the xterm-256color terminfo file in /usr/share/terminfo/78. A Lion upgrade will add it. An Xcode 3 to 4 upgrade will delete it (as well as 90% of the other terminfo files in /usr/share/terminfo/78 ). Time Machine backups in my case confirmed this peculiar chain of events.

If you use Time Machine you can restore the file. Set Finder to see UNIX files (at a command line, defaults write com.apple.finder AppleShowAllFiles True; killall Finder) or you won't be able to get to it.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM