Arch Linux

Please read this before reporting a bug:
https://wiki.archlinux.org/title/Bug_reporting_guidelines

Do NOT report bugs when a package is just outdated, or it is in the AUR. Use the 'flag out of date' link on the package page, or the Mailing List.

REPEAT: Do NOT report bugs for outdated packages!
Tasklist

FS#48976 - [mkinitcpio] halt on error

Attached to Project: Arch Linux
Opened by ryuta (ryuta) - Saturday, 16 April 2016, 15:23 GMT
Last edited by Dave Reisner (falconindy) - Monday, 18 April 2016, 17:52 GMT
Task Type Feature Request
Category Arch Projects
Status Closed
Assigned To Dave Reisner (falconindy)
Architecture All
Severity Low
Priority Normal
Reported Version
Due in Version Undecided
Due Date Undecided
Percent Complete 100%
Votes 0
Private No

Details

I recently have compiled my kernel with mkinitcpio with a configured hook I had involuntarily deleted, so this kernel has failed to boot.
I search the mistake thanks to another kernel, and I found that the hook missed:
==> ERROR: Hook ... cannot be found

I think this would be preferable to halt mkinitcpio with error if a hook is missing or for any error.

Regards.
This task depends upon

Closed by  Dave Reisner (falconindy)
Monday, 18 April 2016, 17:52 GMT
Reason for closing:  Won't implement
Additional comments about closing:  There's only downsides to implementing the proposal, and the eventual conclusion seems to be more related to a pacman feature request than something to do with mkinitcpio.
Comment by Dave Reisner (falconindy) - Saturday, 16 April 2016, 15:56 GMT
mkinitcpio tells you 3 things in this case:

1) there's an error during the build: the hook cannot be found
2) there's a warning at the end of the build: the image may not be complete
3) the exit status of mkinitcpio is non-zero

On the assumption that you're ignoring all three of these things: if you're running mkinitcpio as part of a install script's post_upgrade or some hook, then halting entirely leaves you in a worse situation. If you don't halt, then you *might* get lucky and the image you built is just missing some auxiliary functionality which isn't 100% required for booting. If you halt, you have a much higher chance of having an unusable initramfs.
Comment by ryuta (ryuta) - Sunday, 17 April 2016, 11:48 GMT
My hook is essential.
Actually, I does not launch mkinitcpio directly, but pacman -U linux-custom-* from a script.
So there is indeed 1) and 2) but the return code of pacman is 0 after the installation is done with errors.

I use a modified kernel from the linux from abs (. abs core/linux).
I doesn't know very well the build process, but maybe there is a problem in the .INSTALL who should not ignore mkinitcpio return code :

post_install () {
# updating module dependencies
echo ">>> Updating module dependencies. Please wait ..."
depmod ${KERNEL_VERSION}
echo ">>> Generating initial ramdisk, using mkinitcpio. Please wait..."
mkinitcpio -p linux${KERNEL_NAME}
}

post_upgrade() {
if findmnt --fstab -uno SOURCE /boot &>/dev/null && ! mountpoint -q /boot; then
echo "WARNING: /boot appears to be a separate partition but is not mounted."
fi

# updating module dependencies
echo ">>> Updating module dependencies. Please wait ..."
depmod ${KERNEL_VERSION}
echo ">>> Generating initial ramdisk, using mkinitcpio. Please wait..."
mkinitcpio -p linux${KERNEL_NAME}

if [ $(vercmp $2 3.13) -lt 0 ]; then
echo ">>> WARNING: AT keyboard support is no longer built into the kernel."
echo ">>> In order to use your keyboard during early init, you MUST"
echo ">>> include the 'keyboard' hook in your mkinitcpio.conf."
fi
}
Comment by Dave Reisner (falconindy) - Sunday, 17 April 2016, 12:25 GMT
So you still get 2 out of 3 of the indicators. What should the install script do if mkinitcpio fails? Re-raise the third error? You still don't solve the problem of requiring user intervention to fix the broken config regardless of whether or not mkinitcpio exits early on the missing hook.
Comment by ryuta (ryuta) - Monday, 18 April 2016, 17:45 GMT
What should the install script do if mkinitcpio fails?
If mkinitcpio fails, or if the linux package uses the return code of mkinitcpio to fail the install, nothing will be installed and the previous working kernel would stay.

My script is run automatically and I automate the process for not caring about it.
The 0 return code from pacman prevent to automatically manage this problem.
Pacman usually fail on error without installing or replacing problematic package. This "rule" is violated for this package which is critical and can lead to replace a working kernel to a wrong one.
Comment by Dave Reisner (falconindy) - Monday, 18 April 2016, 17:52 GMT
You're describing something that would be a feature of pacman, and doesn't currently exist.

I'm closing this, because there's nothing mkinitcpio can or will do to help you here. Please read pacman's output to avoid shooting yourself in the foot in the future.

Loading...