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.
Created attachment 135289 [details] blkid.tab as it should be
Created attachment 135290 [details] blkid.tab after running nash (or /sbin/mkinitrd)
Created attachment 135291 [details] Patch fixing the adding of doulble entries to blkid.tab
Created attachment 135333 [details] Improved patch as discussed on IRC
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.
*** Bug 203241 has been marked as a duplicate of this bug. ***
Created attachment 135400 [details] Patch as applied to CVS Patch as applied to CVS
This works for me in 5.1.10-1 . Can you test and close the bug if it works for you?
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?
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.
Booting with root=/dev/dm-X is indeed currently broken, I've filed this as bug 212126