FS#77982 - [mkinitcpio] does not halt/fail when errors occur, and proceeds to generate bad boot images
Attached to Project:
Arch Linux
Opened by Erik Johnson (EkriirkE) - Friday, 24 March 2023, 10:42 GMT
Last edited by Jelle van der Waa (jelly) - Monday, 18 September 2023, 17:44 GMT
Opened by Erik Johnson (EkriirkE) - Friday, 24 March 2023, 10:42 GMT
Last edited by Jelle van der Waa (jelly) - Monday, 18 September 2023, 17:44 GMT
|
Details
Description:
I did an update to my system (bog standard pacman -Suy) that broke the cp and install commands. Another package was also updated that triggered mkinitcpio. mkinitcpio tries to use cp and install commands to build the base image, but each step fails. An image is built with no files, and thus making the system unbootable. mkinitcpio should detect errors when copying files and refuse to continue/generate an image. Additional info: mkinitcpio-35.1-1.1 File attach button doesn't work, but logs can be found on this post https://archlinuxarm.org/forum/viewtopic.php?f=15&t=16432 Steps to reproduce: Have a system with malfunctioning cp and/or install commands. Or bad initcpio fileset # mkinitcpio |
This task depends upon
Closed by Jelle van der Waa (jelly)
Monday, 18 September 2023, 17:44 GMT
Reason for closing: Moved
Additional comments about closing: https://gitlab.archlinux.org/archlinux/m kinitcpio/mkinitcpio/issues/209
Monday, 18 September 2023, 17:44 GMT
Reason for closing: Moved
Additional comments about closing: https://gitlab.archlinux.org/archlinux/m kinitcpio/mkinitcpio/issues/209
---
# cp A B;echo $?
cp: failed to clone 'B' from 'A': Inappropriate ioctl for device
1
It *does* return a failure code. I would like to see the mkinitcpio script check failure codes and not proceed blindly.
Even later on as you see in the logs, it tries to manipulate libraries with depmod which fails because the libs are corrupt(empty). Those commands are working property but, returning error codes caused by the above original issue
==> WARNING: errors were encountered during the build. The image may not be complete.
If one is manually running it yes its easy to catch and avoid. But when triggered *forcefully* by another process like pacman, that is pretty useless to an average user.
Maybe I should bring this to pacman? Build in temp and not destroy the boot image otherwise
Currently however mkinitcpio is probably not going to default with `set -e` so any scripts running `add_file` will need to check the error code manually and I think that is fine.