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.

 

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章