Jump to content

$VISUAL and $EDITOR environment variables not set or defined editor not found ????


abarbarian

Recommended Posts

I thought I had fixed the problem shown in the title by adding ,

 

Quote

export EDITOR=nano

 

to my .bashrc as the problem went away. However it has resurfaced and I have tried several different ways to solve the problem but have met with no success.

 

I have added,

 

Quote

VISUAL=nano
export EDITOR=nano

 

to my .bashrc but it has not helped.

 

I have tried using the full path as in,

 

Quote

export EDITOR=/usr/bin/nano

 

After making changes to .bashrc I have tried " source ~/.bashrc " and rebooting to no avail.

 

I have tried several different ways of making changes to the sudoers file but none of them have worked. I do not understand why my initial attempt made a temporary fix but has not worked since.

Yes I have read the Arch wiki and probably hundreds of guides and tips on the net but am stumped.

 

I need help. 🤔

 

Edited by abarbarian
Link to comment
Share on other sites

25 minutes ago, securitybreach said:

Are you using bash or zsh?

 

I am bashing my head against the wall constantly 😱

 

 I just found the solution.

It seems I had a gremlin line in my .bashrc. I have a pretty complicated,

 

Quote

export PS1="\[$(tput sgr0)\]\[\033[38;5;75m\]\t\[$(tput sgr0)\]\[$(tput bold)\]\[\033[38;5;21m\]-->\[$(tput sgr0)\]\[\033[38;5;75m\]\d\[$(tput sgr0)\]\[$(tput bold)\]\[\033[38;5;21m\]-->\[$(tput sgr0)\]\[\033[38;5;2m\]\W\[$(tput sgr0)\]\n\[$(tput sgr0)\]\[$(tput bold)\]\[\033[38;5;21m\]-->\[$(tput sgr0)\]"

 

and it seems for some strange reason that this had been added to the start of it,

 

Quote

 

exexport=/usr/binexport=nano

export PS1="\[$(tput sgr0)\]\[\033[38;5;75m\]\t\[$(tput sgr0)\]\[$(tput bold)\]\[\033[38;5;21m\]-->\[$(tput sgr0)\]\[\033[38;5;75m\]\d\[$(tput sgr0)\]\[$(tput bold)\]\[\033[38;5;21m\]-->\[$(tput sgr0)\]\[\033[38;5;2m\]\W\[$(tput sgr0)\]\n\[$(tput sgr0)\]\[$(tput bold)\]\[\033[38;5;21m\]-->\[$(tput sgr0)\]"export=/usr/binexport=nano

 

and that was enough to throw everything out of wack.

 

I now have,

 

Quote

export VISUAL="$EDITOR"
export EDITOR="nano"

 

in .bashrc and everything is working well.

 

I have stopped bashing my head against the wall. At least for now anyway. 🤣

  • Haha 1
Link to comment
Share on other sites

V.T. Eric Layton

If you use SU (not sudo), you need to also edit your root .bashrc so that you'll have the same editor/settings as root.

  • Like 1
  • +1 1
Link to comment
Share on other sites

5 hours ago, V.T. Eric Layton said:

If you use SU (not sudo), you need to also edit your root .bashrc so that you'll have the same editor/settings as root.

 

I can not find a root .bashrc. I did find a /etc/bash.bashrc and made the changes there though. 🤔

Link to comment
Share on other sites

securitybreach
1 hour ago, abarbarian said:

 

I can not find a root .bashrc. I did find a /etc/bash.bashrc and made the changes there though. 🤔

 

That is the global setting as long as there isn't one in the home folders of the users. 

  • +1 2
Link to comment
Share on other sites

21 hours ago, V.T. Eric Layton said:
  • open terminal
  • su to root

 


root:# cd

 


root:# ls  -al

 


-rw-r--r--  1 root   root    762 Dec  3  2016 .bashrc

 

 

 

Quote

Put brain in gear befor pressing enter18:28:01-->Sun Jan 17-->~
-->su
Password:
[root@longship bloodaxe]# cd
[root@longship ~]# ls-al
bash: ls-al: command not found

 

