apt-get: relocation error:/libapt-private.so.0.0 version APTPKG_5.0 not defined in file libapt-pkg

ubuntu16.04

完整错误:

apt-get: relocation error: /usr/lib/x86_64-linux-gnu/libapt-private.so.0.0: symbol _ZlsRSoRKN3APT9PrettyPkgE version APTPKG_5.0 not defined in file libapt-pkg.so.5.0 with link time reference

apt: relocation error: /usr/lib/x86_64-linux-gnu/libapt-private.so.0.0: symbol _ZN3URIcvNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEB5cxx11Ev version APTPKG_5.0 not defined in file libapt-pkg.so.5.0 with link time reference

 

解决:

查看相关文件:
root@test1:/usr/lib/x86_64-linux-gnu# ll libapt-*
lrwxrwxrwx 1 root root      20 Aug 20 15:48 libapt-inst.so.2.0 -> libapt-inst.so.2.0.0
-rw-r--r-- 1 root root   51280 Aug 20 15:48 libapt-inst.so.2.0.0
lrwxrwxrwx 1 root root      19 Dec 14 10:02 libapt-pkg.so.5.0 -> libapt-pkg.so.5.0.2
-rw-r--r-- 1 root root 1854776 Oct  7 13:56 libapt-pkg.so.5.0.2
lrwxrwxrwx 1 root root      23 Oct 18 06:31 libapt-private.so.0.0 -> libapt-private.so.0.0.0
-rw-r--r-- 1 root root  337984 Oct 18 06:35 libapt-private.so.0.0.0

删除或改名
root@test1:/usr/lib/x86_64-linux-gnu# mv libapt-inst.so.2.0{,.bak}

、、、、、、、、

 

从另一台正常的主机拉取这些文件

问题主机:
root@test1:/usr/lib/x86_64-linux-gnu# uname -r
4.4.0-116-generic


正常主机:
root@test2:/usr/lib/x86_64-linux-gnu# uname -r
4.4.0-130-generic

root@test1:/usr/lib/x86_64-linux-gnu# scp [email protected]:/usr/lib/x86_64-linux-gnu/libapt-* ./   (ERROR不用管)
ERROR: ld.so: object 'libapt-pkg.so.5.0' from LD_PRELOAD cannot be preloaded (cannot open shared object file): ignored.
ERROR: ld.so: object 'libapt-pkg.so.5.0' from LD_PRELOAD cannot be preloaded (cannot open shared object file): ignored.
bash: warning: setlocale: LC_ALL: cannot change locale (zh_CN.UTF-8)
libapt-inst.so.2.0                                                                                                 100%   50KB  50.1KB/s   00:00    
libapt-inst.so.2.0.0                                                                                               100%   50KB  50.1KB/s   00:00    
libapt-pkg.so.5.0                                                                                                  100% 1475KB   1.4MB/s   00:00    
libapt-pkg.so.5.0.0                                                                                                100% 1475KB   1.4MB/s   00:00    
libapt-private.so.0.0                                                                                              100%  330KB 330.1KB/s   00:00    
libapt-private.so.0.0.0                                                                                            100%  330KB 330.1KB/s   00:00    
 

结果:
root@test1:/usr/lib/x86_64-linux-gnu# ll libapt-*
-rw-r--r-- 1 root root   51256 Dec 14 10:07 libapt-inst.so.2.0  《==请手动改成软连接
-rw-r--r-- 1 root root   51256 Dec 14 10:07 libapt-inst.so.2.0.0
-rw-r--r-- 1 root root   51280 Aug 20 15:48 libapt-inst.so.2.0.0.bak
lrwxrwxrwx 1 root root      20 Aug 20 15:48 libapt-inst.so.2.0.bak -> libapt-inst.so.2.0.0
-rw-r--r-- 1 root root 1510376 Dec 14 10:07 libapt-pkg.so.5.0  《==请手动改成软连接
-rw-r--r-- 1 root root 1510376 Dec 14 10:07 libapt-pkg.so.5.0.0
-rw-r--r-- 1 root root 1854776 Oct  7 13:56 libapt-pkg.so.5.0.2
lrwxrwxrwx 1 root root      19 Dec 14 10:02 libapt-pkg.so.5.0.bak -> libapt-pkg.so.5.0.2
-rw-r--r-- 1 root root  337984 Dec 14 10:07 libapt-private.so.0.0  《==请手动改成软连接
-rw-r--r-- 1 root root  337984 Dec 14 10:07 libapt-private.so.0.0.0
-rw-r--r-- 1 root root  337984 Oct 18 06:35 libapt-private.so.0.0.0.bak
lrwxrwxrwx 1 root root      23 Oct 18 06:31 libapt-private.so.0.0.bak -> libapt-private.so.0.0.0

恢复正常:
root@test1:/usr/lib/x86_64-linux-gnu# apt
apt 1.2.15 (amd64)
Usage: apt [options] command

apt is a commandline package manager and provides commands for
searching and managing as well as querying information about packages.
It provides the same functionality as the specialized APT tools,
like apt-get and apt-cache, but enables options more suitable for
interactive use by default.

 

 

你可能感兴趣的:(运维,系统,relocation,error,ubuntu16.04,apt-get,libapt)