缺少可执行文件上的动态库,但仅在以sudo身份运行时

时间:2012-11-30 19:30:36

标签: linux shared-libraries

我很困惑为什么libiconv.so.2libcharset.so.1都找不到,但只有当我向不同的用户说话时才会这样。 LD_LIBRARY_PATH完全相同,因为我用-E:

运行了sudo
$ ldd `which git`
    linux-vdso.so.1 =>  (0x00007fff51975000)
    libz.so.1 => /usr/lib64/libz.so.1 (0x0000003e60600000)
    libiconv.so.2 => /internal/lib/libiconv.so.2 (0x00007f0962bdd000)
    libcrypto.so.6 => /lib64/libcrypto.so.6 (0x0000003e6a400000)
    libcharset.so.1 => /internal/lib/libcharset.so.1 (0x00007f09629db000)
    libpthread.so.0 => /lib64/libpthread.so.0 (0x0000003e61600000)
    libc.so.6 => /lib64/libc.so.6 (0x0000003e60a00000)
    libdl.so.2 => /lib64/libdl.so.2 (0x0000003e61200000)
    /lib64/ld-linux-x86-64.so.2 (0x0000003e60200000)
$ sudo -ucgaadm -EH ldd `which git`
    linux-vdso.so.1 =>  (0x00007fff5b148000)
    libz.so.1 => /usr/lib64/libz.so.1 (0x0000003e60600000)
    libiconv.so.2 => not found
    libcrypto.so.6 => /lib64/libcrypto.so.6 (0x0000003e6a400000)
    libcharset.so.1 => not found
    libpthread.so.0 => /lib64/libpthread.so.0 (0x0000003e61600000)
    libc.so.6 => /lib64/libc.so.6 (0x0000003e60a00000)
    libdl.so.2 => /lib64/libdl.so.2 (0x0000003e61200000)
    /lib64/ld-linux-x86-64.so.2 (0x0000003e60200000)

只需检查LD_LIBRARY_PATH,似乎libiconv.so.2的路径确实存在:

$ echo $LD_LIBRARY_PATH
...
$ sudo -ucgaadm -EH echo $LD_LIBRARY_PATH
... same output as previous command ...

我的常规用户以及sudo用户也可以看到应该包含这些库的目录:

$ ls /internal/lib/ -lah
total 2.5M
drwxr-xr-x 2 apsg apsggrp 4.0K Jan 31  2010 .
drwxr-xr-x 6 apsg apsggrp 4.0K Jan 31  2010 ..
-rw-r--r-- 1 apsg apsggrp  212 Jan 31  2010 charset.alias
-rw-r--r-- 1 apsg apsggrp  24K Jan 31  2010 libcharset.a
-rw-r--r-- 1 apsg apsggrp  993 Jan 31  2010 libcharset.la
lrwxrwxrwx 1 apsg apsggrp   19 Jan 31  2010 libcharset.so -> libcharset.so.1.0.0
lrwxrwxrwx 1 apsg apsggrp   19 Jan 31  2010 libcharset.so.1 -> libcharset.so.1.0.0
-rw-r--r-- 1 apsg apsggrp  24K Jan 31  2010 libcharset.so.1.0.0
-rw-r--r-- 1 apsg apsggrp  969 Jan 31  2010 libiconv.la
lrwxrwxrwx 1 apsg apsggrp   17 Jan 31  2010 libiconv.so -> libiconv.so.2.5.0
lrwxrwxrwx 1 apsg apsggrp   17 Jan 31  2010 libiconv.so.2 -> libiconv.so.2.5.0
-rw-r--r-- 1 apsg apsggrp 1.2M Jan 31  2010 libiconv.so.2.5.0
-rw-r--r-- 1 apsg apsggrp 1.2M Jan 31  2010 preloadable_libiconv.so
$ sudo -ucgaadm -EH ls /internal/lib/ -lah
... same output as previous command ...

1 个答案:

答案 0 :(得分:0)

尝试“sudo su - ”然后运行你的命令 “ - ”更改为root用户并创建一个新shell。