简体   繁体   English

屏幕:找不到“xterm-256color”的 terminfo 条目

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

When I run当我跑

screen

on the remote host(running Linux), I obtain the following error:在远程主机(运行 Linux)上,我收到以下错误:

Cannot find terminfo entry for 'xterm-256color'.

I am running terminal on Mac OSX Lion to access the remote host.我在 Mac OSX Lion 上运行终端来访问远程主机。 I have googled to find out the solution to this problem and it appears that people suggest doing我在谷歌上搜索了这个问题的解决方案,似乎人们建议这样做

export TERM=xterm-color

which doesn't work for me.这对我不起作用。

Please help.请帮忙。

Find out which TERM is supported:找出支持哪个 TERM:

ls /usr/share/terminfo/x

this will give you a list of supported TERMs ie这将为您提供支持的术语列表,即

xterm
xterm-xfree86

set the environment variable:设置环境变量:

export TERM=xterm-xfree86

and run screen:并运行屏幕:

TERMINFO='/usr/share/terminfo/' screen

In the terminal app you are using to ssh, go to preferences -> advanced -> Declare terminal as: -> xterm-color (or something besides xterm-256color)在用于 ssh 的终端应用程序中,转到首选项 -> 高级 -> 将终端声明为:-> xterm-color(或 xterm-256color 之外的其他内容)

This answer was taken from a comment to this post, which has another solution: http://marcoschuh.de/wp/?p=873这个答案取自对这篇文章的评论,它有另一个解决方案: http : //marcoschuh.de/wp/?p=873

In case of my Buffalo Linkstation I solved it this way:在我的 Buffalo Linkstation 的情况下,我是这样解决的:

cd /lib/terminfo/x
ln -s xterm-color xterm-256color

You're missing a terminfo file on the remote machine which matches 'xterm-256color'.您在远程计算机上缺少与“xterm-256color”匹配的terminfo文件。

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). Screen 不知道如何模拟您要求的终端 (xterm-256color),因为它没有描述您正在使用的终端的文件 (xterm-256color)。

You could change the ENV variable TERM to ask for a terminal emulation which the remote machine does have.您可以更改 ENV 变量TERM以请求远程机器确实具有的终端仿真。 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.例如: export TERM=vt220 ,但这会假设你的遥控器有一个 vt220 terminfo 文件,你不会得到漂亮的颜色,你必须做其他乏味的事情才能让它坚持下去。 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...如果您的本地机器有 terminfo 文件,但您的远程机器没有,例如,linux/macos 与 QNAP/QNAS/busybox/rpi/router/modem/IOTdevice 通信,那么...

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).您的本地机器可能在其他地方有terminfo目录( /etc/terminfo//usr/share/terminfo/是常见的替代品;您可能需要四处寻找才能找到您的)。

To set it up more permanently move it to a '.terminfo' directory in your home directory (or elsewhere if you know better).要对其进行更永久的设置,请将其移动到主目录中的“.terminfo”目录(或其他地方,如果您更了解)。 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. ENV 变量TERM确定它应该尝试模拟哪个终端,同名文件提供了使这一切发生的魔术代码。

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.我以前使用默认的 Mac OS X 终端应用程序通过 ssh 访问我基于 Ubuntu 的 tmux,并发现了您描述的问题 - 我的 bash 和 tmux 设置为 screen-256color,该选项甚至不在 Mac 的列表中终端偏好。

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.作为启动命令,但它被忽略并在启动时被 xterm-color 覆盖。

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.我还设法通过选择 Shell > Export Settings 将 Mac 终端的设置更改为 screen-256color,然后编辑它生成的 XML 文件,找到 xterm-color 行并将其更改为 screen-256color,然后 Shell > Importing this设置文件。 Upon launching the Terminal, however, I found it had still overridden this setting with xterm-color.然而,在启动终端后,我发现它仍然用 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).所以我承认并下载了iTerm2 ,它允许我通过将其键入纯文本字段(而不是从有限的下拉菜单中进行选择)来更改 screen-256color 设置。 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).所以总而言之,我建议使用 iTerm2 而不是默认的 Mac 终端(它似乎不允许对您需要的 $TERM 进行更改)。

您可以在远程服务器 (Debian/Ubuntu) 上安装ncurses-term来解决此问题。

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我能够从菜单 Terminal>Preferences>Settings>Advanced>Emulation 更改 Mac OSX(10.7.5) terminal(v2.2.3, 303.2) 仿真 将终端声明为 xterm-color

Opening a new terminal ssh connection enabled the new setting.打开一个新的终端 ssh 连接启用了新设置。

