Debian

安裝了錯誤的 libc6 包並破壞了系統

  • November 2, 2020

背景

我試圖以一種“不”好的方式升級我的 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

您可能需要重新安裝所有與 libc 相關的軟體包,尤其是libc6自身libc-bin、、、localeslibc-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安裝。

引用自:https://unix.stackexchange.com/questions/617549