Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
OpenRC default $TERM and font [SOLVED]
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Other Things Gentoo
View previous topic :: View next topic  
Author Message
Tony0945
Advocate
Advocate


Joined: 25 Jul 2006
Posts: 2577
Location: Illinois, USA

PostPosted: Sat Feb 24, 2018 8:45 pm    Post subject: OpenRC default $TERM and font [SOLVED] Reply with quote

It seems that the default is TERM=linux. This makes "make menuconfig" unusable on systems without X11. Setting TERM=xterm before "make menuconfig" allows make menuconfig to display normally.
When I ssh in to the system:
Code:
  # echo $TERM
xterm-256color
and again menuconfig displays normally.

The website http://invisible-island.net/ncurses/ncurses.faq.html#config_linux says:
Quote:
Why not just use TERM set to "xterm"?

It is easy to find people recommending just setting $TERM to "xterm", noting that several developers have used that as a default value for their terminal emulators. However, this is usually (except for xterm itself) a bad idea. The reason that those terminal emulators use "xterm" is not because they actually match the behavior, but

it seems too much work to install the correct terminal definition on each machine (this was the reason given for rxvt's having done so for several years), or

it seems inconvenient to the user to put up with the absence of a given terminal description when making remote connections (which pass $TERM to the remote system).



What alternatives to TERM=linux are appropiate to a widescreen LED terminal attached to a PC and where should it be set? Possibly in root's .bashrc?


Last edited by Tony0945 on Sun Feb 25, 2018 6:57 pm; edited 1 time in total
Back to top
View user's profile Send private message
Ant P.
Watchman
Watchman


Joined: 18 Apr 2009
Posts: 5166

PostPosted: Sun Feb 25, 2018 7:58 am    Post subject: Reply with quote

Use tmux or screen? Both `make menuconfig` and `make nconfig` work fine for me on a VT, fwiw.
Back to top
View user's profile Send private message
Tony0945
Advocate
Advocate


Joined: 25 Jul 2006
Posts: 2577
Location: Illinois, USA

PostPosted: Sun Feb 25, 2018 3:53 pm    Post subject: Reply with quote

Ant P. wrote:
Use tmux or screen? Both `make menuconfig` and `make nconfig` work fine for me on a VT, fwiw.

Is your default TERM=linux? Perhaps it's some other variable like font selection.? AFAIK, My VT's are straight installation tarball from around 2005 or 2006.

As long as I remember I can always change TERM before. Actually I use a script "Buildmykernel" It's easy to make another script, say "VTbuildmykernel"
Code:
#!/bin/bash
term=XTERM
buildmykernel
term=linux
Or does the TERM setting not survive the script? In that case I could just add TERM=xterm to the regular script since I usually run it from an Xterm anyway.

(ASIDE) I could REALLY use a good book about BASH. The ones I've found are like ten years old and review sare full of comments about how archaic the examples are, plus time wasted explaining what a script language is what linux is and even what a personal computer is.


Last edited by Tony0945 on Sun Feb 25, 2018 4:00 pm; edited 1 time in total
Back to top
View user's profile Send private message
Naib
Watchman
Watchman


Joined: 21 May 2004
Posts: 5434
Location: Removed by Neddy

PostPosted: Sun Feb 25, 2018 3:58 pm    Post subject: Reply with quote

I just ssh'ed into my headless

Code:
echo $TERM
rxvt-256color


Also it isn't openRC that sets the default to LINUX, that is the default
_________________
The best argument against democracy is a five-minute conversation with the average voter
Great Britain is a republic, with a hereditary president, while the United States is a monarchy with an elective king
Back to top
View user's profile Send private message
Tony0945
Advocate
Advocate


Joined: 25 Jul 2006
Posts: 2577
Location: Illinois, USA

PostPosted: Sun Feb 25, 2018 4:04 pm    Post subject: Reply with quote

Naib, my ssh's are xterm-256color. I wonder where that is set? It's just the native VT without without X that's TERM=linux.

So it's the kernel's default? I can just set another in .bashrc. Why would xterm or rvxt-256color be bad on a bare VT?
Back to top
View user's profile Send private message
mike155
Guru
Guru


Joined: 17 Sep 2010
Posts: 548
Location: Frankfurt, Germany

PostPosted: Sun Feb 25, 2018 4:33 pm    Post subject: Reply with quote

Code:
So it's the kernel's default?

The environment variable TERM is most probably set by the terminal emulator you use. At least Konsole sets this variable. If you log in to a remote computer using ssh, the remote session will have the TERM environment variable of your local session - unless you overwrite TERM in .profile.
Back to top
View user's profile Send private message
Naib
Watchman
Watchman


Joined: 21 May 2004
Posts: 5434
Location: Removed by Neddy

PostPosted: Sun Feb 25, 2018 4:42 pm    Post subject: Reply with quote

mike155 wrote:
Code:
So it's the kernel's default?

The environment variable TERM is most probably set by the terminal emulator you use. At least Konsole sets this variable. If you log in to a remote computer using ssh, the remote session will have the TERM environment variable of your local session - unless you overwrite TERM in .profile.

it's not probably set, it is set. Take urxvt

https://github.com/exg/rxvt-unicode/blob/15ced41d5787a75c55189ba04f2836be47cbd957/src/rxvt.h
Code:
/*
 *****************************************************************************
 * NORMAL DEFINES
 *****************************************************************************
 */

/* COLORTERM, TERM environment variables */
#define COLORTERMENV    "rxvt"
#if HAVE_IMG
# define COLORTERMENVFULL COLORTERMENV "-xpm"
#else
# define COLORTERMENVFULL COLORTERMENV
#endif
#ifndef TERMENV
# if USE_256_COLORS
#  define TERMENV        "rxvt-unicode-256color"
# else
#  define TERMENV        "rxvt-unicode"
# endif


The default on linux is ... LINUX as defined by the init system that deals with the tty... so if you are using openrc this is sysvinit via /etc/initab

Code:
# TERMINALS
#x1:12345:respawn:/sbin/agetty 38400 console linux
c1:12345:respawn:/sbin/agetty 38400 tty1 linux
c2:2345:respawn:/sbin/agetty 38400 tty2 linux
c3:2345:respawn:/sbin/agetty 38400 tty3 linux
c4:2345:respawn:/sbin/agetty 38400 tty4 linux
c5:2345:respawn:/sbin/agetty 38400 tty5 linux
c6:2345:respawn:/sbin/agetty 38400 tty6 linux



So as I said :) this isn't openRC but sysvInit.