You probably need to install a package on your Linux host which provides one of the following files:您可能需要在 Linux 主机上安装一个软件包,该软件包提供以下文件之一:

/usr/share/terminfo/x/xterm-256color
/lib/terminfo/x/xterm-256color

On Ubuntu, for example, this is provided by the ncurses-base package.例如,在 Ubuntu 上,这是由ncurses-base包提供的。

An other case, eg upgrading to Debian Buster from inside screen .另一种情况,例如从screen升级到 Debian Buster。

Terminfo xterm-256colour format changed, so screen cannot restore the previous session. Terminfo xterm-256colour格式已更改,因此screen无法恢复之前的会话。

You may use export TERM=xterm to close screen sessions, and then restart screen.您可以使用export TERM=xterm关闭屏幕会话,然后重新启动屏幕。 This time it will use the correct terminfo file, and so it will succeed.这次它将使用正确的 terminfo 文件,因此它会成功。

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

In the question, the user's configuration asked for a terminal description which was not the default screen .在这个问题中,用户的配置要求提供一个终端描述,这不是默认的screen This was eventually fixed by an update from Apple.这最终由 Apple 的更新修复。 In the version cited in the question, Apple did not provide that terminal description.在问题中引用的版本中,Apple 没有提供该终端描述。 They do now (and have since 2015).他们现在(并且从 2015 年开始)。 For the record, here is a directory listing showing the related entries for MacPorts (in /opt/local ), a locally built ncurses (in /usr/local ) and the Apple/system files in /usr/share :作为记录,这里是一个目录列表,其中显示了 MacPorts(在/opt/local )、本地构建的 ncurses(在/usr/local )和/usr/share的 Apple/system 文件的相关条目:

-rw-r--r--   1 root         1912 Oct  3 2015    opt/local/share/terminfo/73/screen-256color
-rw-r--r--   1 root         1924 Oct  3 2015    opt/local/share/terminfo/73/screen-256color-bce
-rw-r--r--   1 root         1954 Oct  3 2015    opt/local/share/terminfo/73/screen-256color-bce-s
-rw-r--r--   1 root         1940 Oct  3 2015    opt/local/share/terminfo/73/screen-256color-s
-rw-r--r--   1 root         1912 Apr 12 04:22   usr/local/ncurses/share/terminfo/73/screen-256color
-rw-r--r--   1 root         1924 Apr 12 04:22   usr/local/ncurses/share/terminfo/73/screen-256color-bce
-rw-r--r--   1 root         1954 Apr 12 04:22   usr/local/ncurses/share/terminfo/73/screen-256color-bce-s  
-rw-r--r--   1 root         1940 Apr 12 04:22   usr/local/ncurses/share/terminfo/73/screen-256color-s
-rw-r--r--   1 root         1828 Aug 22 2015    usr/share/terminfo/73/screen-256color
-rw-r--r--   1 root         1840 Aug 22 2015    usr/share/terminfo/73/screen-256color-bce
-rw-r--r--   1 root         1866 Aug 22 2015    usr/share/terminfo/73/screen-256color-bce-s
-rw-r--r--   1 root         1856 Aug 22 2015    usr/share/terminfo/73/screen-256color-s

You may notice a few details:您可能会注意到一些细节:

  • on OSX, the default file-system ignores case, so the s is encoded in hexadecimal (to make it distinct from S )在 OSX 上,默认文件系统忽略大小写,因此s以十六进制编码(以使其与S不同)

  • the entries have slightly different sizes.条目的大小略有不同。 Apple provided an older version of the terminal database, which lacks some features. Apple 提供了旧版本的终端数据库,缺少一些功能。

  • Using toe , I see this:使用toe ,我看到了这个:

--> /usr/local/ncurses/share/terminfo
    ----> /usr/share/terminfo
    ------> /opt/local/share/terminfo
    *-*-*-: screen-256color GNU Screen with 256 colors   
    *-*-*-: screen-256color-bce     GNU Screen with 256 colors and BCE 
    *-*-*-: screen-256color-bce-s   GNU Screen with 256 colors using BCE and status line
    *-*-*-: screen-256color-s       GNU Screen with 256 colors and status line

and comparing the system versus MacPorts:并比较系统与 MacPorts:

--- macports    2017-04-26 04:38:21.000000000 -0400
+++ system      2017-04-26 04:40:08.000000000 -0400
@@ -1,19 +1,19 @@
-#      Reconstructed via infocmp from file: /opt/local/share/terminfo/73/screen-256color
+#      Reconstructed via infocmp from file: /usr/share/terminfo/73/screen-256color
 screen-256color|GNU Screen with 256 colors,
        am, km, mir, msgr, xenl,
