csh Cannot open /etc/termcap after starting "screen"

Hans Ottevanger hans at beastielabs.net
Thu Jun 16 19:23:08 UTC 2011

On Thu, Jun 16, 2011 at 07:18:37PM +0200, Ivan Voras wrote:
> Hello,
> This *looks* like it should be a trivial problem (or at least 
> often-encountered one) but short of debugging both screen and tcsh, I 
> have no ideas what to do next...
> On several machines (seemingly random, some are running 7-stable, others 
> 8-stable), I get this message after starting "screen", written on the 
> newly created screen:
> csh: Cannot open /etc/termcap.
> csh: using dumb terminal settings.
> The problem is: this also happens whan I'm doing it as the root user, 
> and /etc/termcap is a symlink to /usr/share/misc/termcap, which 
> definitely exists and is readable. To make it even stranger, it looks 
> like the environment contains something which seems to be valid termcap 
> data:
> lara:/home/ivoras# setenv
> STY=58859.pts-13.lara
> TERM=screen
> TERMCAP=SC|screen|VT 100/ANSI X3.64 virtual terminal:\
>         :DO=\E[%dB:LE=\E[%dD:RI=\E[%dC:UP=\E[%dA:bs:bt=\E[Z:\
>         :cd=\E[J:ce=\E[K:cl=\E[H\E[J:cm=\E[%i%d;%dH:ct=\E[3g:\
>         :do=^J:nd=\E[C:pt:rc=\E8:rs=\Ec:sc=\E7:st=\EH:up=\EM:\
>         :le=^H:bl=^G:cr=^M:it#8:ho=\E[H:nw=\EE:ta=^I:is=\E)0:\
>         :li#48:co#104:am:xn:xv:LP:sr=\EM:al=\E[L:AL=\E[%dL:\
>         :cs=\E[%i%d;%dr:dl=\E[M:DL=\E[%dM:dc=\E[P:DC=\E[%dP:\
>         :im=\E[4h:ei=\E[4l:mi:IC=\E[%d@:ks=\E[?1h\E=:\
>         :ke=\E[?1l\E>:vi=\E[?25l:ve=\E[34h\E[?25h:vs=\E[34l:\
>         :ti=\E[?1049h:te=\E[?1049l:us=\E[4m:ue=\E[24m:so=\E[3m:\
>         :se=\E[23m:mb=\E[5m:md=\E[1m:mh=\E[2m:mr=\E[7m:\
>         :me=\E[m:ms:\
>         :Co#8:pa#64:AF=\E[3%dm:AB=\E[4%dm:op=\E[39;49m:AX:\
>         :vb=\Eg:as=\E(0:ae=\E(B:\
> :ac=\140\140aaffggjjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~..--++,,hhII00:\
>         :k0=\E[10~:k1=\EOP:k2=\EOQ:k3=\EOR:k4=\EOS:k5=\E[15~:\
>         :k6=\E[17~:k7=\E[18~:k8=\E[19~:k9=\E[20~:k;=\E[21~:\
>         :F1=\E[23~:F2=\E[24~:F3=\E[25~:F4=\E[26~:F5=\E[28~:\
>         :F6=\E[29~:F7=\E[31~:F8=\E[32~:F9=\E[33~:FA=\E[34~:kb=^?:\
>         :K2=\E[G:kh=\E[1~:@1=\E[1~:kH=\E[4~:@7=\E[4~:kN=\E[6~:\
>         :kP=\E[5~:kI=\E[2~:kD=\E[3~:ku=\EOA:kd=\EOB:kr=\EOC:\
>         :kl=\EOD:
> SHELL=/bin/csh
> The shell and all started programs are misbehaving and/or treating the 
> terminal as "dumb". For example, "mc" writes this:
> lara:/home/ivoras# mc
> Unknown terminal: screen
> Check the TERM environment variable.
> Also make sure that the terminal is defined in the terminfo database.
> Alternatively, set the TERMCAP environment variable to the desired
> termcap entry.
> There really isn't a termcap line in /etc/termcap beginning with 
> ^screen, but there is one beginning with ^SC containing the entry which 
> is also in the environment listing above (which fails with the same 
> error if I set it).
> The system works if I set some other terminal type like "xterm".
> Any ideas? Why is the "screen" terminal type so special?

This is probably because your termcap entry is too long.

If I remember well the length is limited to 1024, which is confirmed by
the following citation from 'man 5 termcap':

  The total length of a single entry (excluding only escaped newlines) may not
     exceed 1024.

I have tried the TERMCAP entry you specified using bash and I get similar
problems when using e.g. vi or clear. If I shorten the TERMCAP somewhat
everything works again, though probably with reduced functionality.

On 8.2-STABLE I can also set TERM to either screen or SC. Apparently the SC entry in
/etc/termcap is just short enough.

Hope this helps.

Kind regards,


More information about the freebsd-stable mailing list