Hmm don't not seem to work here 😱

 

21 hours ago, securitybreach said:

 

That is the global setting as long as there isn't one in the home folders of the users. 

 

So those settings should apply to root aswell then shouldn't they ?? 🤔

Link to comment
Share on other sites

securitybreach
59 minutes ago, abarbarian said:

 

 

 

Hmm don't not seem to work here 😱

 

 

So those settings should apply to root aswell then shouldn't they ?? 🤔

It's ls -la

 

He was missing a space between command and switch

Link to comment
Share on other sites

i have a similar problem with the java path setting not being seen when running a script from cron but works just swell when run from command line.

same non-root user.

 

Link to comment
Share on other sites

15 hours ago, securitybreach said:

It's ls -la

 

He was missing a space between command and switch

 

Yeah well even correcting my mistake and entering the correct commands does not magically make a root .bashrc appear.  Does a  bog standard fresh install of Arch even have a root .bashrc ?

 

Quote

 Put brain in gear befor pressing enter10:53:14-->Mon Jan 18-->~
-->su
Password:
[root@longship bloodaxe]# cd
[root@longship ~]# ls -al
total 24
drwxr-x---  5 root root 4096 Jan 14 23:59 .
drwxr-xr-x 17 root root 4096 Jan 11 22:37 ..
-rw-------  1 root root 3360 Jan 17 19:43 .bash_history
drwx------  3 root root 4096 Jan 15 16:36 .cache
drwx------  3 root root 4096 Jan 11 22:37 .gnupg
drwx------  2 root root 4096 Jan 14 00:06 .icewm

 

🤔

Link to comment
Share on other sites

securitybreach

It will not be there by default, same as the one in your user directory. The global setting is /etc/bashrc and the user settings are in home: 

 

/home/username/.bashrc

/root/.bashrc

Link to comment
Share on other sites

V.T. Eric Layton
15 minutes ago, securitybreach said:

It will not be there by default

 

That's interesting. I've always seen that .bashrc in the /root directory of any distribution I ran on my systems. Does Arch rely more on sudo, as does Ubuntu? I can't remember. Been a while since I had an Arch installation.

 

@abarbarian, if you have to, you can just create a .bashrc in the /root directory to suit your needs. Here's a generic:

 

export PS1='\u@abarbarian\w\:$ '
umask 022

# root prompt = red
TERM_USER_HOST_COLOR='0;31m'
TERM_PATH_COLOR='0;31m'
TERM_PROMPT_COLOR='0;31m'

TERM_USER_HOST='<add host (computer name) here>'
TERM_PATH='\w'
TERM_PROMPT='\$'

export PS1=\
'\[\e['${TERM_USER_HOST_COLOR}'\]'${TERM_USER_HOST}'\[\e[m\]'\
'\[\e['${TERM_PATH_COLOR}'\]'${TERM_PATH}'\[\e[m\]'\
'\[\e['${TERM_PROMPT_COLOR}'\]:#\[\e[m\] '

# You may uncomment the following lines if you want `ls' to be colorized:
# export LS_OPTIONS='--color=auto'
# eval "`dircolors`"
# alias ls='ls $LS_OPTIONS'
# alias ll='ls $LS_OPTIONS -l'
# alias l='ls $LS_OPTIONS -lA'
#
# Some more alias to avoid making mistakes:
# alias rm='rm -i'
# alias cp='cp -i'
# alias mv='mv -i'

 

The above .bashrc requires you to add in your host (computer name) information. This is a customized .bashrc that I use that turns your terminal font color to RED when you are root.

 

This is my actual .bashrc (root) on my system. You can see the format required to add your host name to the above.

 

export PS1='\u@ericsbane07\w\:$ '
umask 022

# root prompt = red
TERM_USER_HOST_COLOR='0;31m'
TERM_PATH_COLOR='0;31m'
TERM_PROMPT_COLOR='0;31m'

