2

In the terminal, when I issue the cp command, it states:

The program 'cp' is currently not installed. You can install it by typing:
apt-get install coreutils

But when I try to install it, I get the errors listed below:

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)

Output of echo $PATH:

/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
kos
  • 35,891

1 Answers1

2

This just shows that you or someone else (maliciously) tampered with the machine by deleting the cp command (or even the whole coreutils package). This doesn't happen through normal usage.

What to do when cp is missing

  1. Create a live USB-stick (you'll have to use another machine to do that)
  2. Boot from that USB-stick
  3. Back up your data to an external drive
  4. Mount your root partition, e.g.:
    sudo mount /dev/sda2 /mnt (/dev/sda2 is just an example, here)
  5. Copy the cp command of the live system to your root partition and reboot
    sudo cp /bin/cp /mnt/bin/cp
    sudo umount /mnt && sudo shutdown -r now

When you're logged back in, install or reinstall coreutils to make sure everything is in order.

mniess
  • 10,546