Ubuntu 14.04.2 LTS:在 PATH 中找不到“find”或不可执行

Ubuntu 14.04.2 LTS:在 PATH 中找不到“find”或不可执行

我正在尝试使用以下命令安装一些图形库:

sudo apt install jpegoptim optipng

但是它无法运行,并显示以下内容:

Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following NEW packages will be installed:
  jpegoptim optipng
0 upgraded, 2 newly installed, 0 to remove and 273 not upgraded.
Need to get 0 B/208 kB of archives.
After this operation, 625 kB of additional disk space will be used.
dpkg: warning: 'find' 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)

然后我尝试find使用以下命令进行安装:

sudo apt-get install findutils

但它安装失败,因为它说它已经安装:

Reading package lists... Done
Building dependency tree       
Reading state information... Done
findutils is already the newest version.
0 upgraded, 0 newly installed, 0 to remove and 273 not upgraded.

我注意到我的/etc/environment文件是空的,我添加了以下内容:

PATH=/sbin:/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin

不幸的是,这也没有奏效。它仍然导致:

Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following NEW packages will be installed:
  jpegoptim optipng
0 upgraded, 2 newly installed, 0 to remove and 273 not upgraded.
Need to get 0 B/208 kB of archives.
After this operation, 625 kB of additional disk space will be used.
dpkg: warning: 'find' 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)

我还尝试将以下内容放入.bashrc文件中:

export PATH=$PATH:/sbin:/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin

但它仍然抱怨 PATH 不正确。

答案1

sudo apt-get --reinstall install findutils

“重新安装”选项允许您重新安装已安装的最新版本的软件包。

即使这有效,我也会担心你的 /usr/bin/find 之前已经消失了,如果它没有被错误删除,那么你的系统可能被黑客入侵了?

相关内容