TERM_USER_HOST='\u@ericsbane07'
TERM_PATH='\w'
TERM_PROMPT='\$'

export PS1=\
'\[\e['${TERM_USER_HOST_COLOR}'\]'${TERM_USER_HOST}'\[\e[m\]'\
'\[\e['${TERM_PATH_COLOR}'\]'${TERM_PATH}'\[\e[m\]'\
'\[\e['${TERM_PROMPT_COLOR}'\]:#\[\e[m\] '

# You may uncomment the following lines if you want `ls' to be colorized:
# export LS_OPTIONS='--color=auto'
# eval "`dircolors`"
# alias ls='ls $LS_OPTIONS'
# alias ll='ls $LS_OPTIONS -l'
# alias l='ls $LS_OPTIONS -lA'
#
# Some more alias to avoid making mistakes:
# alias rm='rm -i'
# alias cp='cp -i'
# alias mv='mv -i'

 

When using this .bashrc on my system is causes the prompt to look like this:

 

vtel57@ericsbane07~:$ su
Password: *********
root@ericsbane07/home/vtel57:#

 

Anyway, here's some more info on .bashrc -> https://www.journaldev.com/41479/bashrc-file-in-linux

Link to comment
Share on other sites

Thanks @V.T. Eric Layton Eric I dabbled with changing my prompt a good while ago and ended up using " tput " and managed to have a different root prompt. This is how it looks on this fresh install.

 

XRCbNsN.png

 

It looked a lot better on the old set up but I am having difficulty altering the xterm at the moment. Yet another gremlin that is haunting me :bangin:

  • Agree 1
Link to comment
Share on other sites

3 hours ago, securitybreach said:

It will not be there by default, same as the one in your user directory. The global setting is /etc/bashrc and the user settings are in home: 

 

/home/username/.bashrc

/root/.bashrc

 

There is no,

 

/etc/.bashrc

 

there is however ,

 

/etc/bash.bashrc

 

https://wiki.archlinux.org/index.php/bash#Customize_per-command

Quote

Personal aliases are preferably stored in ~/.bashrc, and system-wide aliases (which affect all users) belong in /etc/bash.bashrc

 

https://wiki.archlinux.org/index.php/Bash/Prompt_customization

 

Quote

Start off by copying the skeleton files /etc/skel/.bash_profile and /etc/skel/.bashrc to /root, then edit /root/.bashrc as desired.

 

This information is pretty hard to track down or at least it seems so to me.

 

Below are three examples of my /root/~,

 

Basic install with icewm installed,

 

]# ls -al                                                             
total 24                                                                              
drwxr-x---  5 root root 4096 Jan 14 23:59 .                                           
drwxr-xr-x 17 root root 4096 Jan 11 22:37 ..                                          
-rw-------  1 root root 3393 Jan 18 14:42 .bash_history                               
drwx------  3 root root 4096 Jan 15 16:36 .cache                                      
drwx------  3 root root 4096 Jan 11 22:37 .gnupg                                      
drwx------  2 root root 4096 Jan 14 00:06 .icewm  

 

Basic install after creating .bashrc,

 

]# ls -al                                                             
total 28                                                                              
drwxr-x---  5 root root 4096 Jan 18 14:49 .                                           
drwxr-xr-x 17 root root 4096 Jan 11 22:37 ..                                          
-rw-------  1 root root 3393 Jan 18 14:42 .bash_history                               
-rw-r--r--  1 root root  296 Jan 18 14:49 .bashrc                                     
drwx------  3 root root 4096 Jan 15 16:36 .cache                                      
drwx------  3 root root 4096 Jan 11 22:37 .gnupg                                      
drwx------  2 root root 4096 Jan 14 00:06 .icewm    

 

