在终端中,当我发出cp
命令时,它显示:
The program 'cp' is currently not installed. You can install it by typing:
apt-get install coreutils
但是当我尝试安装它时,出现下面列出的错误:
depmod: FATAL: could not load /boot/System.map-3.19.0-25-generic: No such file or directory
run-parts: executing /etc/kernel/postinst.d/apt-auto-removal 3.19.0-25-generic /boot/vmlinuz-3.19.0-25-generic
run-parts: executing /etc/kernel/postinst.d/initramfs-tools 3.19.0-25-generic /boot/vmlinuz-3.19.0-25-generic
update-initramfs: Generating /boot/initrd.img-3.19.0-25-generic
grep: /boot/config-3.19.0-25-generic: No such file or directory
WARNING: missing /lib/modules/3.19.0-25-generic
Device driver support needs thus be built-in linux image!
depmod: ERROR: could not open directory /lib/modules/3.19.0-25-generic: No such file or directory
depmod: FATAL: could not search modules: No such file or directory
/usr/sbin/mkinitramfs: 245: /usr/sbin/mkinitramfs: cp: not found
/usr/sbin/mkinitramfs: 255: /usr/sbin/mkinitramfs: cp: not found
/usr/sbin/mkinitramfs: 255: /usr/sbin/mkinitramfs: cp: not found
/usr/sbin/mkinitramfs: 255: /usr/sbin/mkinitramfs: cp: not found
/usr/sbin/mkinitramfs: 255: /usr/sbin/mkinitramfs: cp: not found
/usr/sbin/mkinitramfs: 255: /usr/sbin/mkinitramfs: cp: not found
/usr/sbin/mkinitramfs: 255: /usr/sbin/mkinitramfs: cp: not found
/usr/sbin/mkinitramfs: 255: /usr/sbin/mkinitramfs: cp: not found
/usr/sbin/mkinitramfs: 255: /usr/sbin/mkinitramfs: cp: not found
/usr/sbin/mkinitramfs: 255: /usr/sbin/mkinitramfs: cp: not found
/usr/sbin/mkinitramfs: 255: /usr/sbin/mkinitramfs: cp: not found
/usr/sbin/mkinitramfs: 255: /usr/sbin/mkinitramfs: cp: not found
/usr/sbin/mkinitramfs: 255: /usr/sbin/mkinitramfs: cp: not found
/usr/sbin/mkinitramfs: 255: /usr/sbin/mkinitramfs: cp: not found
/usr/sbin/mkinitramfs: 269: /usr/sbin/mkinitramfs: cp: not found
/usr/sbin/mkinitramfs: 149: /usr/sbin/mkinitramfs: cp: not found
/usr/sbin/mkinitramfs: 149: /usr/sbin/mkinitramfs: cp: not found
/usr/sbin/mkinitramfs: 173: /usr/sbin/mkinitramfs: cp: not found
/usr/sbin/mkinitramfs: 173: /usr/sbin/mkinitramfs: cp: not found
/usr/sbin/mkinitramfs: 173: /usr/sbin/mkinitramfs: cp: not found
/usr/sbin/mkinitramfs: 173: /usr/sbin/mkinitramfs: cp: not found
/usr/sbin/mkinitramfs: 173: /usr/sbin/mkinitramfs: cp: not found
/usr/sbin/mkinitramfs: 173: /usr/sbin/mkinitramfs: cp: not found
/usr/sbin/mkinitramfs: 173: /usr/sbin/mkinitramfs: cp: not found
/usr/sbin/mkinitramfs: 173: /usr/sbin/mkinitramfs: cp: not found
/usr/sbin/mkinitramfs: 173: /usr/sbin/mkinitramfs: cp: not found
/usr/sbin/mkinitramfs: 149: /usr/sbin/mkinitramfs: cp: not found
/usr/sbin/mkinitramfs: 173: /usr/sbin/mkinitramfs: cp: not found
/usr/sbin/mkinitramfs: 173: /usr/sbin/mkinitramfs: cp: not found
/usr/sbin/mkinitramfs: 149: /usr/sbin/mkinitramfs: cp: not found
/usr/sbin/mkinitramfs: 173: /usr/sbin/mkinitramfs: cp: not found
/usr/sbin/mkinitramfs: 173: /usr/sbin/mkinitramfs: cp: not found
/usr/sbin/mkinitramfs: 294: /usr/sbin/mkinitramfs: cp: not found
/usr/sbin/mkinitramfs: 149: /usr/sbin/mkinitramfs: cp: not found
/usr/sbin/mkinitramfs: 173: /usr/sbin/mkinitramfs: cp: not found
/usr/sbin/mkinitramfs: 173: /usr/sbin/mkinitramfs: cp: not found
/usr/sbin/mkinitramfs: 173: /usr/sbin/mkinitramfs: cp: not found
/usr/sbin/mkinitramfs: 173: /usr/sbin/mkinitramfs: cp: not found
/usr/share/initramfs-tools/hooks/fixrtc: 149: /usr/share/initramfs-tools/hooks/fixrtc: cp: not found
E: /usr/share/initramfs-tools/hooks/fixrtc failed with return 127.
update-initramfs: failed for /boot/initrd.img-3.19.0-25-generic with 127.
run-parts: /etc/kernel/postinst.d/initramfs-tools exited with return code 127
dpkg: error processing package linux-image-extra-3.19.0-25-generic (--remove):
subprocess installed post-removal script returned error exit status 1
Errors were encountered while processing:
linux-image-extra-3.19.0-25-generic
E: Sub-process /usr/bin/dpkg returned an error code (1)
输出echo $PATH
:
/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
答案1
这仅表明您或其他人(恶意)篡改了计算机,删除了 cp 命令(甚至删除了整个 coreutils 包)。正常使用不会发生这种情况。
什么时候该做什么cp不见了
- 创建一个实时 USB 记忆棒(您必须使用另一台机器来完成此操作)
- 从 USB 启动
- 将数据备份到外部驱动器
- 挂载你的根分区,例如:(
sudo mount /dev/sda2 /mnt
这里的/dev/sda2 只是一个例子) - 将实时系统的 cp 命令复制到根分区并重新启动
sudo cp /bin/cp /mnt/bin/cp
sudo umount /mnt && sudo shutdown -r now
当您重新登录时,安装或重新安装 coreutils 以确保一切正常。