Where is TERM environment variable being set?

I installed multi-aterm because I enjoyed multi-gnome-term a long while back on Linux, but now it's set my TERM variable to "materm" and I can't unset it.

I'd really like to know where it's being set but I can't find it manually or using grep -ri materm * in a variety of places like all my ~/.* and sub-directories /etc/ /usr/local/etc and rc.d.

I get this when using vim:

Code:
E558: Terminal entry not found in terminfo
'materm' not known. Available builtin terminals are:
    builtin_gui
    builtin_riscos
    builtin_amiga
    builtin_beos-ansi
    builtin_ansi
    builtin_pcansi
    builtin_win32
    builtin_vt320
    builtin_vt52
    builtin_xterm
    builtin_iris-ansi
    builtin_debug
    builtin_dumb
defaulting to 'ansi'

and this in other instances (e.g. man):

Code:
WARNING: terminal is not fully functional
-  (press RETURN)

I can just set TERM in my ~/.profile but I think it's doing other damage and I feel I should just be able to find where it's being set wrong? I also tried make uninstall in the original build location but that seems to be broken now!

Code:
$ uname -a                                                                                                                                               
FreeBSD engine.local 8.2-RELEASE FreeBSD 8.2-RELEASE #0: Sun Apr  3 21:19:49 EST 2011     
[email]root@engine.local[/email]:/usr/obj/usr/src/sys/VESAKERN  i386

Code:
$ printenv | sort                                                                                                                                        
BLOCKSIZE=K
COLORFGBG=15;default
COLORTERM=rxvt
DISPLAY=:0.0
EDITOR=vim
FTP_PASSIVE_MODE=YES
HOME=/home/anil
LOGNAME=anil
MAIL=/var/mail/anil
PAGER=less
PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/sbin:/usr/local/bin:/home/anil/bin
PS1=\n\[\e[33m\]\D{%Y/%m/%d %H:%M:%S} \u@\H\n0 \w\n\$\[\e[m\] 
PWD=/usr/home/anil
SHELL=/usr/local/bin/bash
SHLVL=3
TERM=materm
USER=anil
WINDOWID=14680067
WINDOWPATH=9
XAUTHORITY=/home/anil/.Xauthority
_=/usr/bin/printenv
 
x11/multi-aterm sets TERM to rxvt by default (defined in configure.ac), unless you alter materm.termName/XTerm.termName resource or use -tn option. Actually, .termName may not work as get_resources() is called only after putenv(3).

Try looking in resources and startup scripts, e.g.
$ (cat ~/.Xdefaults ~/.Xresources; xrdb -query) | fgrep -i termName
$ fgrep -- -tn ~/.xinitrc ~/.xsession
If this doesn't help set a few debugging printf(3) in the source code, e.g. around TERMENV macro and rs_term_name variable.
 
This is happening when using normal aterm now. Sorry, I failed to mention that. I've given up on multi-aterm but the TERM setting still persists when calling aterm directly.

I've viewed and grepped everything I can think of to try to find where it's set, including everything in ~ including ~/.Xresources. There is no ~/.Xdefaults (maybe I deleted it in desperation).

Thanks, butterfly, You've given me some clues: I'll check xinitrc when I find it (I have no ~/.xinitrc or ~/.xsession) and I'll see if xrdb can help me.

Thanks Dutch for the original edits.
 
Ok I thought xrdb might specify some file locations but it doesn't. I've checked /usr/local/lib/X11/xinit/xinitrc too. Still can't see TERM being set or any resources setting a termName. Maybe I'll have to re-install aterm?
 
Oh, I found something! The original code offered didn't seem to work:

Code:
# $ (cat ~/.Xdefaults ~/.Xresources; xrdb -query) | fgrep -i termName
su: syntax error near unexpected token `/bin/cat'

# $(cat ~/.Xdefaults ~/.Xresources; xrdb -query) | fgrep -i termName
cat: /home/anil/.Xdefaults: No such file or directory
su: aterm*loginShell:: command not found

# $(cat ~/.Xresources; xrdb -query) | fgrep -i termName
su: aterm*loginShell:: command not found

So I tried breaking that down and now I find that xrdb returns all the old Xresources that I was using with materm. XTerm.Name: materm is in there! But how? Where is xrdb -query pulling this from?

Code:
$ xrdb -query                                                                  
XTerm*Font:     -b&h-lucidatypewriter-bold-r-normal-sans-12-120-*-*-m-*-iso8859-10
XTerm.BoldFont: -b&h-lucidatypewriter-bold-r-normal-sans-12-120-*-*-m-*-iso8859-10
XTerm.BorderWidth:      0
XTerm.Color12:  RoyalBlue
XTerm.Color4:   RoyalBlue
XTerm.Fading:   40
XTerm.Font_:    -b&h-lucidatypewriter-bold-r-normal-sans-12-120-*-*-m-*-iso8859-10
XTerm.Foreground:       white
XTerm.LoginShell:       true
XTerm.Name:     materm
XTerm.Scrollbar:        true
XTerm.ScrollbarFloating:        false
XTerm.ScrollbarRight:   true
XTerm.Transpscrollbar:  true
XTerm.VisualBell:       true
XTerm.Vt.SaveLines:     10000
XTerm.Vt.Shading:       40
XTerm.Vt.Tinting:       gray
XTerm.Vt.Title: multi-aterm
XTerm.Vt.Transparent:   true
aterm*background:       blue
aterm*boldfont: -b&h-lucidatypewriter-bold-r-normal-sans-12-120-*-*-m-*-iso8859-10
aterm*color12:  RoyalBlue
aterm*color4:   RoyalBlue
aterm*fading:   40
aterm*font:     -b&h-lucidatypewriter-bold-r-normal-sans-12-120-*-*-m-*-iso8859-10
aterm*font2:    -b&h-lucidatypewriter-bold-r-normal-sans-17-120-*-*-m-*-iso8859-10
aterm*font3:    -misc-fixed-bold-r-normal--14-*-*-*-*-*-iso8859-15
aterm*foreground:       white
aterm*loginShell:       true
aterm*oldboldfont:      -bitstream-bitstream vera sans mono-bold-r-normal--*-160-*-*-m-*-iso8859-1
aterm*oldfont:  -bitstream-bitstream vera sans mono-medium-r-normal--*-160-*-*-m-*-iso8859-1
aterm*saveLines:        10000
aterm*scrollBar:        true
aterm*scrollBar_right:  true
aterm*selectToClipboard:        true
aterm*shading:  40
aterm*tinting:  gray
aterm*title:    term
aterm*transparent:      true
aterm*transpscrollbar:  true
aterm*visualBell:       true
foobar*geometry:        100x50
materm*foreground:      white
materm*shading: 40
materm*tinting: gray
materm*transparent:     true
materm.vt0.name:        one
materm.vt0.transparent: true
materm.vt1.name:        two
materm.vt1.transparent: true
materm.vt2.name:        three
materm.vt2.transparent: true
wterm*shade:    true
wterm*transparent:      true
wterm*wmmenu:   false
 
I restarted X. I was guessing that some sort of caching was going on, so I just clicked the 'exit' option in the Fluxbox menu and then ran startx.

It looks like the problem's gone now. I now get a clean set of resources (the same as my ~/.Xresources file). I also note that xrdb -query returns the same (limited/clean) set of resources with the offending XTerm.Name: materm.

It looks like this is solved. Thanks again to swallowtail_butterfly for providing the clue. Thanks to DutchDaemon for such excellent forum support. I don't know how to mark the thread as solved, though.
 
Back
Top