Debian

由於 Debian 升級後缺少 libstdc++,Apt 無法工作:“找不到`GLIBCXX_3.4.15’(apt-get 需要)”

  • February 21, 2018

我試圖從 Debian 6 升級到 7.11 (wheezy)。我已將 sources.list 更改為:

deb http://ftp.debian.org/debian/ wheezy main contrib non-free

deb-src http://ftp.debian.org/debian/ wheezy main



deb http://security.debian.org/ wheezy/updates main contrib non-free

deb-src http://security.debian.org/ wheezy/updates main



deb http://ftp.debian.org/debian/ wheezy-updates main contrib non-free

deb-src http://ftp.debian.org/debian/ wheezy-updates main



deb http://ftp.debian.org/debian/ wheezy-backports main contrib non-free

並由 apt-get update 開始,然後是 apt-get upgrade,最後是 apt-get dist-upgrade

在所有這些步驟之後,我在文件 /etc/debian_version 值 7.11 中得到了但是由於以下錯誤我不能使用 apt 做任何事情:

root@server:~# apt-get dist-upgrade

apt-get: /usr/local/lib/libstdc++.so.6: version `GLIBCXX_3.4.15' not found (required by apt-get)

apt-get: /usr/local/lib/libstdc++.so.6: version `GLIBCXX_3.4.15' not found (required by /usr/lib/x86_64-linux-gnu/libapt-pkg.so.4.12)



root@server:~# apt-get update

apt-get: /usr/local/lib/libstdc++.so.6: version `GLIBCXX_3.4.15' not found (required by apt-get)

apt-get: /usr/local/lib/libstdc++.so.6: version `GLIBCXX_3.4.15' not found (required by /usr/lib/x86_64-linux-gnu/libapt-pkg.so.4.12)

您有一份優先於系統副本(在其子目錄或其子目錄之一中)使用的libstdc++.so.6副本。要重新開始工作,您需要刪除它或至少重命名它:/usr/local/lib``/usr/lib``apt

sudo mv /usr/local/lib/libstdc++.so.6{,.old}

您還應該將文件libstdc++.so.6點重命名為;完成上述操作後,執行:

tgt=$(readlink /usr/local/lib/libstdc++.so.6.old)
sudo mv "/usr/local/lib/${tgt}"{,.old}

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