I'm having a hard time getting my brain wrapped around how LD_LIBRARY_PATH is handled differently for the following three cases:
- run as a regular user
- run via "sudo command"
- run via "sudo bash" followed in the root shell by "command"
My particular problem is that a binary I'm trying to run (called dc_full) requires sudo access, but throws the following error when run as "sudo command":
ljw@test$ sudo ./dc_full
./dc_full: error while loading shared libraries: libthrift-0.9.1.so: cannot open shared object file: No such file or directory
ljw@test$ sudo bash
root@ljw-vm1:~/test# ./dc_full
.
...<works fine here!>
.
I have the following line in both /etc/bash.bashrc and in ~/.bashrc for user ljw.
root@ljw-vm1:~# grep LD_LIBRARY ~/.bashrc
export LD_LIBRARY_PATH=$http://LD_LIBRARY_PATH:/usr/local/lib
root@ljw-vm1:~# grep LD_LIBRARY /etc/bash.bashrc
export LD_LIBRARY_PATH=$http://LD_LIBRARY_PATH:/usr/local/lib
I would expect that this covers both the sudo and sudo-bash cases, one covers the user shell and one covers the "root" shell. But clearly this is not happening.
I found references to ldd, which gives me a big hint that it's not working, but not quite WHY...
root@ljw-vm1:~/dc_full# ldd ./dc_full | grep thrift
libthrift-0.9.1.so => /usr/local/lib/libthrift-0.9.1.so (0x00007eff19e7c000)
ljw@ljw-vm1:~/dc_full$ ldd ./dc_full | grep thrift
libthrift-0.9.1.so => /usr/local/lib/libthrift-0.9.1.so (0x00007f8340cc5000)
ljw@ljw-vm1:~/dc_full$ sudo ldd ./dc_full | grep thrift
[sudo] password for ljw:
libthrift-0.9.1.so => not found
SO the question, in summary, is what does "sudo command" use to get the LD_LIBRARY_PATH setting if it's not the user bashrc NOR the system default bashrc???
Aucun commentaire:
Enregistrer un commentaire