Bug 146095 - mkinitrd bugs for root filesystem on LVM
Summary: mkinitrd bugs for root filesystem on LVM
Status: RESOLVED FIXED
Alias: None
Product: SUSE Linux 10.1
Classification: openSUSE
Component: Installation (show other bugs)
Version: Beta 2
Hardware: i686 Other
: P5 - None : Normal (vote)
Target Milestone: ---
Assignee: Hannes Reinecke
QA Contact: Klaus Kämpf
URL:
Whiteboard:
Keywords:
Depends on: 145928
Blocks:
  Show dependency treegraph
 
Reported: 2006-01-27 06:25 UTC by Carl-Daniel Hailfinger
Modified: 2006-01-30 13:33 UTC (History)
1 user (show)

See Also:
Found By: Development
Services Priority:
Business Priority:
Blocker: ---
Marketing QA Status: ---
IT Deployment: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Carl-Daniel Hailfinger 2006-01-27 06:25:10 UTC
+++ This bug was initially created as a copy of Bug #145928 +++

After reboot (directly after the first stage of the installation), I'm faced with the error message "not found -- exiting to /bin/sh".
The kernel can't find its root filesystem because the vgchange binary isn't in
the initrd.

And mkinitrd has a VERY subtle bug where a file from /proc is read in the
following way:

while read a b; 
do
// something
done </proc/devices

That fails (actually, only the first few bytes will be read) because the file is
on /proc! Never assume files in /proc can be handled the normal way. You need
cat to read them completely.

After fixing that bug in my local sources, at least mkinitrd recognized it had
a root filesystem on LVM. However, it included everything except dmsetup in the
initrd, so the boot failed again.

To reproduce the mkinitrd problem, try this script. It will only show you the
first 2 lines of /proc/devices. Since /proc/devices is has listed 0 bytes as
size, it is debatable whether that is an ash bug.

#!/bin/ash
while read a;
do
echo $a
done </proc/devices

mkinitrd, function block_driver, line 742 suffers from that ash quirk.

Even when all of the bugs above are corrected, there is another problem. My LVM setup has been created with 10.0 and 10.1beta2 thinks this is an LVM2 setup and doesn't run "vgchange -a y".
Comment 1 Hannes Reinecke 2006-01-30 10:49:35 UTC
I've fixed up mkinitrd to now read:

    major=$(devmajor $devn)
    driver=$(cat /proc/devices | sed -n "s/^[ ]*$major \(.*\)/\1/p;/Block/p" | tail -1)
    case "$driver" in
	Block*)
	    return 1
	    ;;
	*)
	    echo $driver
	    return 0
	    ;;
    esac
Comment 2 Hannes Reinecke 2006-01-30 11:37:27 UTC
And I'v added a call to vgchange  even for the LVM2 case.
dmsetup is now also included.
Comment 3 Carl-Daniel Hailfinger 2006-01-30 13:33:54 UTC
Great! Could you attach the current mkinitrd to this bug so I can test it?