Não é possível executar o python de 32 bits no Ubuntu de 64 bits: erro ao carregar bibliotecas compartilhadas: libutil.so.1

1

Estou tentando executar uma versão de 32 bits do python no Ubuntu 12.04 de 64 bits. Existem alternativas para executar esse binário específico, mas estou mais interessado em entender o que está causando o erro do que em soluções alternativas para ele.

Este é o erro completo que estou recebendo:

/build/toolchain/lin32/python-2.7.1/bin/python: error while loading shared libraries: libutil.so.1: cannot open shared object file: No such file or directory

Eu tenho um amigo que está usando o mesmo sistema para executar ldd em sua máquina para ver o caminho exato da biblioteca que estava faltando:

$ ldd /build/toolchain/lin32/python-2.7.1/bin/python
    linux-gate.so.1 =>  (0xf77c5000)
    libpthread.so.0 => /lib/i386-linux-gnu/libpthread.so.0 (0xf778e000)
    libdl.so.2 => /lib/i386-linux-gnu/libdl.so.2 (0xf7789000)
    libutil.so.1 => /lib/i386-linux-gnu/libutil.so.1 (0xf7784000)
    libm.so.6 => /lib/i386-linux-gnu/libm.so.6 (0xf7758000)
    libc.so.6 => /lib/i386-linux-gnu/libc.so.6 (0xf75ae000)
    /lib/ld-linux.so.2 (0xf77c6000)

No meu sistema, para a linha libutil.so.1, obtenho

libutil.so.1 => not found

O interessante é que eu tenho a mesma biblioteca compartilhada que meu amigo tem em minha máquina:

$ ls /lib/i386-linux-gnu/libutil.so.1 
/lib/i386-linux-gnu/libutil.so.1

Então, se eu tiver a biblioteca, por que o python não pode encontrá-la?

Pode ser interessante notar que o último python funciona bem e até mesmo a versão de 64 bits do python 2.7.1 que está no toolchain funciona bem.

Atualização: Aqui está a saída strace:

