2

I noticed an anomaly with how my PATH is being configured on a new install of 22.04. Initially ~/.local/bin appeared twice. I reduced it to one time by commenting out the relevant block in ~/.profile. However, now I can't tell why/where/how ~/.local/bin gets onto the the path in the first place -- it's not set in the default path, it's not set in .profile and it's not set in .bashrc. So what/how is ~/.local/bin getting on my PATH?

dave@local $ echo $PATH
/home/dave/.local/bin:/home/dave/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:/snap/bin

.profile

dave@local $ cat .profile 
# ~/.profile: executed by the command interpreter for login shells.
# This file is not read by bash(1), if ~/.bash_profile or ~/.bash_login
# exists.
# see /usr/share/doc/bash/examples/startup-files for examples.
# the files are located in the bash-doc package.

# the default umask is set in /etc/profile; for setting the umask
# for ssh logins, install and configure the libpam-umask package.
#umask 022

# if running bash
if [ -n "$BASH_VERSION" ]; then
    # include .bashrc if it exists
    if [ -f "$HOME/.bashrc" ]; then
    . "$HOME/.bashrc"
    fi
fi

# set PATH so it includes user's private bin if it exists
if [ -d "$HOME/bin" ] ; then
    PATH="$HOME/bin:$PATH"
fi

# !! If I don't comment this out I get two ~/.local/bin entries on PATH;
# With it commented out, it appears once
# set PATH so it includes user's private bin if it exists
#if [ -d "$HOME/.local/bin" ] ; then
#    PATH="$HOME/.local/bin:$PATH"
#fi

# Generated for envman. Do not edit.
[ -s "$HOME/.config/envman/load.sh" ] && source "$HOME/.config/envman/load.sh"


# This is because I use xmonad as the window manager
xsetroot -solid "Powder Blue"

.bashrc

# If this is an xterm set the title to user@host:dir
case "$TERM" in
xterm*|rxvt*)
    PS1="\[\e]0;${debian_chroot:+($debian_chroot)}\u@\h: \w\a\]$PS1"
    ;;
*)
    ;;
esac

# enable color support of ls and also add handy aliases
if [ -x /usr/bin/dircolors ]; then
    test -r ~/.dircolors && eval "$(dircolors -b ~/.dircolors)" || eval "$(dircolors -b)"
    alias ls='ls --color=auto'
    #alias dir='dir --color=auto'
    #alias vdir='vdir --color=auto'

    alias grep='grep --color=auto'
    alias fgrep='fgrep --color=auto'
    alias egrep='egrep --color=auto'
fi

# colored GCC warnings and errors
#export GCC_COLORS='error=01;31:warning=01;35:note=01;36:caret=01;32:locus=01:quote=01'

# some more ls aliases
alias ll='ls -alF'
alias la='ls -A'
alias l='ls -CF'

# Add an "alert" alias for long running commands.  Use like so:
#   sleep 10; alert
alias alert='notify-send --urgency=low -i "$([ $? = 0 ] && echo terminal || echo error)" "$(history|tail -n1|sed -e '\''s/^\s*[0-9]\+\s*//;s/[;&|]\s*alert$//'\'')"'

# Alias definitions.
# You may want to put all your additions into a separate file like
# ~/.bash_aliases, instead of adding them here directly.
# See /usr/share/doc/bash-doc/examples in the bash-doc package.

if [ -f ~/.bash_aliases ]; then
    . ~/.bash_aliases
fi

# enable programmable completion features (you don't need to enable
# this, if it's already enabled in /etc/bash.bashrc and /etc/profile
# sources /etc/bash.bashrc).
if ! shopt -oq posix; then
  if [ -f /usr/share/bash-completion/bash_completion ]; then
    . /usr/share/bash-completion/bash_completion
  elif [ -f /etc/bash_completion ]; then
    . /etc/bash_completion
  fi
fi

export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"  # This loads nvm
[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion"  # This loads nvm bash_completion

# Generated for envman. Do not edit.
[ -s "$HOME/.config/envman/load.sh" ] && source "$HOME/.config/envman/load.sh"

alias dual-monitor='randr --output eDP-1-1 --primary --output DP-1-2-2 --right-of eDP-1-1'
alias battery_status='upower -i /org/freedesktop/UPower/devices/battery_BAT0'

There are no other bash config files:

dave@local $ ls .bash*
.bash_completion  .bash_history  .bash_logout  .bashrc

The default path seems normal:

dave@local $ cat /etc/environment
PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin"


Looking in all of the obvious candidates doesn't reveal a duplicate:

$ grep --color -RH "local/bin" ~/.bashrc ~/.profile ~/.bash_profile ~/bash.login ~/.bash_aliases /etc/bash.bashrc /etc/profile /etc/profile.d /etc/environment ~/.config/envman/load.sh 2>d/ev/null
/home/dmcnamara/.profile:#if [ -d "$HOME/.local/bin" ] ; then
/home/dmcnamara/.profile:#    PATH="$HOME/.local/bin:$PATH"
/etc/environment:PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin"
4
  • 3
    Try commenting out the envman business in .profile, that's not a default.
    – ubfan1
    Commented May 16 at 3:29
  • What is the output of grep --color -RH "local/bin" ~/.bashrc ~/.profile ~/.bash_profile ~/bash.login ~/.bash_aliases /etc/bash.bashrc /etc/profile /etc/profile.d/ /etc/environment ~/.config/envman/load.sh 2>/dev/null?
    – terdon
    Commented May 16 at 10:31
  • @ubfan1 it's a default in the sense that I did not explicitly install it (whether some other package requires it or not, I'm unsure of)
    – Dave
    Commented May 16 at 14:50
  • @terdon added output of grep to bottom of question. No smoking gun there.
    – Dave
    Commented May 16 at 14:51

1 Answer 1

1

envman is the culprit.

There is a file ~/.config/envman/PATH.env which contains the PATH modifications and gets sourced by the ~/.config/envman/load.sh script.

Now, since I never asked for, nor really want/need to use envman I need to figure out if it is safe to get rid of it...

1
  • 1
    did you ever install "Bitrise" or "pathman"? those 2 install envman. Not sure about others :P
    – Rinzwind
    Commented May 16 at 16:33

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .