Skip to content
Advertisement

Using screen on Synology (DSM6): “Cannot find termcap entry for ‘xterm-256color”

Using screen on Synology (DSM6) I get the error

Cannot find termcap entry for ‘xterm-256color’

when I type screen.

I am aware of the quick fix from this question Unix screen utility error: Cannot find termcap entry for ‘xterm-256color’.
So TERM=xterm screen does work and launches screen.

But I would like to set TERM to a different value on my machine, so I could just type screen instead.
Can I choose the color mode screen uses and set it somewhere ?

Advertisement

Answer

screen filters out escape sequences which it does not support. It doesn’t support the xterm-style escape sequence which changes color values, but uses only the predefined color palette of your terminal.

If you do

infocmp screen-256color xterm-256color

you’ll probably notice several differences. The one dealing with changing color values is initc. (Choosing a given color from the palette is done with setaf and setab).

The warning message is because (apparently) your machine does not have a terminal description for xterm-256color installed, e.g., if you ssh to the machine and it gets TERM from your local machine. screen wants to know what TERM applies to outside, to help it convert to its inside (TERM=screen). A quick read of the documentation and source code shows that while it has several features for amending the conversion between in/out TERM, and for choosing a particular inside-TERM, there is no .screenrc setting for overriding the environment variable TERM.

Here’s a pointer to the relevant chunk of code in screen:

    if ((attach_term = getenv("TERM")) == 0 || *attach_term == 0)
        Panic(0, "Please set a terminal type.");
    if (strlen(attach_term) > MAXTERMLEN)
        Panic(0, "$TERM too long - sorry.");
    GetTTY(0, &attach_Mode);

where it ensures that TERM is set, and a pointer to (a couple of levels down) where it checks if TERM corresponds to an actual terminal description:

if (*D_termname == 0 || e_tgetent(tbuf, D_termname) != 1) {
    Msg(0, "Cannot find terminfo entry for '%s'.", D_termname);
    return -1;
}

So… if you want to just run “screen”, you could make a shell alias, or simple script which sets TERM as you are doing now.

User contributions licensed under: CC BY-SA
10 People found this is helpful
Advertisement