$ strace /build/toolchain/lin32/python-2.7.1/bin/python
execve("/build/toolchain/lin32/python-2.7.1/bin/python", ["/build/toolchain/lin32/python-2."...], [/* 46 vars */]) = 0
[ Process PID=6192 runs in 32 bit mode. ]
brk(0)                                  = 0x81b8000
mmap2(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0xfffffffff776d000
access("/etc/ld.so.preload", R_OK)      = -1 ENOENT (No such file or directory)
open("/etc/ld-mfert.so.cache", O_RDONLY) = 3
fstat64(3, {st_mode=S_IFREG|0644, st_size=10518, ...}) = 0
mmap2(NULL, 10518, PROT_READ, MAP_PRIVATE, 3, 0) = 0xfffffffff776a000
close(3)                                = 0
open("/opt/McAfee/runtime/2.0/lib/libpthread.so.0", O_RDONLY) = 3
read(3, "7ELF
$ ls -l /lib*/ld-*.so*
-rwxr-xr-x  1 root root 156872 Nov  1  2012 /lib64/ld-2.12.so
lrwxrwxrwx  1 root root     10 Nov 19  2012 /lib64/ld-linux-x86-64.so.2 -> ld-2.12.so
lrwxrwxrwx  1 root root     20 Nov 19  2012 /lib64/ld-lsb-x86-64.so -> ld-linux-x86-64.so.2
lrwxrwxrwx. 1 root root     20 Oct 25  2012 /lib64/ld-lsb-x86-64.so.3 -> ld-linux-x86-64.so.2
-rwxr-xr-x  1 root root 142472 Nov  1  2012 /lib/ld-2.12.so
lrwxrwxrwx  1 root root     10 Nov 19  2012 /lib/ld-linux.so.2 -> ld-2.12.so
$ cat /etc/ld.so.conf
include /etc/ld.so.conf.d/*.conf
$ for f in /etc/ld.so.conf.d/*; do echo "File: $f"; cat "$f"; done
File: /etc/ld.so.conf.d/i386-linux-gnu_GL.conf
File: /etc/ld.so.conf.d/i686-linux-gnu.conf
# Multiarch support
/lib/i386-linux-gnu
/usr/lib/i386-linux-gnu
/lib/i686-linux-gnu
/usr/lib/i686-linux-gnu
File: /etc/ld.so.conf.d/libc.conf
# libc default configuration
/usr/local/lib
File: /etc/ld.so.conf.d/nvidia_settings.conf
/usr/lib/nvidia-settings
File: /etc/ld.so.conf.d/x86_64-linux-gnu.conf
# Multiarch support
/lib/x86_64-linux-gnu
/usr/lib/x86_64-linux-gnu
File: /etc/ld.so.conf.d/x86_64-linux-gnu_GL.conf
/usr/lib/nvidia-current
/usr/lib32/nvidia-current
File: /etc/ld.so.conf.d/zz_i386-biarch-compat.conf
# Legacy biarch compatibility support
/lib32
/usr/lib32
/build/toolchain/lin32/python-2.7.1/bin/python: error while loading shared libraries: libutil.so.1: cannot open shared object file: No such file or directory
$ ldd /build/toolchain/lin32/python-2.7.1/bin/python
    linux-gate.so.1 =>  (0xf77c5000)
    libpthread.so.0 => /lib/i386-linux-gnu/libpthread.so.0 (0xf778e000)
    libdl.so.2 => /lib/i386-linux-gnu/libdl.so.2 (0xf7789000)
    libutil.so.1 => /lib/i386-linux-gnu/libutil.so.1 (0xf7784000)
    libm.so.6 => /lib/i386-linux-gnu/libm.so.6 (0xf7758000)
    libc.so.6 => /lib/i386-linux-gnu/libc.so.6 (0xf75ae000)
    /lib/ld-linux.so.2 (0xf77c6000)
libutil.so.1 => not found
$ ls /lib/i386-linux-gnu/libutil.so.1 
/lib/i386-linux-gnu/libutil.so.1
$ strace /build/toolchain/lin32/python-2.7.1/bin/python
execve("/build/toolchain/lin32/python-2.7.1/bin/python", ["/build/toolchain/lin32/python-2."...], [/* 46 vars */]) = 0
[ Process PID=6192 runs in 32 bit mode. ]
brk(0)                                  = 0x81b8000
mmap2(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0xfffffffff776d000
access("/etc/ld.so.preload", R_OK)      = -1 ENOENT (No such file or directory)
open("/etc/ld-mfert.so.cache", O_RDONLY) = 3
fstat64(3, {st_mode=S_IFREG|0644, st_size=10518, ...}) = 0
mmap2(NULL, 10518, PROT_READ, MAP_PRIVATE, 3, 0) = 0xfffffffff776a000
close(3)                                = 0
open("/opt/McAfee/runtime/2.0/lib/libpthread.so.0", O_RDONLY) = 3
read(3, "7ELF
$ ls -l /lib*/ld-*.so*
-rwxr-xr-x  1 root root 156872 Nov  1  2012 /lib64/ld-2.12.so
lrwxrwxrwx  1 root root     10 Nov 19  2012 /lib64/ld-linux-x86-64.so.2 -> ld-2.12.so
lrwxrwxrwx  1 root root     20 Nov 19  2012 /lib64/ld-lsb-x86-64.so -> ld-linux-x86-64.so.2
lrwxrwxrwx. 1 root root     20 Oct 25  2012 /lib64/ld-lsb-x86-64.so.3 -> ld-linux-x86-64.so.2
-rwxr-xr-x  1 root root 142472 Nov  1  2012 /lib/ld-2.12.so
lrwxrwxrwx  1 root root     10 Nov 19  2012 /lib/ld-linux.so.2 -> ld-2.12.so
$ cat /etc/ld.so.conf
include /etc/ld.so.conf.d/*.conf
$ for f in /etc/ld.so.conf.d/*; do echo "File: $f"; cat "$f"; done
File: /etc/ld.so.conf.d/i386-linux-gnu_GL.conf
File: /etc/ld.so.conf.d/i686-linux-gnu.conf
# Multiarch support
/lib/i386-linux-gnu
/usr/lib/i386-linux-gnu
/lib/i686-linux-gnu
/usr/lib/i686-linux-gnu
File: /etc/ld.so.conf.d/libc.conf
# libc default configuration
/usr/local/lib
File: /etc/ld.so.conf.d/nvidia_settings.conf
/usr/lib/nvidia-settings
File: /etc/ld.so.conf.d/x86_64-linux-gnu.conf
# Multiarch support
/lib/x86_64-linux-gnu
/usr/lib/x86_64-linux-gnu
File: /etc/ld.so.conf.d/x86_64-linux-gnu_GL.conf
/usr/lib/nvidia-current
/usr/lib32/nvidia-current
File: /etc/ld.so.conf.d/zz_i386-biarch-compat.conf
# Legacy biarch compatibility support
/lib32
/usr/lib32
%pre%%pre%%pre%%pre%%pre%%pre%%pre%%pre%%pre%%pre%%pre%%pre%%pre%0A%pre%%pre%04%pre%%pre%%pre%"..., 512) = 512 fstat64(3, {st_mode=S_IFREG|0755, st_size=60992, ...}) = 0 mmap2(NULL, 332928, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0xfffffffff7718000 mmap2(0xf7726000, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0xd) = 0xfffffffff7726000 mmap2(0xf7728000, 267392, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0xfffffffff7728000 close(3) = 0 open("/opt/McAfee/runtime/2.0/lib/libdl.so.2", O_RDONLY) = 3 read(3, "7ELF%pre%%pre%%pre%%pre%%pre%%pre%%pre%%pre%%pre%%pre%%pre%%pre%%pre%%pre%0\v%pre%%pre%04%pre%%pre%%pre%"..., 512) = 512 fstat64(3, {st_mode=S_IFREG|0755, st_size=9892, ...}) = 0 mmap2(NULL, 12400, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0xfffffffff7714000 mmap2(0xf7716000, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x1) = 0xfffffffff7716000 close(3) = 0 open("/lib/tls/i686/sse2/libutil.so.1", O_RDONLY) = -1 ENOENT (No such file or directory) stat64("/lib/tls/i686/sse2", 0xff8a0924) = -1 ENOENT (No such file or directory) open("/lib/tls/i686/libutil.so.1", O_RDONLY) = -1 ENOENT (No such file or directory) stat64("/lib/tls/i686", 0xff8a0924) = -1 ENOENT (No such file or directory) open("/lib/tls/sse2/libutil.so.1", O_RDONLY) = -1 ENOENT (No such file or directory) stat64("/lib/tls/sse2", 0xff8a0924) = -1 ENOENT (No such file or directory) open("/lib/tls/libutil.so.1", O_RDONLY) = -1 ENOENT (No such file or directory) stat64("/lib/tls", 0xff8a0924) = -1 ENOENT (No such file or directory) open("/lib/i686/sse2/libutil.so.1", O_RDONLY) = -1 ENOENT (No such file or directory) stat64("/lib/i686/sse2", 0xff8a0924) = -1 ENOENT (No such file or directory) open("/lib/i686/libutil.so.1", O_RDONLY) = -1 ENOENT (No such file or directory) stat64("/lib/i686", 0xff8a0924) = -1 ENOENT (No such file or directory) open("/lib/sse2/libutil.so.1", O_RDONLY) = -1 ENOENT (No such file or directory) stat64("/lib/sse2", 0xff8a0924) = -1 ENOENT (No such file or directory) open("/lib/libutil.so.1", O_RDONLY) = -1 ENOENT (No such file or directory) stat64("/lib", {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0 open("/usr/lib/tls/i686/sse2/libutil.so.1", O_RDONLY) = -1 ENOENT (No such file or directory) stat64("/usr/lib/tls/i686/sse2", 0xff8a0924) = -1 ENOENT (No such file or directory) open("/usr/lib/tls/i686/libutil.so.1", O_RDONLY) = -1 ENOENT (No such file or directory) stat64("/usr/lib/tls/i686", 0xff8a0924) = -1 ENOENT (No such file or directory) open("/usr/lib/tls/sse2/libutil.so.1", O_RDONLY) = -1 ENOENT (No such file or directory) stat64("/usr/lib/tls/sse2", 0xff8a0924) = -1 ENOENT (No such file or directory) open("/usr/lib/tls/libutil.so.1", O_RDONLY) = -1 ENOENT (No such file or directory) stat64("/usr/lib/tls", 0xff8a0924) = -1 ENOENT (No such file or directory) open("/usr/lib/i686/sse2/libutil.so.1", O_RDONLY) = -1 ENOENT (No such file or directory) stat64("/usr/lib/i686/sse2", 0xff8a0924) = -1 ENOENT (No such file or directory) open("/usr/lib/i686/libutil.so.1", O_RDONLY) = -1 ENOENT (No such file or directory) stat64("/usr/lib/i686", 0xff8a0924) = -1 ENOENT (No such file or directory) open("/usr/lib/sse2/libutil.so.1", O_RDONLY) = -1 ENOENT (No such file or directory) stat64("/usr/lib/sse2", 0xff8a0924) = -1 ENOENT (No such file or directory) open("/usr/lib/libutil.so.1", O_RDONLY) = -1 ENOENT (No such file or directory) stat64("/usr/lib", {st_mode=S_IFDIR|0755, st_size=36864, ...}) = 0 writev(2, [{"/build/toolchain/lin32/python-2."..., 46}, {": ", 2}, {"error while loading shared libra"..., 36}, {": ", 2}, {"libutil.so.1", 12}, {": ", 2}, {"cannot open shared object file", 30}, {": ", 2}, {"No such file or directory", 25}, {"\n", 1}], 10/build/toolchain/lin32/python-2.7.1/bin/python: error while loading shared libraries: libutil.so.1: cannot open shared object file: No such file or directory ) = 158 exit_group(127) = ?
%pre%%pre%%pre%%pre%%pre%%pre%%pre%%pre%0A%pre%%pre%04%pre%%pre%%pre%"..., 512) = 512 fstat64(3, {st_mode=S_IFREG|0755, st_size=60992, ...}) = 0 mmap2(NULL, 332928, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0xfffffffff7718000 mmap2(0xf7726000, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0xd) = 0xfffffffff7726000 mmap2(0xf7728000, 267392, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0xfffffffff7728000 close(3) = 0 open("/opt/McAfee/runtime/2.0/lib/libdl.so.2", O_RDONLY) = 3 read(3, "7ELF%pre%%pre%%pre%%pre%%pre%%pre%%pre%%pre%%pre%%pre%%pre%%pre%%pre%%pre%0\v%pre%%pre%04%pre%%pre%%pre%"..., 512) = 512 fstat64(3, {st_mode=S_IFREG|0755, st_size=9892, ...}) = 0 mmap2(NULL, 12400, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0xfffffffff7714000 mmap2(0xf7716000, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x1) = 0xfffffffff7716000 close(3) = 0 open("/lib/tls/i686/sse2/libutil.so.1", O_RDONLY) = -1 ENOENT (No such file or directory) stat64("/lib/tls/i686/sse2", 0xff8a0924) = -1 ENOENT (No such file or directory) open("/lib/tls/i686/libutil.so.1", O_RDONLY) = -1 ENOENT (No such file or directory) stat64("/lib/tls/i686", 0xff8a0924) = -1 ENOENT (No such file or directory) open("/lib/tls/sse2/libutil.so.1", O_RDONLY) = -1 ENOENT (No such file or directory) stat64("/lib/tls/sse2", 0xff8a0924) = -1 ENOENT (No such file or directory) open("/lib/tls/libutil.so.1", O_RDONLY) = -1 ENOENT (No such file or directory) stat64("/lib/tls", 0xff8a0924) = -1 ENOENT (No such file or directory) open("/lib/i686/sse2/libutil.so.1", O_RDONLY) = -1 ENOENT (No such file or directory) stat64("/lib/i686/sse2", 0xff8a0924) = -1 ENOENT (No such file or directory) open("/lib/i686/libutil.so.1", O_RDONLY) = -1 ENOENT (No such file or directory) stat64("/lib/i686", 0xff8a0924) = -1 ENOENT (No such file or directory) open("/lib/sse2/libutil.so.1", O_RDONLY) = -1 ENOENT (No such file or directory) stat64("/lib/sse2", 0xff8a0924) = -1 ENOENT (No such file or directory) open("/lib/libutil.so.1", O_RDONLY) = -1 ENOENT (No such file or directory) stat64("/lib", {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0 open("/usr/lib/tls/i686/sse2/libutil.so.1", O_RDONLY) = -1 ENOENT (No such file or directory) stat64("/usr/lib/tls/i686/sse2", 0xff8a0924) = -1 ENOENT (No such file or directory) open("/usr/lib/tls/i686/libutil.so.1", O_RDONLY) = -1 ENOENT (No such file or directory) stat64("/usr/lib/tls/i686", 0xff8a0924) = -1 ENOENT (No such file or directory) open("/usr/lib/tls/sse2/libutil.so.1", O_RDONLY) = -1 ENOENT (No such file or directory) stat64("/usr/lib/tls/sse2", 0xff8a0924) = -1 ENOENT (No such file or directory) open("/usr/lib/tls/libutil.so.1", O_RDONLY) = -1 ENOENT (No such file or directory) stat64("/usr/lib/tls", 0xff8a0924) = -1 ENOENT (No such file or directory) open("/usr/lib/i686/sse2/libutil.so.1", O_RDONLY) = -1 ENOENT (No such file or directory) stat64("/usr/lib/i686/sse2", 0xff8a0924) = -1 ENOENT (No such file or directory) open("/usr/lib/i686/libutil.so.1", O_RDONLY) = -1 ENOENT (No such file or directory) stat64("/usr/lib/i686", 0xff8a0924) = -1 ENOENT (No such file or directory) open("/usr/lib/sse2/libutil.so.1", O_RDONLY) = -1 ENOENT (No such file or directory) stat64("/usr/lib/sse2", 0xff8a0924) = -1 ENOENT (No such file or directory) open("/usr/lib/libutil.so.1", O_RDONLY) = -1 ENOENT (No such file or directory) stat64("/usr/lib", {st_mode=S_IFDIR|0755, st_size=36864, ...}) = 0 writev(2, [{"/build/toolchain/lin32/python-2."..., 46}, {": ", 2}, {"error while loading shared libra"..., 36}, {": ", 2}, {"libutil.so.1", 12}, {": ", 2}, {"cannot open shared object file", 30}, {": ", 2}, {"No such file or directory", 25}, {"\n", 1}], 10/build/toolchain/lin32/python-2.7.1/bin/python: error while loading shared libraries: libutil.so.1: cannot open shared object file: No such file or directory ) = 158 exit_group(127) = ?

Pedido de produção por Gilles:

%pre%     
por gsingh2011 29.05.2013 / 20:35

1 resposta

2

Usando apt-file :

$  apt-file search  libutil.so.1
libc6: /lib/x86_64-linux-gnu/libutil.so.1
libc6-armel-cross: /usr/arm-linux-gnueabi/lib/libutil.so.1
libc6-armhf-cross: /usr/arm-linux-gnueabihf/lib/libutil.so.1
libc6-i386: /lib32/libutil.so.1

Portanto, instalar libc6-i386 deve resolver seu problema.

$ sudo apt-get install libc6-i386

Se ainda assim não funcionar, você pode tentar criar um link simbólico (faça o backup do arquivo antigo anteriormente!):

$ sudo ln -s /lib32/libutil.so.1 /lib/i386-linux-gnu/libutil.so.1
    
por 29.05.2013 / 22:58