TERM environment variable not set

TERM environment variable not set

It means that the variable TERM is not set for the whole environment, but it is available locally for root user.
To fix this we need to make the variable globally through ‘export’.

1. Connect to your server via SSH as root

2. Find out your TERM value
on the terminal execute

# echo $TERM

my result for e.g. is

xterm-256color

if yours is “dumb” then use “dump”
compare the output with

# printenv TERM

it probably differs. either way proceed with the following.

3. Export the variable
Now you just could do

# export TERM=xterm-256color

but after a server reboot it would be forgotten.
so we need to put this into ~/.bashrc

# echo “export TERM=xterm-256color” >> ~/.bashrc

IMPORTANT: use “>>” it means append.
If you use “>” it will replace everything inside the file!

From now on – every-time you login in as root, the .bashrc script will say “make TERM=xterm-256color a public environment variable”.
Alternative you could also put “export TERM=xterm-256color” into the cronjob to automate it if you like.
Probably good option if you don’t login often as root.

4. Finally: reload/execute .bashrc

# source ~/.bashrc

it’s the same as logout and login again.

Source: https://linuxconfig.org/term-environment-variable-not-set-solution
Source: https://github.com/dockerfile/mariadb/issues/3

Comments

No comments yet. Why don’t you start the discussion?

Leave a Reply

Your email address will not be published. Required fields are marked *