如何修复损坏的 glibc 包

如何修复损坏的 glibc 包

我正在使用 Ubuntu 18.04,并尝试将 libc6 从版本 2.27 升级到 2.29,但最终破坏了软件包系统。我无法修复,因为当我尝试使用修复命令时,它总是显示系统中的大量软件包将被删除。

Synaptic 显示这些包已损坏:

  • glibc-doc 2.27-3
  • libc-dev-bin 2.27-3
  • libc6 2.29-0
  • libc6-dbg 2.27-3
  • libc6-dev 2.27-3
  • libc6:i386 2.27-3

我怎么崩溃了?我从以下网站下载了以下软件包https://packages.ubuntu.com/

  • glibc-doc_2.29-0ubuntu2_all.deb
  • glibc-source_2.29-0ubuntu2_all.deb
  • libc6_2.29-0ubuntu2_amd64.deb
  • libc6-amd64_2.29-0ubuntu2_i386.deb
  • libc-bin_2.29-0ubuntu2_amd64.deb
  • locales_2.29-0ubuntu2_all.deb

我尝试通过 dpkg 逐个安装它们,但由于依赖性错误而无法工作,最后我使用了这个命令:

sudo dpkg -i libc-bin_2.29-0ubuntu2_amd64.deb libc6_2.29-0ubuntu2_amd64.deb libc6-amd64_2.29-0ubuntu2_i386.deb 

此后,我在提示中说“是”,提示说需要重新启动一些程序,比如 postgres。

然后我看到了包装损坏的错误。

sudo apt update没有给出错误。当我尝试修复时,它显示几乎所有内容都需要删除:

sudo apt install -f
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Correcting dependencies... Done
The following packages were automatically installed and are no longer required:
  alex freeglut3 freeglut3-dev happy hscolour libbsd-dev libdrm-dev libffi-dev
  libgl1-mesa-dev libgles1 libglu1-mesa-dev libglvnd-core-dev libglvnd-dev
  libgmp-dev libgmpxx4ldbl libopengl0 libtinfo-dev libx11-xcb-dev
  libx11-xcb1:i386 libxcb-dri2-0-dev libxcb-dri3-dev libxcb-glx0-dev
  libxcb-present-dev libxcb-randr0-dev libxcb-render0-dev libxcb-shape0-dev
  libxcb-sync-dev libxcb-xfixes0-dev libxdamage-dev libxext-dev libxfixes-dev
  libxi-dev libxmu-dev libxmu-headers libxshmfence-dev libxxf86vm-dev
  linux-headers-4.18.0-17 linux-headers-4.18.0-17-generic
  linux-image-4.18.0-17-generic linux-libc-dev linux-modules-4.18.0-17-generic
  linux-modules-extra-4.18.0-17-generic mesa-common-dev x11proto-damage-dev
  x11proto-fixes-dev x11proto-xext-dev x11proto-xf86vidmode-dev
Use 'sudo apt autoremove' to remove them.
The following additional packages will be installed:
  glibc-doc-reference
The following packages will be REMOVED:
  build-essential cabal-install g++ g++-7 ghc haskell-platform libbsd0:i386
  libc-dev-bin libc6:i386 libc6-amd64:i386 libc6-dbg libc6-dev
  libdrm-amdgpu1:i386 libdrm-intel1:i386 libdrm-nouveau2:i386
  libdrm-radeon1:i386 libdrm2:i386 libedit2:i386 libelf1:i386 libexpat1:i386
  libffi6:i386 libgcc1:i386 libghc-async-dev libghc-attoparsec-dev
  libghc-call-stack-dev libghc-case-insensitive-dev libghc-fgl-dev
  libghc-fixed-dev libghc-gluraw-dev libghc-glut-dev libghc-half-dev
  libghc-hashable-dev libghc-haskell-src-dev libghc-html-dev libghc-http-dev
  libghc-hunit-dev libghc-integer-logarithms-dev libghc-mtl-dev
  libghc-network-dev libghc-network-uri-dev libghc-objectname-dev
  libghc-opengl-dev libghc-openglraw-dev libghc-parallel-dev
  libghc-parsec3-dev libghc-primitive-dev libghc-quickcheck2-dev
  libghc-random-dev libghc-regex-base-dev libghc-regex-compat-dev
  libghc-regex-posix-dev libghc-scientific-dev libghc-split-dev
  libghc-statevar-dev libghc-stm-dev libghc-syb-dev libghc-text-dev
  libghc-tf-random-dev libghc-unordered-containers-dev libghc-vector-dev
  libghc-zlib-dev libgl1:i386 libgl1-mesa-dri:i386 libgl1-mesa-glx:i386
  libglapi-mesa:i386 libglvnd0:i386 libglx-mesa0:i386 libglx0:i386
  libllvm7:i386 libncurses5-dev libnvidia-compute-418:i386
  libnvidia-decode-418:i386 libnvidia-encode-418:i386 libnvidia-fbc1-418:i386
  libnvidia-gl-418:i386 libnvidia-ifr1-418:i386 libpciaccess0:i386
  libsensors4:i386 libstdc++-7-dev libstdc++6:i386 libtinfo5:i386
  libx11-6:i386 libxau6:i386 libxcb-dri2-0:i386 libxcb-dri3-0:i386
  libxcb-glx0:i386 libxcb-present0:i386 libxcb-sync1:i386 libxcb1:i386
  libxdamage1:i386 libxdmcp6:i386 libxext6:i386 libxfixes3:i386
  libxshmfence1:i386 libxxf86vm1:i386 zlib1g:i386 zlib1g-dev
The following NEW packages will be installed:
  glibc-doc-reference
0 upgraded, 1 newly installed, 97 to remove and 0 not upgraded.
6 not fully installed or removed.
Need to get 5.483 kB of archives.
After this operation, 1.303 MB disk space will be freed.
Do you want to continue? [Y/n] 

答案1

Apt 没有损坏 - 它仍然运行良好。但你不明智地告诉 apt 做一个弗兰肯系统,混合了来自 Ubuntu 不同版本的软件包。

Apt 永远无法解决现在不合逻辑的依赖关系……(您也一样)。由于 apt 无法运行,除非您删除错误版本的软件包,否则您将无法获得任何升级或安全补丁。

我们不为 Frankensystems 提供支持。顾名思义,它们不稳定,容易出现异常且难以诊断的问题。基于 Deb 的系统设计为使用特定版本的软件包。错误版本的软件包会导致问题。

删除错误版本的软件包。如果您想运行 19.04 软件包,请考虑安装 Ubuntu 19.04。如果您希望保留当前的 ​​18.04 系统,也许可以在虚拟机或备用分区中安装。

答案2

我通过下载所有这些软件包的 2.27 版本并在它们上运行 dpkg 来修复这个问题。

我尝试按之前相同的顺序安装它们。我在多个 deb 文件上使用 dpkg 来防止循环依赖或类似情况。不确定它是否会改变任何东西。

答案3

因此,如果您需要一个仅随新发行版附带且一些游戏所需的库,那么真正的解决方案就是升级发行版……

如果您打算在 Ubuntu 系统上玩游戏,那么对 18.04 的支持将持续到 2023 年……例如,我有三款 2020 年的 Linux 游戏,一旦更新,就需要 glibc6-2.29 或更高版本!但对我来说,这意味着下载新的发行版 ISO 并进行完整安装!因为 disptr-upgrade 失败了……

相关内容