Screen: Cannot find terminfo entry for 'xterm-256color'

后端 未结 12 1860
爱一瞬间的悲伤
爱一瞬间的悲伤 2020-12-24 00:51

When I run

screen

on the remote host(running Linux), I obtain the following error:

Cannot find terminfo entry for \'xterm-         


        
相关标签:
12条回答
  • 2020-12-24 01:25

    I was able to change Mac OSX(10.7.5) terminal(v2.2.3, 303.2) emulation from the menu Terminal>Preferences>Settings>Advanced>Emulation Declare terminal as xterm-color

    Opening a new terminal ssh connection enabled the new setting.

    0 讨论(0)
  • 2020-12-24 01:28

    An other case, e.g. upgrading to Debian Buster from inside screen.

    Terminfo xterm-256colour format changed, so screen cannot restore the previous session.

    You may use export TERM=xterm to close screen sessions, and then restart screen. This time it will use the correct terminfo file, and so it will succeed.

    Source: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=901843

    0 讨论(0)
  • 2020-12-24 01:33

    In the terminal app you are using to ssh, go to preferences -> advanced -> Declare terminal as: -> xterm-color (or something besides xterm-256color)

    This answer was taken from a comment to this post, which has another solution: http://marcoschuh.de/wp/?p=873

    0 讨论(0)
  • 2020-12-24 01:33

    I've previously used the default Mac OS X Terminal app to access my Ubuntu-based tmux via ssh, and found the problem you described - my bash and tmux is set to screen-256color, an option not even in the list in the Mac Terminal preferences.

    I tried adding the line:

    export TERM=screen-256color
    

    as a startup command, but it was ignored and was overridden with xterm-color upon startup.

    I also managed to change the settings for the Mac Terminal to screen-256color by choosing Shell > Export Settings, and then editing the XML file it generated, finding the line xterm-color and changing it to screen-256color, then Shell > Importing this settings file. Upon launching the Terminal, however, I found it had still overridden this setting with xterm-color.

    So I conceded and downloaded iTerm2 which allowed me to change the screen-256color setting by typing it into a plain text field (rather than choosing from a limited pulldown menu). This worked straight away without even having to close and reopen the console.

    So in conclusion, I recommend using iTerm2 rather than the default Mac Terminal (which doesn't seem to allow the changes to $TERM you require).

    0 讨论(0)
  • 2020-12-24 01:38

    In case of my Buffalo Linkstation I solved it this way:

    cd /lib/terminfo/x
    ln -s xterm-color xterm-256color
    
    0 讨论(0)
  • 2020-12-24 01:38

    You're missing a terminfo file on the remote machine which matches 'xterm-256color'.

    Screen doesn't know how to emulate the terminal you've asked for (xterm-256color) because it doesn't have the file which describes the terminal you're using (xterm-256color).

    You could change the ENV variable TERM to ask for a terminal emulation which the remote machine does have. For example: export TERM=vt220, but that would assume your remote has a vt220 terminfo file, and you wouldn't get pretty colors, and you'd have to do other tedious things to make it stick. Better...

    If your local machine has terminfo files but your remote machine doesn't, for example, a linux/macos talking to a QNAP/QNAS/busybox/rpi/router/modem/IOTdevice then...

    You can copy the necessary file over to it and instruct your remote terminal to use it for screen. eg:

    [local] $ scp /lib/terminfo/x/xterm-256color john@nasbox:xterm-256color
    [local] $ ssh john@nasbox
    [remote] $ ls
    xterm-256color
    [remote] $ TERMINFO='/share/homes/john/xterm-256color' screen
    

    Screen should work at this point. Your local machine might have the terminfo directory someplace else (/etc/terminfo/ and /usr/share/terminfo/ are common alternatives; you might have to dig around to find yours).

    To set it up more permanently move it to a '.terminfo' directory in your home directory (or elsewhere if you know better). eg:

    [remote] mkdir -p .terminfo/x
    [remote] mv xterm-256color .terminfo/x
    [nasbox] screen
    

    The same technique should apply to other terminal emulations. The ENV variable TERM determines which terminal it should try to emulate and the file of the same name provides the magic codes to make it all happen.

    0 讨论(0)
提交回复
热议问题