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
6
  • 2
    Is this a brand new install? If so, try reinstalling again. I don't know of a single variant of linux that doesn't have cp right out of the box.
    – Daniel
    Feb 9, 2016 at 14:09
  • 4
    Care to explain what you did to get this happening? ;-) (the solution probably will depend on it). Tried another kernel for instance?
    – Rinzwind
    Feb 9, 2016 at 14:11
  • 2
    Well you have broken overall system. You'll likely need to reinstall Feb 9, 2016 at 14:14
  • 1
    show us the output of echo $PATH
    – Alex Jones
    Feb 9, 2016 at 14:25
  • 1
    No. Its worked before in the past. i was attempting to install new applications and give the executable files admin privileges. Feb 10, 2016 at 15:45

1 Answer 1

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.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .