apt 无法正常工作:已安装的 libc-bin 包安装后脚本子进程返回错误退出状态 134

apt 无法正常工作:已安装的 libc-bin 包安装后脚本子进程返回错误退出状态 134

环境?

  • 适用于 Linux 的 Windows 子系统。
  • Ubuntu 18.04.2 LTS
  • apt 1.6.11 (amd64)

怎么了?

apt upgrade并且apt autoremove不工作。 apt upgrade给出以下消息

$ sudo apt upgrade
Reading package lists... Done
Building dependency tree
Reading state information... Done
Calculating upgrade... Done
The following packages will be upgraded:
  gir1.2-gtk-3.0 gtk-update-icon-cache libegl-mesa0 libgbm1 libgl1-mesa-dev libgl1-mesa-dri libgl1-mesa-glx libglapi-mesa
  libglx-mesa0 libgtk-3-0 libgtk-3-bin libgtk-3-common libmspack0 linux-libc-dev mesa-common-dev
15 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
1 not fully installed or removed.
Need to get 0 B/12.4 MB of archives.
After this operation, 4096 B of additional disk space will be used.
Do you want to continue? [Y/n] Y
Setting up libc-bin (2.27-3ubuntu1) ...
Aborted (core dumped)
/sbin/ldconfig.real: Can't stat /usr/local/lib/x86_64-linux-gnu: No such file or directory
/sbin/ldconfig.real: Path `/lib/x86_64-linux-gnu' given more than once
/sbin/ldconfig.real: Path `/usr/lib/x86_64-linux-gnu' given more than once
/usr/lib/x86_64-linux-gnu/libfakeroot:
        libfakeroot-0.so -> libfakeroot-tcp.so
/usr/local/lib:
/lib/x86_64-linux-gnu:
Aborted (core dumped)
dpkg: error processing package libc-bin (--configure):
 installed libc-bin package post-installation script subprocess returned error exit status 134
Errors were encountered while processing:
 libc-bin
E: Sub-process /usr/bin/dpkg returned an error code (1)

apt autoremove给出以下消息

$ sudo apt autoremove
Reading package lists... Done
Building dependency tree
Reading state information... Done
0 upgraded, 0 newly installed, 0 to remove and 15 not upgraded.
1 not fully installed or removed.
After this operation, 0 B of additional disk space will be used.
Setting up libc-bin (2.27-3ubuntu1) ...
Aborted (core dumped)
/sbin/ldconfig.real: Can't stat /usr/local/lib/x86_64-linux-gnu: No such file or directory
/sbin/ldconfig.real: Path `/lib/x86_64-linux-gnu' given more than once
/sbin/ldconfig.real: Path `/usr/lib/x86_64-linux-gnu' given more than once
/usr/lib/x86_64-linux-gnu/libfakeroot:
        libfakeroot-0.so -> libfakeroot-tcp.so
/usr/local/lib:
/lib/x86_64-linux-gnu:
Aborted (core dumped)
dpkg: error processing package libc-bin (--configure):
 installed libc-bin package post-installation script subprocess returned error exit status 134
Errors were encountered while processing:
 libc-bin
E: Sub-process /usr/bin/dpkg returned an error code (1)

apt update并且apt autoclean似乎工作正常。

复制?

我不知道是什么导致了错误...另外,我认为我最近没有对非用户文件进行任何危险操作。我在谷歌上搜索了我收到的错误消息,但没有结果。有人知道吗?

答案1

有趣的是,当我尝试 Eric Gazoni 所做的事情时他的打击失败了,当然dpkg不想让我强行移除 Ubuntu 的重要器官 ;) ... 但是在顽固地执行他的指示,用 替换slapdlibc-bin然后移/tmp/libc-bin.*回之后/var/lib/dpkg/info/,它自行修复了!

因此,从本质上讲,这是有效的,尽管可能不是每个命令都是必要的:

sudo mv /var/lib/dpkg/info/libc-bin.* /tmp/
sudo dpkg --remove --force-remove-reinstreq libc-bin
sudo dpkg --purge libc-bin
sudo apt install --reinstall libc-bin
sudo mv /tmp/libc-bin.* /var/lib/dpkg/info/

答案2

一个侵入性较小的修复方法:

for PROBDIR in "" "/usr" "/usr/local"; do find "${PROBDIR}/lib/x86_64-linux-gnu" -type f -ls; done;

来源:https://github.com/microsoft/WSL/issues/4760

答案3

这对我在 WSL Ubuntu 20.04 上修复 coredump 很有效

for PROBDIR in "" "/usr" "/usr/local"; do find "${PROBDIR}/lib/x86_64-linux-gnu" -type f -ls; done;
sudo apt install libc-bin -y
sudo mv /var/lib/dpkg/info/libc-bin.* /tmp/
sudo apt install libc-bin -y

答案4

其它方法都不管用!最后我尝试了他的方法,结果成功了!又回到正轨了

如何让 16.04 中的软件更新正常运行?升级到 18.04 失败后,软件更新就失效了

apt-get download libc-bin
sudo dpkg -x libc-bin*.deb /
sudo apt-get install --reinstall ./libc-bin*.deb

相关内容