This service will be undergoing maintenance at 00:00 UTC, 2016-09-28. It is expected to last about 1 hours
Bug 204768 - PATCH: fix booting by LABEL from lvm or dmraid
PATCH: fix booting by LABEL from lvm or dmraid
Status: CLOSED RAWHIDE
Product: Fedora
Classification: Fedora
Component: mkinitrd (Show other bugs)
rawhide
All Linux
medium Severity medium
: ---
: ---
Assigned To: Peter Jones
David Lawrence
:
: 203241 (view as bug list)
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2006-08-31 10:12 EDT by Hans de Goede
Modified: 2007-11-30 17:11 EST (History)
1 user (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2006-10-25 04:11:03 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:


Attachments (Terms of Use)
blkid.tab as it should be (848 bytes, text/plain)
2006-08-31 10:12 EDT, Hans de Goede
no flags Details
blkid.tab after running nash (or /sbin/mkinitrd) (1.40 KB, text/plain)
2006-08-31 10:13 EDT, Hans de Goede
no flags Details
Patch fixing the adding of doulble entries to blkid.tab (2.86 KB, patch)
2006-08-31 10:14 EDT, Hans de Goede
no flags Details | Diff
Improved patch as discussed on IRC (2.14 KB, patch)
2006-08-31 16:59 EDT, Hans de Goede
no flags Details | Diff
Patch as applied to CVS (2.35 KB, patch)
2006-09-01 14:10 EDT, Peter Jones
no flags Details | Diff
/sbin/mkinitrd patch fixing the root argument to mkrootdev in case of lvm by LABEL boot (1.20 KB, patch)
2006-09-03 01:48 EDT, Hans de Goede
no flags Details | Diff

  None (edit)
Description Hans de Goede 2006-08-31 10:12:43 EDT
Creating a clean /etc/blkid/blkid.tab by removing it and then running blkid as
root gives me the first attached blkid.tab (named blkid.good)

When I run "echo nash-resolveDevice "LABEL=/" | sudo /sbin/nash --forcequiet"
next I get the attached blkid.bad file, notice the last 4 lines which are
doubles of the first 4 devices (same devno, etc) using (obsolete) /dev/dm-x
device paths instead of /dev/mapper/XXXX device paths

This is caused by block_find_fs_by_keyvalue() from nash/block.c, this function
iterates over /sys/block calling
blkid_get_dev(c->cache, dev->dev_path, BLKID_DEV_NORMAL);
For each entry using /dev/dm-x as dev->dev_path for my lvm volumes as these are
called dm-x under /sys/block.

The attached patch fixes this. It fixes this by checking if dev->dev_path is
/dev/dm-# and in that case iterate over /dev/mapper/* and call blkid_get_dev()
for /dev/mapper/* instead of on /dev/dm-#. It only does the iteration if # is 0
since there is no use in doing this more then once.
Comment 1 Hans de Goede 2006-08-31 10:12:43 EDT
Created attachment 135289 [details]
blkid.tab as it should be
Comment 2 Hans de Goede 2006-08-31 10:13:30 EDT
Created attachment 135290 [details]
blkid.tab after running nash (or /sbin/mkinitrd)
Comment 3 Hans de Goede 2006-08-31 10:14:38 EDT
Created attachment 135291 [details]
Patch fixing the adding of doulble entries to blkid.tab
Comment 4 Hans de Goede 2006-08-31 16:59:07 EDT
Created attachment 135333 [details]
Improved patch as discussed on IRC
Comment 5 Hans de Goede 2006-08-31 17:02:08 EDT
Changing summary although the attached patch indeed: "fixes mkinitrd (nash)
adding double/wrong lines to /etc/blkid/blkid.tab"

It also fixes booting by LABEL from lvm or dmraid, which is a quite a bit more
important.
Comment 6 Hans de Goede 2006-08-31 17:05:13 EDT
*** Bug 203241 has been marked as a duplicate of this bug. ***
Comment 7 Peter Jones 2006-09-01 14:10:04 EDT
Created attachment 135400 [details]
Patch as applied to CVS

Patch as applied to CVS
Comment 8 Peter Jones 2006-09-02 17:02:46 EDT
This works for me in 5.1.10-1 .  Can you test and close the bug if it works for you?
Comment 9 Hans de Goede 2006-09-03 01:48:57 EDT
Created attachment 135453 [details]
/sbin/mkinitrd patch fixing the root argument to mkrootdev in case of lvm by LABEL boot

I've tested mkinitrd-5.1-10 with booting a lvm root by LABEL and it works!

However it still specifies the root argument to the mkrootdev command as
/dev/dm-x, thus if the kernel doesn't have a root= argument and mkrootdev falls
back to his own root arg things will fail. This is because for some reason
/sbin/mkinitrd takes the devno from the root device returned by nash and then
searches /sys/block (which nash also does internally, so this is kinda useless)
and then finds /dev/dm-x for a /dev/mapper/XXXX root as the code in
/sbin/mkinitrd doesn't contain an exception for /dev/dm-x as the nash code now
does.

This patch fixes this by simply taking the rootdev value returned by nash, as
that was found by scanning /sys/block already.

---

Another concern I have is that for people who have /dev/dm-x as root in their
fstab grubby will put root=/dev/dm-x as kernel argument in /etc/grub.conf,
leading to the same problem. I'm thinking about writing a patch for this which
calls nashDmGetDevName() in the mkrootdev function when root is /dev/dm-x, the
problem is that we first have to create a devno for this, I think this is best
done by getting the major from /proc/devices (code already in dm.c) and using N
in /dev/dm-N as the minor. Will you take such a patch?
Comment 10 Hans de Goede 2006-10-25 04:11:03 EDT
I finally got confirmation from a friend of mine that this patch really fixes
the mentioned problem, so this bug can be closed now.

I'm opening seperate bugs for the other potential problems which I have noticed
and described in comment #9.

The wrong arch to mkrootdev patch is bug 212124 .

I'll do some further testing to confirm that booting with root=/dev/dm-X is
currently broken and if it is I'll file a seperate bug for that too.

Comment 11 Hans de Goede 2006-10-25 04:28:19 EDT
Booting with root=/dev/dm-X is indeed currently broken, I've filed this as bug
212126

Note You need to log in before you can comment on or make changes to this bug.