跳转至

Ubuntu 误删 libc-bin 导致无法安装任何软件包,提示 'ldconfig' not found in PATH or not executable

约 99 个字 10 行代码 预计阅读时间不到 1 分钟

情况

Ubuntu,因升级软件包 libc6 失败,误删了 libc-bin,导致使用 aptdpkg 安装软件时,无法安装,提示如下信息:

1
2
3
4
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
E: Sub-process /usr/bin/dpkg returned an error code (2)

解决方案

使用 root 权限执行:

1
2
3
4
5
6
apt-get download libc-bin
dpkg -x libc-bin_2.31-0ubuntu9.7_amd64.deb unpackdir
cp unpackdir/sbin/ldconfig /sbin/
apt reinstall libc6/focal
apt reinstall libc-bin
apt install -f

来源

linux误删libc-bin出现dpkg: warning: ‘ldconfig’ not found in PATH or not executable_VVeaker的博客-CSDN博客