FS#12389 - [mkinitcpio] filesystems passes invalid $FSTYPE to kinit

Attached to Project: Arch Linux
Opened by kludge (kludge) - Tuesday, 09 December 2008, 01:50 GMT
Last edited by Eric Belanger (Snowman) - Wednesday, 24 June 2009, 02:41 GMT
Task Type Bug Report
Category Packages: Core
Status Closed
Assigned To Thomas Bächler (brain0)
Architecture All
Severity Medium
Priority Normal
Reported Version None
Due in Version Undecided
Due Date Undecided
Percent Complete 100%
Votes 0
Private No

Details

Description:

/bin/fstype in the initcpio returns filesystems that do not correspond to kernel filesystem modules. /sbin/modprobe in line 54 of /lib/initcpio hooks/filesystems gives and error, but it's tossed to /dev/null instead of being handled. this produces a kernel panic after the hand-off to kinit.

see http://bbs.archlinux.org/viewtopic.php?id=55842 for detailed diagnosis.

i don't see a use-case where this isn't caused by user error (not setting $cryptdevice on the kernel command-line), but handling the error would be more helpful than allowing it to cause a kernel panic.

perhaps something like:

if /sbin/modprobe -q ${FSTYPE} >/dev/null 2>&1; then
kinit_params="${kinit_params} rootfstype=${FSTYPE}
else
err "There is no kernel module for filesystem ${FSTYPE} on specified root device ${root}"
echo "Dropping to a recovery shell... type 'exit' to reboot"
echo "NOTE: klibc contains no 'ls' binary, use 'echo *' instead"
echo ""
echo "If your root device is a logical volume on and encrypted block device"
echo "you *must* specify \"cryptdevice=/dev/encryptedBlockDevice:dm-crypt_mapping\""
echo "at the kernel command-line"
PS1="ramfs$ " /bin/sh -i
msg "Rebooting..."
/bin/reboot
fi

Additional info:

mkinitcpio 0.5.19-1

Steps to reproduce:

http://bbs.archlinux.org/viewtopic.php?id=55842

(wee... edge cases are fun!!!)
This task depends upon

Closed by  Eric Belanger (Snowman)
Wednesday, 24 June 2009, 02:41 GMT
Reason for closing:  Not a bug
Additional comments about closing:  Not a bug, was user error. Please reopen if necessary.
Comment by kludge (kludge) - Monday, 26 January 2009, 02:27 GMT
status?
Comment by Thomas Bächler (brain0) - Saturday, 06 June 2009, 21:47 GMT
We leave filesystem detection up to kinit now instead of explicitly doing it ourselves (at least that is what I am going to commit to git in a few minutes).
Comment by Thomas Bächler (brain0) - Sunday, 07 June 2009, 12:21 GMT
Okay, I looked at the thread now, and this is not an issue with the filesystems hook, but rather a complete user error (and installer error, the installer does not gracefully handle lvm and encryption):

The problem that we had the possibility to specify root=/dev/sdXY where sdXY was a LUKS container and it would automatically decrypt it and point root to /dev/mapper/root. This is deprecated now and was not very flexible, as an lvm on top of encryption was impossible this way. However, this option is still kept for backwards-compatibility.

Using root=/dev/sdXY where sdXY is a LUKS container that contains a LVM PV will fail hard, as it tries to mount the container, not the logical volume. I guess we can close this as "not a bug", agreed? I will add a message to the encrypt hook clarifying the situation about the deprecation of root= decryption.
Comment by kludge (kludge) - Sunday, 07 June 2009, 15:01 GMT
yup, total user error. i wasn't sure whether to file this as a 'bug' or 'feature request.' either way, handling fatal errors is better than blowing up. thanks!

Loading...