無法使用 apt:libstdc++.so.6:找不到版本“GLIBCXX_3.4.20”

無法使用 apt:libstdc++.so.6:找不到版本“GLIBCXX_3.4.20”

當我使用 apt 時,我遇到了問題:

$ sudo apt-get update
apt-get: /usr/lib/x86_64-linux-gnu/libstdc++.so.6: version `GLIBCXX_3.4.20' not found (required by apt-get) apt-get: /usr/lib/x86_64-linux-gnu/libstdc++.so.6: version `GLIBCXX_3.4.20' not found (required by /usr/lib/x86_64-linux-gnu/libapt-private.so.0.0)

但是,安裝新的 apt 輸出:

dpkg: regarding .../apt_1.2.10ubuntu1_amd64.deb containing apt:
apt breaks apt-utils (<< 1.1.3)
apt-utils (version 1.0.1ubuntu2) is present and installed.

dpkg: error processing archive /home/anawasreh/Downloads/apt_1.2.10ubuntu1_amd64.deb (--install):
 installing apt would break apt-utils, and
 deconfiguration is not permitted (--auto-deconfigure might help)
Errors were encountered while processing:
 /home/anawasreh/Downloads/apt_1.2.10ubuntu1_amd64.deb
(13:13:21)anawasreh@readonly@anawasreh(-)

即使我嘗試下載遺失的庫:

$ sudo apt-get install libstdc++6

apt-get: /usr/lib/x86_64-linux-gnu/libstdc++.so.6: version
`GLIBCXX_3.4.20' not found (required by apt-get) apt-get:
/usr/lib/x86_64-linux-gnu/libstdc++.so.6: version `GLIBCXX_3.4.20' not
found (required by /usr/lib/x86_64-linux-gnu/libapt-private.so.0.0)

所以我被困在那裡,根本無法刪除、更新或更正 apt。

答案1

您可以libstdc++.so.6從另一個 Ubuntu 安裝中複製。

在14.04虛擬機中,我刪除libstdc++.so.6並得到了與你相同的錯誤。然後我從我的 16.04 主機複製它,然後apt再次工作。為此,您可以使用 Live CD。

或者,下載適合您的版本的正確檔案:

14.04https://bsre.stackstorage.com/index.php/s/JVNxNO3HWBA4HSa
16.04https://bsre.stackstorage.com/index.php/s/L394ttygh55cR1W

然後使用++Cntrl開啟終端機窗口AltT

  1. 輸入cd ~/Downloads並按 Enter 鍵
  2. 輸入md5sum libstdc++*並按 Enter 鍵
  3. 確保您看到以下任一內容:

    aa688ac2f4c90a023c2cbd1dd21d4ccc libstdc++1404.so.6 68dbd855c3213cae1a41375c25bf6884 libstdc++1604.so.6

  4. 然後使用重新命名該文件sudo mv libstdc++* libstdc++.so.6
  5. 移動文件:sudo mv libstdc++.so.6 /usr/lib/x86_64-linux-gnu/

答案2

這有點複雜,我不記得遇到這個問題時我到底做了什麼。

也許這可以幫助:

sudo add-apt-repository ppa:ubuntu-toolchain-r/test
sudo apt-get update

如果您沒有安裝 python 軟體屬性,這可能不起作用。

因此,請嘗試將您的儲存庫和 PPA 更新為預設值。請點擊此連結了解如何操作:如何恢復預設儲存庫?

答案3

我之前也遇到過同樣的問題。我透過下載 libstdc++6 debian 套件來修復它這裡後來使用“dpkg”進行了手動安裝

sudo dpkg -i libstdc++6_5.4.0-6ubuntu1~16.04.1_i386.deb

在此之後它工作正常

相關內容