After running pacman -Suy last night to stay up to date, mkinitcpio was called and failing 99% completely: Every single file it attempted to copy resulted as such:
$this->bbcode_second_pass_code('', '[ALPM-SCRIPTLET] cp: failed to clone '/tmp/mkinitcpio.D1LhVr/root/bin/busybox' from '/usr/lib/initcpio/busybox': Inappropriate ioctl for device')
and left me with a 4KB /boot/initramfs-linux.img. A pausing the middle and examination of the temp working directory shows that du /tmp/mkinitcpio.XXXX was 0 bytes! but all the files were there.
Manually trying to cp A B in the same folder resulted in the same error, so it was not some linking-across-devices problem (eg initcpio bins/libs to /tmp). Something broke cp (and install), therefore breaking the initcpio
This happened on a remote system and a local one. I rebooted the local one and, of course, it was bricked. No kernel! I also did not have a backup initramfs img...
Here is what I did to cobble the remote to stay up:
I tried aliasing cp with cat>,progress, and various other alternative copy methods with no success. I did not have busybox installed but luckily initcpio includes it so I backed up (renamed) /bin/cp and /bin/install, then linked busybox to those commands:
$this->bbcode_second_pass_code('', 'ln -s /usr/lib/initcpio/busybox /bin/cp
ln -s /usr/lib/initcpio/busybox /bin/install')
mkinitcpio almost started working, but passes --preserve=mode,ownership to cp which that version of busybox does not support, so editing /usr/lib/initcpio/functions to find that at line 701 to just be -p worked!
$this->bbcode_second_pass_code('', 'command cp --remove-destination --preserve=mode,ownership "$src" "${BUILDROOT}${dest}"
to
command cp --remove-destination -p "$src" "${BUILDROOT}${dest}"')
I ran mkinitcpio -g /boot/initramfs-linux.img without issue and got a nice 7MB initramfs. I copied this to the SD card of my local one, then it booted right back up! Made the same modifications to override cp and install with busybox and things are smooth again so far.
Updating/reinstalling mkinitcpio breaks this and requires editing the functions file again. Other updates that trigger running mkinitcpio work fine.
I've attached the logs and an strace of cp failing for any insight into the failure. "native" cp and install are still broken after full update.