This is from my old Arch install,

 

]# ls -la
total 80
drwxr-x--- 12 root root 4096 Dec 14 16:03 .
drwxr-xr-x 17 root root 4096 Oct 19 12:54 ..
drwxr-x---  2 root root 4096 Aug  5  2019 .android
-rw-------  1 root root 8381 Dec 14 16:03 .bash_history
-rw-r--r--  1 root root  295 May 15  2020 .bashrc
drwx------  6 root root 4096 Dec 13 19:42 .cache
drwxr-xr-x 19 root root 4096 Jun  2  2020 .ccache
drwx------ 12 root root 4096 Nov 12 00:25 .config
drwx------  3 root root 4096 Jun 24  2018 .dbus
-rw-------  1 root root  489 Feb  8  2020 dead.letter
drwx------  3 root root 4096 Jun  3  2017 .gnupg
drwxr-xr-x  4 root root 4096 Sep 13  2017 GNUstep
drwxr-xr-x  2 root root 4096 Jun 20  2017 .inxi
drwxr-xr-x  3 root root 4096 Apr 13  2018 .local
drwxr-xr-x  6 root root 4096 May 24  2020 .luckyBackup
-rw-r--r--  1 root root 2728 Mar 16  2018 .nvidia-settings-rc
-rw-------  1 root root    0 Nov  9 17:37 .Xauthority
-rwxr-xr-x  1 root root  236 Jun  4  2017 .xinitrc
-rw-r--r--  1 root root    1 Jun  4  2017 .xinitrc.old.Jun04.10:25:30

 

😎

Link to comment
Share on other sites

securitybreach

Bash is considered an interactive shell when its standard input, output and error are connected to a terminal (for example, when run in a terminal emulator), and it is not started with the -c option or non-option arguments (for example, bash script). All interactive shells source /etc/bash.bashrc and ~/.bashrc, while interactive login shells also source /etc/profile and ~/.bash_profile.

 

 

https://wiki.archlinux.org/index.php/Bash

Link to comment
Share on other sites

15 minutes ago, securitybreach said:

The path is now  /etc/bash.bashrc    It was previously /etc/bashrc

 

You managed to catch up, well done 🤭

  • Like 1
Link to comment
Share on other sites

16 hours ago, securitybreach said:

Well I do not use bash at all and my zsh is configured already.

 

You get a pass on this one then but don't let it happen again. :bangin:

14 hours ago, V.T. Eric Layton said:

Wow! That Arch stuff in cornfoosin'! ;)

 

As it is set up slightly different to other distros finding the relevant information can be a tad confusing. Also the Arch Wiki seems to have been altered a lot lately and is not as good as it was a couple of years ago or way back when I first started to use it.

An if you make typos or paste stuff inadvertently in files or are generally confused by tech speak and rambling all inclusive guides then Arch can be very confusing. :fish:

Link to comment
Share on other sites

4 hours ago, abarbarian said:

 

You get a pass on this one then but don't let it happen again. :bangin:

 

As it is set up slightly different to other distros finding the relevant information can be a tad confusing. Also the Arch Wiki seems to have been altered a lot lately and is not as good as it was a couple of years ago or way back when I first started to use it.

An if you make typos or paste stuff inadvertently in files or are generally confused by tech speak and rambling all inclusive guides then Arch can be very confusing. :fish:

 

I learned the hard way to make a backup copy of the file before I modify it, for easy restoration in those cases.  OldFile > OldFileBAK.  Who am I kidding....I'm STILL learning to do that....I MEAN TO do that everytime, but sometimes get so excited in the progress that I skip that step.  But it sure is handy when I remember.

  • Agree 2
Link to comment
Share on other sites

On 1/18/2021 at 4:34 PM, abarbarian said:

Thanks @V.T. Eric Layton Eric I dabbled with changing my prompt a good while ago and ended up using " tput " and managed to have a different root prompt. This is how it looks on this fresh install.

 

XRCbNsN.png

 

It looked a lot better on the old set up but I am having difficulty altering the xterm at the moment. Yet another gremlin that is haunting me :bangin:

 

Sorted my xterm gremlin and me terminal looks a tad better.

 

g0oPIDQ.png

 

Can anyone suggest a better font for me terminal ? 😎

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...