Debian

使用 sudo apt 重定位錯誤

  • July 9, 2021

我的系統架構是amd64,我將i386安裝為外部架構並執行sudo apt dist-upgrade,但完成後,我在使用 apt 時不斷收到此錯誤:

apt-get: 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

即使我使用 aptitude:

aptitude: relocation error: aptitude: symbol ZN3URIcvNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEB5cxx11Ev version APTPKG_5.0 not defined in file libapt-pkg.so.5.0 with link time reference

任何解決方案?

這是錯誤 #911090。要解決這個問題,您需要確保aptlibapt-pkg5.0包保持同步;您可能需要從本頁頂部的連結開始手動下載它們。我不確定是否有修復方法aptitude

即使現在是 2021 年,我也遇到了類似的情況,我發布了我在 Ubuntu 18.04(顯然以前是 Ubuntu 16.04)系統上發現的內容。看起來使用者在 /usr/local/ 中安裝了一個看起來像另一個版本的 Ubuntu,並且“apt-get”二進製文件試圖使用錯誤的 libapt-private.so.0.0。我清理了 /usr/local/ 並 apt-get 重新開始工作。希望這將在未來節省一些時間:

# apt-get update
apt-get: relocation error: apt-get: symbol _Z15InstallPackagesR9CacheFilebbbRKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEERK11CommandLine version APTPRIVATE_0.0 not defined in file libapt-private.so.0.0 with link time reference
# 
# locate libapt-private.so.0.0
/usr/lib/x86_64-linux-gnu/libapt-private.so.0.0
/usr/lib/x86_64-linux-gnu/libapt-private.so.0.0.0
/usr/local/lib/x86_64-linux-gnu/libapt-private.so.0.0
/usr/local/lib/x86_64-linux-gnu/libapt-private.so.0.0.0
# 
# ls -l /usr/local
total 104
drwxr-xr-x   2 root root 65536 Jul  7 19:30 bin
drwxr-xr-x   5 root root  4096 Jul  7 14:35 DELETEME
drwxr-xr-x   2 root root  4096 Jul 24  2018 etc
drwxr-xr-x   2 root root  4096 Jul 24  2018 games
drwxr-xr-x   2 root root  4096 Jul 24  2018 include
drwxr-xr-x 153 root root  4096 Sep 22  2020 lib
lrwxrwxrwx   1 root root     9 Sep 17  2018 man -> share/man
drwxr-xr-x   3 root root  4096 Jun  6  2007 opteronkiller
drwxr-xr-x   2 root root  4096 Sep 17  2018 sbin
drwxr-xr-x  13 root root  4096 Oct 20  2020 share
drwxr-xr-x   2 root root  4096 Jul 24  2018 src
# 
# 
# mv /usr/local/lib /usr/local/lib-foo
# ls -l /usr/local
total 104
drwxr-xr-x   2 root root 65536 Jul  7 19:30 bin
drwxr-xr-x   5 root root  4096 Jul  7 14:35 DELETEME
drwxr-xr-x   2 root root  4096 Jul 24  2018 etc
drwxr-xr-x   2 root root  4096 Jul 24  2018 games
drwxr-xr-x   2 root root  4096 Jul 24  2018 include
drwxr-xr-x 153 root root  4096 Sep 22  2020 lib-foo
lrwxrwxrwx   1 root root     9 Sep 17  2018 man -> share/man
drwxr-xr-x   3 root root  4096 Jun  6  2007 opteronkiller
drwxr-xr-x   2 root root  4096 Sep 17  2018 sbin
drwxr-xr-x  13 root root  4096 Oct 20  2020 share
drwxr-xr-x   2 root root  4096 Jul 24  2018 src
# 
# apt-get update
Hit:1 http://security.ubuntu.com/ubuntu bionic-security InRelease
Hit:2 http://us.archive.ubuntu.com/ubuntu bionic InRelease                                                           
Ign:3 http://developer.download.nvidia.com/compute/cuda/repos/ubuntu1804/x86_64  InRelease                           
Hit:4 http://us.archive.ubuntu.com/ubuntu bionic-updates InRelease                             
Hit:5 http://developer.download.nvidia.com/compute/cuda/repos/ubuntu1804/x86_64  Release       
Hit:6 http://us.archive.ubuntu.com/ubuntu bionic-backports InRelease                           
Hit:7 http://archive.canonical.com/ubuntu bionic InRelease                                     
Hit:9 http://ppa.launchpad.net/graphics-drivers/ppa/ubuntu bionic InRelease
Reading package lists... Done
# 

因此,apt-get自 9 月 20 日以 root 身份執行的使用者安裝了/usr/local/lib. 這已經恢復apt-get了系統需要的功能……不確定它對使用者的應用程序造成了什麼破壞。那是另一天的故事。

引用自:https://unix.stackexchange.com/questions/476684