FS#60272 - [mkinitcpio] initramfs created without modules needed for booting with root fs on USB hard drive
Attached to Project:
Arch Linux
Opened by Ferdinand Bachmann (Ferdi265) - Monday, 01 October 2018, 20:17 GMT
Last edited by Dave Reisner (falconindy) - Tuesday, 09 October 2018, 14:18 GMT
Opened by Ferdinand Bachmann (Ferdi265) - Monday, 01 October 2018, 20:17 GMT
Last edited by Dave Reisner (falconindy) - Tuesday, 09 October 2018, 14:18 GMT
|
Details
## Description:
After installing linux-4.18.11, the mkinitcpio pacman hook creates an unbootable initramfs (fallback works) when booting with the root filesystem on a USB hard drive because the usb_storage and uas modules are not added to the initramfs. ## Additional info: => package versions: linux: 4.18.11 (problem doesn't appear when downgrading to 4.18.10) mkinitcpio: 24-2 => USB hard drive details: UGreen USB 3.0 2.5inch SATA hard drive enclosure ## Steps to reproduce: 1.) setup a root filesystem on a USB hard drive 2.) boot correctly on stable kernel 3.) update to testing kernel 4.) reboot 5.) see linux not find the root filesystem ## Workaround Add "usb_storage" and "uas" to the MODULES list in /etc/mkinitcpio.conf ## Discussion I'm not sure what is causing this problem. Interestingly, mkinitcpio wasn't updated in the update that broke, and downgrading linux fixes the initramfs again, so I'm guessing some change in the linux package was responsible. (building the initramfs for linux-4.18.11 on a running linux-4.18.11 (via fallback) creates a broken initramfs as well) The file list diff between the two linux packages shows some usb-related kernel module files were removed (maybe they were instead linked into the kernel?), but I don't know much about the detailed changes between the two versions. I can add further tests if needed and hope to get this fixed soon. |
This task depends upon
Closed by Dave Reisner (falconindy)
Tuesday, 09 October 2018, 14:18 GMT
Reason for closing: Fixed
Additional comments about closing: testing/mkinitcpio-24-3
Tuesday, 09 October 2018, 14:18 GMT
Reason for closing: Fixed
Additional comments about closing: testing/mkinitcpio-24-3
for details see this thread https://bbs.archlinux.org/viewtopic.php?pid=1810776#p1810776
Everette88 has provided a link with the change for linux-hardened https://git.archlinux.org/svntogit/packages.git/commit/trunk?h=packages/linux-hardened&id=4982113940e5e828df27b1ca64225f424fcbed47
That shows USB modules moved to 'buitlt in' so anyone booting from certain setups fail.
Thanks, qinohe
$ shuf -n1 /lib/modules/$(uname -r)/modules.builtin
kernel/drivers/base/regmap/regmap-mmio.ko
$ modprobe regmap-mmio; echo $?
0
No problems there... mkinitcpio knows very well how to deal with builtins. It ignores them, because there's nothing to be done, nothing to load. The functionality is initialized with the kernel and always available.
@Dave, Thanks, my module is now in mkinitcpio and system is booting.
my output, slightly different of course:
$ shuf -n1 /lib/modules/$(uname -r)/modules.builtin
kernel/drivers/usb/host/ohci-hcd.ko
$ modprobe regmap-mmio; echo $?
0
Do I understand correct, module is loading but system is not able to use it, you write it quite cryptic ;-)
Thanks, mark
[0] https://bbs.archlinux.org/viewtopic.php?id=240328
working:
MODULES=(i2c_hid i2c_designware_core i2c_designware_platform usb_storage uas)
BINARIES=()
FILES=()
HOOKS=(base udev autodetect modconf block filesystems keyboard fsck)
not working:
MODULES=(i2c_hid i2c_designware_core i2c_designware_platform)
Thanks, mark
Upon inspection of the mkinitcpio code, the block hook does the following:
[code]
# usb
if add_checked_modules -f '(_cs|sl811_hcd|isp116x_hcd)' '/usb/host'; then
blockdevs+=(['usb_storage?']=1 ['sd_mod?']=1 ['sr_mod?']=1)
add_checked_modules '/drivers/usb/storage/'.
fi
[/code]
It only adds usb_storage if at least one module matching this regex is found by add_checked_modules.
On my system, these are "ehci_pci" and "xhci_pci", both modules which are now builtins.
What does add_checked_modules do?
It adds modules using add_module, but only if a matching module exists in all_modules and the autodetected module list (skipping the autodetect list on fallback)
The problem is now that all_modules just lists modules using "find" on the kernel module directory -- ignoring builtin modules.
This means that the block hook now thinks that no usb support is needed and proceeds without adding the usb_storage modules.
I think this could be fixed by also checking the list of builtins, but I don't know how I would patch that.
Definitely a bug in mkinitcpio proper, and not just a packaging issue.
Also the patchset kernels seem to be impacted (ie. ck). Makes sense, they're usually based off of the linux package in core.
Confirming also fallback does work. Lastly, confirming same results when specifying usb_storage in modules for mkinitcpio.conf, and it boots up just fine.
Please include the output of 'mkinitcpio -v', particularly if the patch works for you.
patched /usr/lib/initcpio/install/block - removed 'uas - usb_storage' and ran 'mkinitcpio -p linux' reboot, emergency shell.
mark
Here is the gist with the logs (patched and unpatched version without workaround): https://gist.github.com/Ferdi265/36cc4ecaa217596e45424ca607258da6
TL;DR:
unpatched: default doesn't include usb-storage.ko or uas.ko, fallback includes both
pathced: default includes usb-storage.ko, but not uas.ko, fallback includes usb-storage.ko, but not uas.ko
So autodetect was fixed, but it broke non-autodetect instead.
https://gist.github.com/Ferdi265/9f1059aaef79279125d886e6711c025d
as you can see, uas is detected
$ sudo mkinitcpio -v -k /boot/vmlinuz-linux -c /etc/mkinitcpio.conf -g /boot/initramfs-linux-3.img > patched
$ ls -l /etc/mkinitcpio.conf
-rw-r--r-- 1 root root 2490 6. Okt 2017 /etc/mkinitcpio.conf
$ ls -l /etc/mkinitcpio.d/linux.preset
-rw-r--r-- 1 root root 375 4. Okt 03:00 /etc/mkinitcpio.d/linux.preset
$ grep usb-sto patched
adding module: usb-storage
[code]
add_checked_modules '/drivers/usb/storage/'
[/code]