LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (https://www.linuxquestions.org/questions/linux-software-2/)
-   -   top 'xterm': unknown terminal type. (https://www.linuxquestions.org/questions/linux-software-2/top-xterm-unknown-terminal-type-4175510682/)

inyourmind 07-10-2014 07:17 AM

top 'xterm': unknown terminal type.
 
Hello mates,

I have an error when run TOP command:

>top
'xterm': unknown terminal type.

> echo $TERM
xterm

> echo $DISPLAY
DYSPLAY: Undefined variable.

> cat /etc/redhat-release
Red Hat Enterprise Linux Server release 6.3 (Santiago)

> ls /usr/share/terminfo/
1 2 3 4 5 6 7 8 9 a A b c d e E f g h i j k l L m M n N o p P q Q r s t u v w x X z


> ls /usr/share/terminfo/x/xterm
/usr/share/terminfo/x/xterm

i have that problem also with Root.


do TOP use xterm?

How can i do?

MensaWater 07-10-2014 10:19 AM

Command line applications rely on your TERM variable to determine how to display information your screen. Since top has to show information on you screen (in a text) interface it needs to use the TERM you defined.

xterm is the default for many things and is based on the old vt100 definition.

On my RHEL6.x boxes top runs fine using xterm.

This suggests perhaps there is an issue with the xterm you have or the top you have.

Run "rpm -qf /usr/share/terminfo/x/xterm" to determine which package installed that.
Run "yum list <package>" on the name of the package without version, architecture to see if there are newer versions available.
e.g. if the first command output something like: ncurses-base-5.7-3.20090208.el6.x86_64 then run "yum list "ncurses-base".
That should show which version you have installed and if any later versions are available. If there are later versions you can update by running "yum update <package>" to see if it gives you a better xterm.

Similarly you could check the same for top.

By the way when doing "ls" you might want to get in the habit of doing "ls -l" instead as it gives you much more information about the file. (e.g. if it a link when it shouldn't be).

TobiSGD 07-10-2014 10:24 AM

Seeing that this is a RHEL system and the DISPLAY variable is not set I assume that this system is not running a GUI. Since Xterm is a GUI program it is not really a surprise that top can't handle it when no GUI is running. Set your TERM variable to linux and try it again.

MensaWater 07-10-2014 11:52 AM

Quote:

Originally Posted by TobiSGD (Post 5201754)
Seeing that this is a RHEL system and the DISPLAY variable is not set I assume that this system is not running a GUI. Since Xterm is a GUI program it is not really a surprise that top can't handle it when no GUI is running. Set your TERM variable to linux and try it again.

That's not correct.

You're confusing the X application named "xterm" with the Terminal definition of the same name. One does NOT need to be running X nor have the DISPLAY variable set to use the "TERM" variable "xterm" which is specifying the terminal definition rather than the X application. For example all of my PuTTY sessions use "xterm" by default. The "xterm" terminal definition is just a modified version of the old vt100 definition optimized to run INSIDE the xterm X application but other applications are quite happy using that xterm definition as well.

TobiSGD 07-10-2014 11:57 AM

Quote:

Originally Posted by MensaWater (Post 5201811)
That's not correct.

You're confusing the X application named "xterm" with the Terminal definition of the same name. One does NOT need to be running X nor have the DISPLAY variable set to use the "TERM" variable "xterm" which is specifying the terminal definition rather than the X application. For example all of my PuTTY sessions use "xterm" by default. The "xterm" terminal definition is just a modified version of the old vt100 definition optimized to run INSIDE the xterm X application but other applications are quite happy using that xterm definition as well.

Thanks for the correction.

jpollard 07-10-2014 02:44 PM

One possibility is that xterm (or the other GUI terminal emulations) is not installed.

Second,Red Hat Enterprise Linux Server release 6.3 (Santiago) may not even have a GUI installed (which can also require the XTERM terminal definitions to be installed).

Third - if no GUI is installed, then the terminal connection must be using the basic one.

Which happens to be name "linux" for the console. This is NOT an xterm. This also means that the user has the TERM environment variable defined in their profile/.login/.bashrc/... somewhere. This should never be done.

As a point, xterm is an extended ANSI terminal escape specification - it isn't VT100. A VT100 did have a number of escape sequences in common with an ANSI terminal - but only about half. The other half did things like setting scrolling regions, double width and/or double height characters, blinking (I think), and inverse video... As I recall, ANSI did not have color capability - xterm does.

Top uses the ncurses library which uses the terminfo database for terminal information (or termcap if so configured at compile time). This is a portable and reconfigurable set, but it requires the database to contain the definitions. Since the error is "'xterm': unknown terminal type." that means the definition of an xterm is not in the database.

Removing the definition of the environment variable TERM from the profile will allow the system to use the name it has been configured to use (most likely the value is supposed to be "linux").

MensaWater 07-11-2014 09:06 AM

Quote:

Originally Posted by jpollard (Post 5201885)
One possibility is that xterm (or the other GUI terminal emulations) is not installed.

Apparently you didn't read the rest of the thread. You do NOT need a GUI to run "xterm" terminal type. You do need it to run the "xterm" X application which is NOT what the OP is doing.

jpollard 07-11-2014 11:20 AM

Quote:

Originally Posted by MensaWater (Post 5202287)
Apparently you didn't read the rest of the thread. You do NOT need a GUI to run "xterm" terminal type. You do need it to run the "xterm" X application which is NOT what the OP is doing.

Reread my answer. You don't need the GUI... but you do need the termcap/terminfo entry - and that isn't installed by default UNLESS you install the GUI. And even if you do install the termcap/terminfo entry it still won't work properly UNLESS you are running an xterm (or compatible) somewhere (such as via ssh).

A TERM environment variable set to "xterm" will not work properly from the console. Not all escape sequences are recognized by the VT console for instance.

MensaWater 07-11-2014 01:06 PM

The OP posted originally that he DOES have the xterm terminfo file as shown by his ls output.

It is NOT correct to say it ONLY works with "GUI" tools such as Xterm.

It is also NOT correct to say it only installs with GUI/X. It is part of the ncurses package that installs multiple terminfo files.

As I noted in a prior post it works in PuTTY and various other terminal emulators as well. Specifically top DOES work with xterm in PuTTY even though neither top NOR PuTTY are X applications.

It IS correct to say that different terminfo files have different capabilities however his issue wasn't one of capability but rather that it was telling him it didn't recognize his TERM at all (i.e. couldn't find it not that it didn't work properly). My initial response to him was talking about additional information he needs to look at because as noted above it DOES work on my systems.

jpollard 07-11-2014 09:08 PM

Quote:

Originally Posted by MensaWater (Post 5202402)
The OP posted originally that he DOES have the xterm terminfo file as shown by his ls output.

Simple answer:

'xterm': unknown terminal type.

Thus it is not known.
Quote:


It is NOT correct to say it ONLY works with "GUI" tools such as Xterm.

It is also NOT correct to say it only installs with GUI/X. It is part of the ncurses package that installs multiple terminfo files.
Depends on the install. I have seen systems that don't have it because it isn't supported.

The fact that the error says "unknown terminal type" says it isn't installed.
Quote:

As I noted in a prior post it works in PuTTY and various other terminal emulators as well. Specifically top DOES work with xterm in PuTTY even though neither top NOR PuTTY are X applications.
It works only where the escape sequences are interpreted.
Quote:

It IS correct to say that different terminfo files have different capabilities however his issue wasn't one of capability but rather that it was telling him it didn't recognize his TERM at all (i.e. couldn't find it not that it didn't work properly). My initial response to him was talking about additional information he needs to look at because as noted above it DOES work on my systems.
Works on mine too. It doesn't work where the escape sequences are not interpreted though.

MensaWater 07-14-2014 10:15 AM

Quote:

Originally Posted by jpollard (Post 5202594)
meaningless drivel

Some people can admit when they make a mistake. Others simply continue posting to try to show they didn't.

The answer is NOT just a "simple" it isn't there. The OP posted that it is there as shown by ls so my original response was trying to get more information.

Since you'll now post more meaningless drivel I'll let you have the last word.


All times are GMT -5. The time now is 12:15 PM.