Bug 209473

Summary: mkinitrd --rootdev LABEL=foo doesn't work as expected
Product: [Fedora] Fedora Reporter: Mark McLoughlin <markmc>
Component: mkinitrdAssignee: Peter Jones <pjones>
Status: CLOSED RAWHIDE QA Contact: David Lawrence <dkl>
Severity: medium Docs Contact:
Priority: medium    
Version: 9CC: hdegoede, k.georgiou, martin.wyser, triage
Target Milestone: ---   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard: bzcl34nup
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2009-02-04 21:17:53 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Attachments:
Description Flags
The patch in question. none

Description Mark McLoughlin 2006-10-05 15:24:12 UTC
If you have a rootdev-by-LABEL, it appears the mkinitrd resolves the label to a
specific device and hardcodes that device path in the initrd.

i.e. you get

  mkrootdev -t ext3 -o defaults,ro /dev/sdb

rather than

  mkrootdev -t ext3 -o defaults,ro LABEL=foo

See #209110 for the background.

It looks like the change occurred at revision 1.315 (2005/09/29):

-elif ! echo $rootdev | cut -c1-6 |grep -q "LABEL=" ; then
-    rawrootdev=$rootdev

+if echo $rootdev | cut -c1-6 | grep -q "LABEL=" ; then
+    majmin=$(stat -c "%t:%T" /dev/root)
+    if [ -n "$majmin" ]; then
+        dev=$(find /sys/block -name dev | while read device ; do \
+             echo "$majmin" | cmp -s $device && echo $device ; done)
+       if [ -n "$dev" ]; then
+            vecho "Found root device $dev for $rootdev"
+                rootdev=$dev

Comment 1 Martin Wyser 2006-11-03 10:32:53 UTC
I have a similar problem with FC5 2.6.17.1.2145, where init in the initrd
contains the lines
resume LABEL=SWAP-hda2
mkrootdev -t ext3 -o defaults,ro hda1

After changing the partition numbers, this causes problems.  The hda1 is
especially troublesome, as the kernel is started with a root=LABEL=/ parameter,
which is just ignored in the initrd.

Comment 2 Bug Zapper 2008-04-03 18:26:41 UTC
Based on the date this bug was created, it appears to have been reported
against rawhide during the development of a Fedora release that is no
longer maintained. In order to refocus our efforts as a project we are
flagging all of the open bugs for releases which are no longer
maintained. If this bug remains in NEEDINFO thirty (30) days from now,
we will automatically close it.

If you can reproduce this bug in a maintained Fedora version (7, 8, or
rawhide), please change this bug to the respective version and change
the status to ASSIGNED. (If you're unable to change the bug's version
or status, add a comment to the bug and someone will change it for you.)

Thanks for your help, and we apologize again that we haven't handled
these issues to this point.

The process we're following is outlined here:
http://fedoraproject.org/wiki/BugZappers/F9CleanUp

We will be following the process here:
http://fedoraproject.org/wiki/BugZappers/HouseKeeping to ensure this
doesn't happen again.

Comment 3 Rubin Simons 2008-04-23 14:25:13 UTC
I can confirm this bug still exists in RHEL 4 ES U5. I ran into it last week;
specify root as "LABEL=/" in /etc/fstab; watch mkinitrd skip lvm-specific steps
like copying {lvm.static, lvm.conf} and including more than only the dm-mod
module. It seems to me that bugs #212124, #214184, #246626, #294051, #327181 and
#426671 are related to this (not sure if they're strictly dupes). 

Comment 4 Peter Jones 2008-04-23 15:51:40 UTC
So, on the one hand this behavior is clearly wrong.  On the other, you should
still get "root=LABEL=/" in grub.conf , and that overrides mkrootdev's
behaviour, so it should still boot.  Mark, when you see this, is it actually not
booting?

Comment 5 Mark McLoughlin 2008-04-23 15:57:58 UTC
Oh, I think I was doing this in the context of stateless iSCSI root ...

So, I would have been booting via PXE and wanted the initrd to find the
appropriate device based on label, because some systems might have a SCSI disk
already (making the iSCSI disk e.g. /dev/sdb) and others might not

Pretty vague on the details now, though

Comment 6 Peter Jones 2008-04-23 16:01:10 UTC
OK, I /think/ the patch I just applied will solve this for you.

Comment 7 Peter Jones 2008-04-23 16:02:24 UTC
Created attachment 303521 [details]
The patch in question.

Comment 8 Peter Jones 2008-04-23 16:03:14 UTC
That patch will be in 6.0.52 .

Comment 9 Bug Zapper 2008-05-14 02:24:03 UTC
Changing version to '9' as part of upcoming Fedora 9 GA.
More information and reason for this action is here:
http://fedoraproject.org/wiki/BugZappers/HouseKeeping

Comment 10 Hans de Goede 2009-02-04 21:17:53 UTC
I've just build a new mkinitrd in rawhide (6.0.76) which streamlines the storage device handling somewhat. This should definitely fix --rootdev LABEL= , if not please reopen.