为什么我会收到终端错误“尝试 apt-get -f install”?

为什么我会收到终端错误“尝试 apt-get -f install”?

好的,我刚刚安装了 Ubuntu(LXDE 版本,即 Lubuntu),每次我尝试使用“Apt-get install”命令通过终端安装包时,都会弹出此错误:

E: Unmet dependencies. Try 'apt-get -f install' with no packages

是的,这适用于我尝试安装的每个软件包。当我apt-get -f install 这样做时,我收到终端输出:

Reading package lists... Done
Building dependency tree       
Reading state information... Done
Correcting dependencies... Done
The following extra packages will be installed:
  libc-bin
The following NEW packages will be installed:
  libc-bin
0 upgraded, 1 newly installed, 0 to remove and 3 not upgraded.
Need to get 0 B/1,168 kB of archives.
After this operation, 3,532 kB of additional disk space will be used.
Do you want to continue? [Y/n] y
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)

有人能帮帮我吗?我两个月前才开始使用 Linux,后来换成了 Lubuntu。

答案1

首先,尝试

sudo ldconfig

只是为了解决这个问题,以便我们了解事实并非如此。

然后,尝试这些命令,如果您通常使用 sudo su,则不要执行该命令,并在列出的每个其他命令之前键入 sudo。如果您通常键入 sudo apt-get -f install,则按列出的方式执行这些命令。

sudo su
apt-get update
apt-get autoremove
apt-get autoclean
apt-get upgrade

即使最后一个命令失败,请尝试

apt-get -f install

由于某种原因,在 $PATH 方面,使用 sudo su 与使用 sudo 可能有所不同。

相关内容