我的命令有问题/bin/echo
。
sudo ls -al /bin/echo
-rwxr-xr-x 1 root utmp 0 Nov 11 18:05 /bin/echo
修复方法1:
我知道是/bin/echo
在coretils
。
先删除 coreutils,然后重新安装。
sudo apt-get remove coreutils
Reading package lists... Done
Building dependency tree
Reading state information... Done
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
我无法删除它,删除它并重新安装 coreutils 没有用吗?
方法2:
编译echo.c。
cd /tmp
sudo apt-get source coreutils
cd coreutils-8.26
/tmp/coreutils-8.26$ ./configure
./configure: line 3492: config.log: Permission denied
./configure: line 3502: config.log: Permission denied
让我用它来配置它sudo
。
sudo ./configure
configure: error: you should not run configure as root (set FORCE_UNSAFE_CONFIGURE=1 in environment to bypass this check)
如何修复/bin/echo
我的 Debian 中的问题?
答案1
获取正确的.deb
文件:
mkdir ~/dummy
cd ~/dummy
apt-get download coreutils
解压:
sudo dpkg-deb -x *.deb ./
(注意:dpkg-deb
无需root即可运行sudo
,但以root身份解压更容易echo
从一开始就获得具有适当所有权的文件)。
您要查找的可执行文件是./bin/echo
。替换/bin/echo
:
sudo mv ./bin/echo /bin/
删除目录:
cd ~/
sudo rm -rf ~/dummy