背景

背景

背景

我试图以一种“不”好的方式升级我的 libc6 版本。这一切都始于我尝试将 MariaDB 从 10.1 更新到 10.2。然后我设法发现已安装的 libc6=1.24 不够好,并且它需要 libc6=1.27。当我dpkg -i在此处使用下载的软件包时,我成功地破坏了我的安装:http://archive.ubuntu.com/ubuntu/pool/main/g/glibc/(具体来说libc6_2.27-3ubuntu1_amd64.deb)。我允许它自动取消配置我的其他软件包,此时我知道我毁了它。

我的系统正在运行

root@redfox:~# lsb_release -a
No LSB modules are available.
Distributor ID: Debian
Description:    Debian GNU/Linux 9.13 (stretch)
Release:    9.13
Codename:   stretch

当前的问题

现在,每当我尝试使用 dpkg 或尝试运行时,apt-get upgrade我都会遇到丢失的程序以及丢失/损坏的依赖项。这是输出:

root@redfox:~# sudo apt-get 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:
  cups-core-drivers hplip-data libart-2.0-2 libcupscgi1 libgutenprint2 libsane-hpaio python3-pexpect python3-pil python3-ptyprocess
  python3-renderpm python3-reportlab python3-reportlab-accel
Use 'sudo apt autoremove' to remove them.
The following packages will be REMOVED:
  hplip libgcc1:i386 printer-driver-gutenprint printer-driver-hpcups printer-driver-postscript-hp
0 upgraded, 0 newly installed, 5 to remove and 0 not upgraded.
1 not fully installed or removed.
After this operation, 4370 kB disk space will be freed.
Do you want to continue? [Y/n] n
Abort.
root@redfox:~# dpkg --configure -a
dpkg: warning: 'ldconfig' not found in PATH or not executable
dpkg: error: 1 expected program not found in PATH or not executable
Note: root's PATH should usually contain /usr/local/sbin, /usr/sbin and /sbin

我做了什么来尝试修复它?

我尝试再次降级到 libc6 版本 1.24,但我不确定效果是否很好。我也尝试过清除包缓存、自动清理等,但不幸的是我很困惑下一步该去哪里。我试图研究我能做什么,但很难理解,因为不幸的是,我觉得这对我的州来说是一个非常具体的问题。

编辑#1

我已经尝试过cp /bin/true /sbin/ldconfig,因为我发现它/sbin/ldconfig丢失了。然而,系统的损坏程度似乎比最初想象的还要严重。这是当我尝试安装下面 Stephen Kitt 的答案中建议的软件包时的输出:

sudo dpkg -i libc-bin_2.24-11+deb9u4_amd64.deb locales_2.24-11+deb9u4_all.deb
Selecting previously unselected package libc-bin.
(Reading database ... 202484 files and directories currently installed.)
Preparing to unpack libc-bin_2.24-11+deb9u4_amd64.deb ...
Unpacking libc-bin (2.24-11+deb9u4) ...
Selecting previously unselected package locales.
Preparing to unpack locales_2.24-11+deb9u4_all.deb ...
Unpacking locales (2.24-11+deb9u4) ...
dpkg: dependency problems prevent configuration of libc-bin:
 libc-bin depends on libc6 (>> 2.24); however:
  Package libc6:amd64 is not configured yet.
 libc-bin depends on libc6 (<< 2.25); however:
  Version of libc6:amd64 on system is 2.27-3ubuntu1.

dpkg: error processing package libc-bin (--install):
 dependency problems - leaving unconfigured
dpkg: dependency problems prevent configuration of locales:
 locales depends on libc-bin (>> 2.24); however:
  Package libc-bin is not configured yet.
 libc6:amd64 (2.27-3ubuntu1) breaks locales (<< 2.27) and is unpacked but not configured.
  Version of locales to be configured is 2.24-11+deb9u4.

dpkg: error processing package locales (--install):
 dependency problems - leaving unconfigured
Errors were encountered while processing:
 libc-bin
 locales

答案1

您可能需要重新安装所有与 libc 相关的软件包,特别是libc6本身,libc-bin,locales, 和libc-l10n:

wget http://deb.debian.org/debian/pool/main/g/glibc/libc6_2.24-11+deb9u4_amd64.deb http://deb.debian.org/debian/pool/main/g/glibc/libc-bin_2.24-11+deb9u4_amd64.deb http://deb.debian.org/debian/pool/main/g/glibc/locales_2.24-11+deb9u4_all.deb http://deb.debian.org/debian/pool/main/g/glibc/libc-l10n_2.24-11+deb9u4_all.deb
dpkg -i libc6_2.24-11+deb9u4_amd64.deb libc-bin_2.24-11+deb9u4_amd64.deb locales_2.24-11+deb9u4_all.deb libc-l10n_2.24-11+deb9u4_all.deb

检查你的PATH(请参阅你的问题中显示的最后一条错误消息)。

由于你的/sbin/ldconfig已经消失了,你需要稍微修改一下才能dpkg安装软件包:

cp /bin/true /sbin/ldconfig

这将允许dpkg继续进行真正的ldconfig安装。

答案2

尝试运行apt-get upgrade -f-f 尝试修复丢失或损坏的包。如果这不成功,请发布完整的输出。

自动修复失败时的更多选项:

  • 找到损坏的包并尝试将其删除,然后按源重新安装。
  • 检查echo $PATH以确保它包含正确的位置。

提示:如果您需要 debian 的新软件包,请不要使用 ubuntu 软件包。这些可能有效,但很有可能破坏系统。 debian 系统的更好来源是 debian 的 stable/testing 分支的软件包。另一种选择是使用“向后移植”。对于较新版本的目标软件,这些软件包需要尽可能少的新库。

相关内容