我手动下载并安装 gcc: gcc-11-base/now 11.3.0-3 amd64,搞砸了我的系统
有关我的 ubuntu 的信息:
uname -r
5.18.6-051806-generic
lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 21.10
Release: 21.10
Codename: impish
我所看到的:
# dpkg-query -l gcc-11*
Desired=Unknown/Install/Remove/Purge/Hold
| Status=Not/Inst/Conf-files/Unpacked/halF-conf/Half-inst/trig-aWait/Trig-pend
|/ Err?=(none)/Reinst-required (Status,Err: uppercase=bad)
||/ Name Version Architecture Description
+++-=================-===============-============-===============================================
rU gcc-11 11.2.0-7ubuntu2 amd64 GNU C compiler
rU gcc-11-base:amd64 11.3.0-3 amd64 GCC, the GNU Compiler Collection (base package)
iF gcc-11-base:i386 11.2.0-7ubuntu2 i386 GCC, the GNU Compiler Collection (base package)
un gcc-11-doc <none> <none> (no description available)
un gcc-11-locales <none> <none> (no description available)
un gcc-11-multilib <none> <none> (no description available)
如上图所示,我看到了 2 个基础安装:
gcc-11-base:amd64 11.3.0-3
gcc-11-base:i386 11.2.0-7ubuntu2
我想删除“gcc-11-base:amd64 11.3.0-3”并保留“gcc-11-base:i386”不变。
以下是我尝试过的:
# dpkg -r gcc-11-base:amd64
dpkg: dependency problems prevent removal of gcc-11-base:amd64:
libubsan1:amd64 depends on gcc-11-base (= 11.2.0-7ubuntu2).
libtsan0:amd64 depends on gcc-11-base (= 11.2.0-7ubuntu2).
libstdc++6:amd64 depends on gcc-11-base (= 11.2.0-7ubuntu2).
libstdc++-11-dev:amd64 depends on gcc-11-base (= 11.2.0-7ubuntu2).
libquadmath0:amd64 depends on gcc-11-base (= 11.2.0-7ubuntu2).
liblsan0:amd64 depends on gcc-11-base (= 11.2.0-7ubuntu2).
libitm1:amd64 depends on gcc-11-base (= 11.2.0-7ubuntu2).
libgomp1:amd64 depends on gcc-11-base (= 11.2.0-7ubuntu2).
libgfortran5:amd64 depends on gcc-11-base (= 11.2.0-7ubuntu2).
libgcc-s1:amd64 depends on gcc-11-base (= 11.2.0-7ubuntu2).
libgcc-11-dev:amd64 depends on gcc-11-base (= 11.2.0-7ubuntu2).
libcc1-0:amd64 depends on gcc-11-base (= 11.2.0-7ubuntu2).
libatomic1:amd64 depends on gcc-11-base (= 11.2.0-7ubuntu2).
libasan6:amd64 depends on gcc-11-base (= 11.2.0-7ubuntu2).
gcc-11 depends on gcc-11-base (= 11.2.0-7ubuntu2).
g++-11 depends on gcc-11-base (= 11.2.0-7ubuntu2).
cpp-11 depends on gcc-11-base (= 11.2.0-7ubuntu2).
它似乎正在尝试删除“11.2.0-7ubuntu2”
我还是个新手,所以请慢慢来:)
答案1
我找到了一种解决方法,我不知道这是否是一种好的做法,但它对我来说很有效。
dpkg --remove --ignore-depends=libubsan1,libtsan0,libstdc++6,libstdc++-11-dev,libquadmath0,liblsan0,libitm1,libgomp1,libgfortran5,libgcc-s1,libgcc-11-dev,libcc1-0,libatomic1,libasan6,gcc-11,g++-11,cpp-11 gcc-11-base
dpkg --remove --ignore-depends=gcc,g++-11,g++ gcc-11
解释 :
- 我没有找到删除特定版本的方法,所以我决定删除 gc-11。
- 由于所有依赖项,dpkg --remove 无法工作。因此,我必须添加所有忽略命令。
- 仅在万不得已的情况下才这样做,因为这会威胁整个系统的稳定性。
希望这有帮助,我的系统现在很稳定。