![dpkg:警告:在 PATH 中未找到‘tar’或无法执行](https://linux22.com/image/840746/dpkg%EF%BC%9A%E8%AD%A6%E5%91%8A%EF%BC%9A%E5%9C%A8%20PATH%20%E4%B8%AD%E6%9C%AA%E6%89%BE%E5%88%B0%E2%80%98tar%E2%80%99%E6%88%96%E6%97%A0%E6%B3%95%E6%89%A7%E8%A1%8C.png)
我以前用“synaptic”安装过程序,但是现在显示错误并且无法安装任何程序,例如,我想安装xserver-xorg-dev
但是synaptic显示以下错误:
dpkg: warning: 'tar' 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)
A package failed to install. Trying to recover:
dpkg: warning: 'tar' 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.
答案1
我刚刚解决了这个问题。我不知道我的解决方案是否可持续。
我从另一台机器的 /bin/tar 复制了 tar,然后在目标机器的 /bin/tar 上将其 CHMOD 设置为 755。
现在通过 apt-get 重新安装 tar 就可以完美运行了:
root@devubuntu:/usr/bin# sudo chmod 755 /bin/tar
root@devubuntu:/usr/bin# sudo apt-get install --reinstall tar
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following packages were automatically installed and are no longer required:
xfonts-encodings php-console-table xfonts-utils libmcrypt4 libxfont1 xfonts-base php5-mcrypt
Use 'apt-get autoremove' to remove them.
0 upgraded, 0 newly installed, 1 reinstalled, 0 to remove and 7 not upgraded.
Need to get 0 B/218 kB of archives.
After this operation, 0 B of additional disk space will be used.
(Reading database ... 335218 files and directories currently installed.)
Preparing to replace tar 1.26-4ubuntu1 (using .../tar_1.26-4ubuntu1_amd64.deb) ...
Unpacking replacement tar ...
Processing triggers for man-db ...
Setting up tar (1.26-4ubuntu1) ...
当我使用 virtualmins “重新检查配置” 时,我现在得到:
创建和恢复备份所需的所有命令都已安装。
所选的包管理和更新系统已安装完成。
.. 您的系统已准备好供 Virtualmin 使用。
请注意,
注意:root 的 PATH 通常应包含 /usr/local/sbin、/usr/sbin 和 /sbin。
只是一般信息,而不是实际错误消息!当我收到此消息时,/usr/local/sbin、/usr/sbin 和 /sbin已经包含在我的 $PATH 变量中。所以不要让它混淆你。