1

Anaconda incorrectly overwrites the $HOST variable which seems to be caused by this anaconda bug. It exports x86_64-conda_cos6-linux-gnu as the HOST. This probably occurs only when ran inside .bashrc to initialize the terminal. Simply exporting localhost as the host, mostly fixes it e.g.:

# >>> conda initialize >>>
# !! Contents within this block are managed by 'conda init' !!
__conda_setup="$('/home/kmourat/anaconda3/bin/conda' 'shell.bash' 'hook' 2> /dev/null)"
if [ $? -eq 0 ]; then
    eval "$__conda_setup"
else
    if [ -f "/home/kmourat/anaconda3/etc/profile.d/conda.sh" ]; then
        . "/home/kmourat/anaconda3/etc/profile.d/conda.sh"
    else
        export PATH="/home/kmourat/anaconda3/bin:$PATH"
    fi
fi
unset __conda_setup
# <<< conda initialize <<<

# TEMP FIX
export HOST=localhost

But is there a more appropriate way to do this? Something like "re-running" the /etc/hosts?

(This came out when running npm start for a react app and it opened a browser window at http://x86_64-conda_cos6-linux-gnu:3000/ instead of http://localhost:3000/)

  • export HOST=$(hostname) maybe? – steeldriver Jun 13 '19 at 17:27
  • If anaconda's init messes with other environment variables from /etc/hosts does this fix reset them as well (some side-effect maybe?), or it just changes the HOST? Edit: It seems it doesn't, only overwrites the host variable, which doesn't seem better to me as localhost ends up not pointing to same place as $hostname. – Kostas Mouratidis Jun 14 '19 at 05:04
  • Save the value of $HOST before running anaconda in another variable (e.g. $hosttemp) and reassign it afterwards. –  Jun 14 '19 at 18:25
  • The old host only holds "localhost", but I guess this is the correct answer. Even more so since it is simple, and it seems too tedious to check all variables for side-effects. – Kostas Mouratidis Jun 14 '19 at 18:50

0 Answers0