Now if you are using a newer openRC and equally are using openrc-init you would have to manually setup the terminals via
Code:
ln -sr /etc/init.d/agetty /etc/init.d/agetty.tty1
rc-update add agetty.tty1 default
with however many you wished (instead of inittab listing 6). NOW in this instance openRC would be setting what your default terminal is via /etc/conf.d/agetty and this is equally linux because as previously mentioned this has been the default for decades
_________________
The best argument against democracy is a five-minute conversation with the average voter
Great Britain is a republic, with a hereditary president, while the United States is a monarchy with an elective king
Back to top
View user's profile Send private message
Tony0945
Advocate
Advocate


Joined: 25 Jul 2006
Posts: 2577
Location: Illinois, USA

PostPosted: Sun Feb 25, 2018 4:55 pm    Post subject: Reply with quote

Naib wrote:

The default on linux is ... LINUX as defined by the init system that deals with the tty... so if you are using openrc this is sysvinit via /etc/initab

Code:
# TERMINALS
#x1:12345:respawn:/sbin/agetty 38400 console linux
c1:12345:respawn:/sbin/agetty 38400 tty1 linux
c2:2345:respawn:/sbin/agetty 38400 tty2 linux
c3:2345:respawn:/sbin/agetty 38400 tty3 linux
c4:2345:respawn:/sbin/agetty 38400 tty4 linux
c5:2345:respawn:/sbin/agetty 38400 tty5 linux
c6:2345:respawn:/sbin/agetty 38400 tty6 linux



So as I said :) this isn't openRC but sysvInit.

Now if you are using a newer openRC and equally are using openrc-init you would have to manually setup the terminals via
Code:
ln -sr /etc/init.d/agetty /etc/init.d/agetty.tty1
rc-update add agetty.tty1 default
with however many you wished (instead of inittab listing 6). NOW in this instance openRC would be setting what your default terminal is via /etc/conf.d/agetty and this is equally linux because as previously mentioned this has been the default for decades
Ahhh! I would only have to edit the table. I thought it was in the code because a grep showed some script that cked and set TERM=linux if TERM wasn't set.

I still wonder about setting TERM in the script. I will try it and report back. I think our ssh logins are different terminals because I'm running MATE and you apparently are on something else like kde of XFCE.
Back to top
View user's profile Send private message
Naib
Watchman
Watchman


Joined: 21 May 2004
Posts: 5434
Location: Removed by Neddy

PostPosted: Sun Feb 25, 2018 5:01 pm    Post subject: Reply with quote

Tony0945 wrote:


I still wonder about setting TERM in the script. I will try it and report back. I think our ssh logins are different terminals because I'm running MATE and you apparently are on something else like kde of XFCE.


I'm on Naib's-DE which is basically just openbox :) I set my term via .Xresources
Code:
!################
!# URXVT settings
!################
URxvt.termName:         rxvt-256color



old output of screenfetch as I am now using linux-4.15.0
https://i.imgur.com/bvfYTF3.png


