I’m trying to bootstrap Gentoo Prefix and I’m hitting a snag because Prefix insists that LD_LIBRARY_PATH is unset in a login shell.

So I put unset LD_LIBRARY_PATH at the very end of both my ~/.bash_profile and ~/.bashrc.

Good. Now it’s unset in a normal shell. However, in a login shell it’s still set: :-(

⟩⟩⟩ echo $SHELL
⟩⟩⟩ env -i $SHELL <<< 'env | grep LD'
⟩⟩⟩ env -i $SHELL -l <<< 'env | grep LD'

How is this even possible (I thought site configuration would be loaded before user configuration), and, more importantly, how do I prevent it?

I should note that this is on a cluster system, with two consequences:

  1. I don’t have super user rights.
  2. Some of the system configuration is a bit … special. So if it’s technically possible then I wouldn’t be surprised if the sysadmin overrode user config. But from my understanding of the Bash loading process this shouldn’t be possible (short of patching /bin/bash).

migrated from askubuntu.com Feb 7 '17 at 19:42

This question came from our site for Ubuntu users and developers.

  • You could try to put in .profile – janos Feb 2 '17 at 18:19
  • @janos According to my understanding, ~/.profile is only read by Bash if ~/.bash_profile doesn’t exist. I tried it regardless; no difference. – Konrad Rudolph Feb 2 '17 at 18:37

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.