-       colors#256, cols#80, it#8, lines#24, pairs#32767,
+       colors#256, cols#80, it#8, lines#24, ncv#3, pairs#32767,
        acsc=++\,\,--..00``aaffgghhiijjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~,
        bel=^G, blink=\E[5m, bold=\E[1m, cbt=\E[Z, civis=\E[?25l,
        clear=\E[H\E[J, cnorm=\E[34h\E[?25h, cr=^M,
        csr=\E[%i%p1%d;%p2%dr, cub=\E[%p1%dD, cub1=^H,
        cud=\E[%p1%dB, cud1=^J, cuf=\E[%p1%dC, cuf1=\E[C,
        cup=\E[%i%p1%d;%p2%dH, cuu=\E[%p1%dA, cuu1=\EM,
-       cvvis=\E[34l, dch=\E[%p1%dP, dch1=\E[P, dim=\E[2m,
-       dl=\E[%p1%dM, dl1=\E[M, ed=\E[J, el=\E[K, el1=\E[1K,
-       enacs=\E(B\E)0, flash=\Eg, home=\E[H, ht=^I, hts=\EH,
-       ich=\E[%p1%d@, il=\E[%p1%dL, il1=\E[L, ind=^J, is2=\E)0,
-       kbs=^H, kcbt=\E[Z, kcub1=\EOD, kcud1=\EOB, kcuf1=\EOC,
-       kcuu1=\EOA, kdch1=\E[3~, kend=\E[4~, kf1=\EOP, kf10=\E[21~,
+       cvvis=\E[34l, dch=\E[%p1%dP, dch1=\E[P, dl=\E[%p1%dM,
+       dl1=\E[M, ed=\E[J, el=\E[K, el1=\E[1K, enacs=\E(B\E)0,
+       flash=\Eg, home=\E[H, ht=^I, hts=\EH, ich=\E[%p1%d@,
+       il=\E[%p1%dL, il1=\E[L, ind=^J, initc@, is2=\E)0, kbs=^H,
+       kcbt=\E[Z, kcub1=\EOD, kcud1=\EOB, kcuf1=\EOC, kcuu1=\EOA,
+       kdch1=\E[3~, kend=\E[4~, kf1=\EOP, kf10=\E[21~,
        kf11=\E[23~, kf12=\E[24~, kf2=\EOQ, kf3=\EOR, kf4=\EOS,
        kf5=\E[15~, kf6=\E[17~, kf7=\E[18~, kf8=\E[19~, kf9=\E[20~,
        khome=\E[1~, kich1=\E[2~, kmous=\E[M, knp=\E[6~, kpp=\E[5~,
@@ -22,6 +22,6 @@
        rmul=\E[24m, rs2=\Ec\E[?1000l\E[?25h, sc=\E7,
        setab=\E[%?%p1%{8}%<%t4%p1%d%e%p1%{16}%<%t10%p1%{8}%-%d%e48;5;%p1%d%;m,
        setaf=\E[%?%p1%{8}%<%t3%p1%d%e%p1%{16}%<%t9%p1%{8}%-%d%e38;5;%p1%d%;m,
-       sgr=\E[0%?%p6%t;1%;%?%p1%t;3%;%?%p2%t;4%;%?%p3%t;7%;%?%p4%t;5%;%?%p5%t;2%;m%?%p9%t\016%e\017%;,
+       sgr=\E[0%?%p6%t;1%;%?%p1%t;3%;%?%p2%t;4%;%?%p3%t;7%;%?%p4%t;5%;m%?%p9%t\016%e\017%;,
        sgr0=\E[m\017, smacs=^N, smcup=\E[?1049h, smir=\E[4h,
        smkx=\E[?1h\E=, smso=\E[3m, smul=\E[4m, tbc=\E[3g,

I had the same problem in a totally different context.我在完全不同的环境中遇到了同样的问题。

By typing infocmp I got the message that it could not open terminfo.通过输入 infocmp,我收到了无法打开 terminfo 的消息。 But it also informed the path it was trying to get.但它也告知了它试图获得的路径。 What I did was simply creating that path with the right term there (xterm-256color).我所做的只是用正确的术语(xterm-256color)创建该路径。 Using find * I found it in another directory and copied to the new directory.使用 find * 我在另一个目录中找到它并复制到新目录。

您只需要将/usr/share/terminfo/x/xterm-256color复制到您要连接的服务器。

Don't forget to refresh terminal source if you export a variable...如果导出变量,请不要忘记刷新终端源...

source ~/.bashrc or just open a new terminal. source ~/.bashrc或者只是打开一个新终端。 May be why original poster had trouble with exporting.可能是原始海报在导出时遇到问题的原因。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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