Code:
screenfetch
/etc/portage/make.conf: line 9: -flto=8: command not found
         -/oyddmdhs+:.                jrb@fluidmotion
     -odNMMMMMMMMNNmhy+-`             OS: Gentoo testing
   -yNMMMMMMMMMMMNNNmmdhy+-           Kernel: x86_64 Linux 4.15.0-gentoo
 `omMMMMMMMMMMMMNmdmmmmddhhy/`        Uptime: 5h 54m
 omMMMMMMMMMMMNhhyyyohmdddhhhdo`      Packages: 1136
.ydMMMMMMMMMMdhs++so/smdddhhhhdm+`    Shell: bash 4.4.19
 oyhdmNMMMMMMMNdyooydmddddhhhhyhNd.   Resolution: 1920x1080
  :oyhhdNNMMMMMMMNNNmmdddhhhhhyymMh   WM: OpenBox
    .:+sydNMMMMMNNNmmmdddhhhhhhmMmy   WM Theme: Clearlooks-3.4
       /mMMMMMMNNNmmmdddhhhhhmMNhs:   GTK Theme: Adwaita [GTK2/3]
    `oNMMMMMMMNNNmmmddddhhdmMNhs+`    Icon Theme: Tango
  `sNMMMMMMMMNNNmmmdddddmNMmhs/.      Font: Sans 10
 /NMMMMMMMMNNNNmmmdddmNMNdso:`        CPU: AMD Ryzen 5 1600 Six-Core @ 12x 3.2GHz [39.7°C]
+MMMMMMMNNNNNmmmmdmNMNdso/-           GPU: GeForce GTX 970
yMMNNNNNNNmmmmmNNMmhs+/-`             RAM: 3917MiB / 16056MiB
/hMMNNNNNNNNMNdhs++/-`               
`/ohdmmddhys+++/:.`                 
  `-//////:--.                       

_________________
The best argument against democracy is a five-minute conversation with the average voter
Great Britain is a republic, with a hereditary president, while the United States is a monarchy with an elective king
Back to top
View user's profile Send private message
Hu
Moderator
Moderator


Joined: 06 Mar 2007
Posts: 12729

PostPosted: Sun Feb 25, 2018 5:50 pm    Post subject: Reply with quote

Tony0945 wrote:
Why would xterm or rvxt-256color be bad on a bare VT?
A bare VT may not implement the same extensions as xterm or rxvt-256color. If you set TERM=xterm, you are promising the program that it can use any output that xterm usefully handles, and you will be happy with how your current terminal, whether or not it is actually xterm, handles that output. For simple TERM types, almost everything handles them acceptably, so you can use TERM=xterm for almost any graphical X11 terminal emulator and get acceptable, although possibly suboptimal, results.
Back to top
View user's profile Send private message
Ant P.
Watchman
Watchman


Joined: 18 Apr 2009
Posts: 5166

PostPosted: Sun Feb 25, 2018 6:21 pm    Post subject: Reply with quote

Tony0945 wrote:
Why would xterm or rvxt-256color be bad on a bare VT?

Run something like `infocmp linux rxvt-256color` and note the difference. The framebuffer/vga console practically speaks a different language to most X11 terminal emulators.
Back to top
View user's profile Send private message
Tony0945
Advocate
Advocate


Joined: 25 Jul 2006
Posts: 2577
Location: Illinois, USA

PostPosted: Sun Feb 25, 2018 6:57 pm    Post subject: Reply with quote

Tony0945 wrote:
I still wonder about setting TERM in the script. I will try it and report back.

OK, I've added TERM=xterm to the script and it ran fine. After it exited echo $TERM returned "linux", so it didn't survive its shell. If I can figure out the syntax, I'll change it to "if [$TERM EQ linux] then TERM=xterm". Since the originally problem is solved, I'm marking it [SOLVED] but I find the discussion fasciniating and enlightening, so please continue commenting and discussing if you want to.
Back to top
View user's profile Send private message
Hu
Moderator
Moderator


Joined: 06 Mar 2007
Posts: 12729

PostPosted: Sun Feb 25, 2018 7:57 pm    Post subject: Reply with quote

Untested / from memory:
Code:
if [ "$TERM" = linux ]; then
    TERM=xterm
fi
Whitespace can be condensed to style, but should not be eliminated.
Back to top
View user's profile Send private message
Tony0945
Advocate
Advocate


Joined: 25 Jul 2006
Posts: 2577
Location: Illinois, USA

PostPosted: Sun Feb 25, 2018 9:19 pm    Post subject: Reply with quote

Yes, that did it. Thank you, Hu.
Back to top
View user's profile Send private message
Naib
Watchman
Watchman


Joined: 21 May 2004
Posts: 5434
Location: Removed by Neddy

PostPosted: Mon Feb 26, 2018 8:24 am    Post subject: Reply with quote

Saying all this though mine is now having issues...
An update yesterday could have caused some issues
_________________
The best argument against democracy is a five-minute conversation with the average voter
Great Britain is a republic, with a hereditary president, while the United States is a monarchy with an elective king
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Other Things Gentoo All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum