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#34285 - [mkinitcpio] fails to include filesystem modules in initramfs in linux 3.9-rc2

Attached to Project: Arch Linux
Opened by Tomas M. (eldragon) - Tuesday, 12 March 2013, 20:47 GMT
Last edited by Dave Reisner (falconindy) - Wednesday, 13 March 2013, 02:45 GMT
Task Type Bug Report
Category Packages: Extra
Status Closed
Assigned To No-one
Architecture All
Severity Low
Priority Normal
Reported Version
Due in Version Undecided
Due Date Undecided
Percent Complete 100%
Votes 0
Private No

Details

Description:
First: i do not know if i should be placing this here yet. but just a heads up:

since v3.9-rc2,
commit 7f78e0351394052e1a6293e175825eb5c7869507
fs: Limit sys_mount to only request filesystem modules.

makes mkinitcpio not able to include the ext4 filesystem module into the initial ramdisk.
adding fs-ext4 to the modules list fixes the problem.

im not sure if this is

a) my mistake (kernel config option missing?)
b) problem in mkinitcpio
c) kernel bug.

i have bisected the error to the aforementioned commit.
the commit author has been asking for distro specific details, so it might be a mkinitcpio thing. devs here should be more qualified to provide additional insight.

This task depends upon

Closed by  Dave Reisner (falconindy)
Wednesday, 13 March 2013, 02:45 GMT
Reason for closing:  Implemented
Additional comments about closing:  Not really a bug for mkinitcpio, but improved nonetheless:
https://projects.archlinux.org/mkinitcpi o.git/commit/?id=366bb180a
Comment by Dave Reisner (falconindy) - Tuesday, 12 March 2013, 21:00 GMT
Sounds like a major regression in the kernel if you ask me.

I have little time to investigate this myself. If you're going to file a bug against mkinitcpio, you really need to dig into this yourself and find out where it actually fails.
Comment by Tomas M. (eldragon) - Tuesday, 12 March 2013, 23:34 GMT
Dave,

thanks for the reply. i can take the time to test, but i dont know how mkinitcpio works. im actually reading the script now trying to figure it out. But i wouldnt count on it :(
i didnt know filing a bug report meant actually having to fix things. i found a problem. reported it! and of course im willing to help test. or should i just wait till this actually hits you?

i got in contact with the patch submitter and he is trying to chip in too.

also i forgot to mention: adding fs-ext4 to the modules list in mkinitcpio.conf fixes the problem.
Comment by Dave Reisner (falconindy) - Wednesday, 13 March 2013, 00:12 GMT
I'm not asking for a fix, I'm asking for more detail in your bug report. Most of what's here is about the kernel change, but you're filing against mkinitcpio without much mention of it. What does the backup image contain? What is your /etc/mkinitcpio.conf? Perhaps you have some verbose output to attach...


If you want some direction through the mkinitcpio codebase, the bulk of the module handling is in add_module() in the functions file. You'll see that modinfo is used to resolve aliases and parse filepath/dependencies/firmware. Soooo how does modinfo behave on its own? What does 'modinfo ext4' do?
Comment by Dave Reisner (falconindy) - Wednesday, 13 March 2013, 00:35 GMT
and FWIW, the image I generate looks fine. kmod tools all work just fine, too.
Comment by Eric W. Biederman (ebiederm) - Wednesday, 13 March 2013, 01:53 GMT
So I have tracked it down and the bug is mine. The problem is that while I added extra aliases and caused request_module to use them, I failed to take into account that there were other uses of the existing module aliases for filesystems in the kernel.

mkinitcpio is one of those existing users.

The problem case is having an ext3 root filesystem and using the ext4 module. So I am going to readd the MODULE_ALIAS("ext3") to the ext4 module, and for all of the other similar fileystems.

While tracking this down I realized that mkinitcpio is going to want to use the new aliases. So I expect you will want to apply the following patch. But no rush.

Hopefully my description and the patch below are enough to describe what was going on and what happened.

I had asked Tomas to get us in touch because I wasn't at all certain what mkinitcpio in Arch linux was doing.

diff --git a/install/autodetect b/install/autodetect
index 907a85a..982ef1c 100644
--- a/install/autodetect
+++ b/install/autodetect
@@ -9,6 +9,10 @@ build() {

# treat this as an alias, since ext3 might be aliased to ext4.
IFS=$'\n' read -rd '' -a resolved < \
+ <(modprobe -d "$_optmoduleroot" -S "$KERNELVERSION" -R "fs-$1" 2>/dev/null)
+
+ # treat this as an alias, since ext3 might be aliased to ext4.
+ IFS=$'\n' read -rd '' -a resolved < \
<(modprobe -d "$_optmoduleroot" -S "$KERNELVERSION" -R "$1" 2>/dev/null)

for r in "${resolved[@]}"; do

Comment by Dave Reisner (falconindy) - Wednesday, 13 March 2013, 02:09 GMT
Yup, that all makes sense. Thanks Eric.
Comment by Dave Reisner (falconindy) - Wednesday, 13 March 2013, 02:26 GMT
Actually, I don't quite understand the patch -- specifically, the need to resolve *twice*. If I re-add your aliases, then kmod writes a module.alias file that looks like:

alias fs-ext4 ext4
alias ext3 ext4
alias ext2 ext4
alias fs-ext3 ext4
alias fs-ext2 ext4

So whitelisting "ext2" in the autodetect hook would call "add_if_avail ext2", which would call "modprobe -R fs-ext2", which yields "ext4".

Isn't the only needed change here just to prefix "fs-" when resolving the filesystem name to a module?

edit: duh... doing that alone wouldn't be backwards compatible.

Loading...