sudo apt-get -f install 出错(未找到 ldconfig)

sudo apt-get -f install 出错(未找到 ldconfig)

我正在使用 14.04 LTS。当我sudo apt-get -f install在终端中输入时,出现此错误:

Can't exec "locale": No such file or directory at /usr/share/perl5/Debconf/Encoding.pm line 16.
Use of uninitialized value $Debconf::Encoding::charmap in scalar chomp at /usr/share/perl5/Debconf/Encoding.pm line 17.
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)

请帮忙,谢谢。


回应 Faizansudo dpkg-reconfigure -a在评论中说“尝试执行”。当我尝试执行时,我收到以下消息:

Can't exec "locale": No such file or directory at /usr/share/perl5/Debconf/Encoding.pm line 16.
Use of uninitialized value $Debconf::Encoding::charmap in scalar chomp at /usr/share/perl5/Debconf/Encoding.pm line 17.
acpid stop/waiting
acpid start/running, process 11426
/var/lib/dpkg/info/activity-log-manager.postinst: 5: /var/lib/dpkg/info/activity-log-manager.postinst: ldconfig: not found

编辑:

Can't exec "locale": No such file or directory at /usr/share/perl5/Debconf/Encoding.pm line 16.
Use of uninitialized value $Debconf::Encoding::charmap in scalar chomp at /usr/share/perl5/Debconf/Encoding.pm line 17.
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)

答案1

如果此方法有效,请尝试一下。确保您没有为不同版本或预发布更新激活不稳定的存储库,但对于 14.04 LTS,建议仅检查 --> 系统设置/软件和更新。

然后运行:

sudo apt-get -f install

sudo dpkg-reconfigure libc6

sudo dpkg-reconfigure libc-bin

sudo apt-get install --reinstall libc6

sudo apt-get install --reinstall libc-bin

sudo apt-get dist-upgrade

另一种方式:

下载libc-bin 这里例如

然后你必须提取它:

dpkg -x libc-bin*.deb unpacked/

将文件复制到系统:

sudo cp unpacked/sbin/ldconfig /sbin/

或者使用以下命令打开 Nautilus:

gksudo nautilus

并以这种 GUI 方式执行,右键单击一个.deb包并选择在此处提取并复制到目标位置。

进而:

sudo apt-get install --reinstall libc-bin

sudo apt-get install -f

相关内容