Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

the CUDA installation tutorial tells me to add the following two lines to my .bash_profile.

export PATH=/usr/local/cuda/bin:$PATH
export LD_LIBRARY_PATH=/usr/local/cuda/lib64:$LD_LIBRARY_PATH

But it does not work (TM). Even if I add these lines to .bash_profile and .bashrc, I still have to enter the exports manually, for the paths to be found.

So my question. What could be a reason for .bash_profile and .bashrc not to load/execute the exports?

Thanks!!

p.s. I ssh into the machine and it is, apart from the CUDA drive and sdk, a fresh Ubuntu 10.10 installation.

p.p.s. The fresh installation did not have a .bash_profile in the first place. nano ~/.bash_profile was empty

share|improve this question
1  
You wrote bash_profile and bashrc, but the files in your home directory should be .bash_profile and .bashrc (with a dot as the first letter). If that was only a typo in your post, please edit it. ~/.bash_profile is only sourced for login shells, you probably want to use ~/.bashrc. For the details please have a look in the wiki. –  elmicha Jun 15 '11 at 18:56
    
Hi @elmicha,thank you very much for the point!!! I corrected all .bashrc and .bash_profile –  Framester Jun 15 '11 at 19:34
2  
Can you verify that these lines are (not) being executed? E.g. try "echo $PATH" to check the value of it. Also, read up when bash_profile and bashrc are being executed (superuser.com/questions/183870/…) –  DrSAR Jun 15 '11 at 20:14
    
Hi DrSAR. I added echo $PATH to the .profile, but I could not see any effect. Should I see something when I log in? –  Framester Jun 16 '11 at 14:58
1  
Please be advised that setting ld_library_path in .profile, /etc/profile or /etc/environment doesn't work due to bug 366728 ( bugs.launchpad.net/bugs/366728 ) –  papukaija Jun 25 '11 at 17:59
add comment

1 Answer 1

up vote 4 down vote accepted

When you log in graphically in Ubuntu, .bash_profile will not be read, but .profile will (sourced by sh). So if you put those exports in .profile, then log in again, the environment variables should be available.

Also see http://mywiki.wooledge.org/DotFiles and https://help.ubuntu.com/community/EnvironmentVariables

share|improve this answer
    
Would the exports also be read from the .bashrc? –  Framester Jun 16 '11 at 11:18
    
Adding to .profile worked. –  Framester Jun 16 '11 at 14:57
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.