I can't get the `cp` command to work
5,300
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
- Create a live USB-stick (you'll have to use another machine to do that)
- Boot from that USB-stick
- Back up your data to an external drive
- Mount your root partition, e.g.:
sudo mount /dev/sda2 /mnt
(/dev/sda2 is just an example, here) - 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.
Related videos on Youtube
Author by
Logan Herald
Updated on September 18, 2022Comments
-
Logan Herald over 1 year
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
-
Daniel over 8 yearsIs 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. -
Rinzwind over 8 yearsCare to explain what you did to get this happening? ;-) (the solution probably will depend on it). Tried another kernel for instance?
-
Sergiy Kolodyazhnyy over 8 yearsWell you have broken overall system. You'll likely need to reinstall
-
Edward Torvalds over 8 yearsshow us the output of
echo $PATH
-
Logan Herald over 8 yearsNo. Its worked before in the past. i was attempting to install new applications and give the executable files admin privileges.
-
Logan Herald over 8 yearshere's the output of echo $PATH /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
-