Debian升级后因缺失libstdc++导致Apt失效:找不到GLIBCXX_3.4.15
Hey there, I’ve run into this exact snag before when upgrading from Debian 6 to 7.11—this error pops up because the libstdc++6 library (which apt depends on) didn’t get properly updated during your dist-upgrade. Since apt can’t run without this library, we need to manually fix it first. Here’s how to get things back on track:
Step 1: Confirm your system architecture
First, figure out if you’re running a 32-bit (i386) or 64-bit (amd64) system. Run this in your terminal:
uname -m
- If it returns
x86_64, you have an amd64 system. - If it returns
i686ori386, you’re on an i386 system.
Step 2: Manually download the correct libstdc++6 package for Debian 7.11
Use wget to grab the package from Debian’s wheezy repository. Replace amd64 with i386 if you’re on a 32-bit system:
wget http://ftp.debian.org/debian/pool/main/g/gcc-4.7/libstdc++6_4.7.2-5_amd64.deb
Step 3: Install the package with dpkg
Since apt is broken, we’ll use dpkg directly to install the library. Adjust the filename to match your architecture:
dpkg -i libstdc++6_4.7.2-5_amd64.deb
If you hit a dependency error, you can force the installation (this is safe here since we’re fixing a core system library):
dpkg --force-depends -i libstdc++6_4.7.2-5_amd64.deb
Step 4: Verify the fix
Check if the GLIBCXX_3.4.15 symbol is now available:
For amd64 systems:
strings /usr/lib/x86_64-linux-gnu/libstdc++.so.6 | grep GLIBCXX_3.4.15
For i386 systems:
strings /usr/lib/i386-linux-gnu/libstdc++.so.6 | grep GLIBCXX_3.4.15
You should see GLIBCXX_3.4.15 printed if the installation worked.
Step 5: Finish the upgrade
Now that apt is working again, run these commands to make sure all packages are fully upgraded and consistent:
apt-get update apt-get dist-upgrade
Quick note on why this happens
During the jump from Debian 6 to 7, network blips or minor package conflicts can sometimes cause libstdc++6 (which provides the GLIBCXX symbols) to skip updating. Since the new version of apt relies on the newer GLIBCXX_3.4.15 symbol, it breaks until we manually install the correct library version.
内容的提问来源于stack exchange,提问作者Qex

