# Custom initram, new lvm2 with udev not booting

## Saundersx

The new lvm2-2.02.183 which now incorporates some udev stuff will not work in an initram environment. It basically gives me this endlessly for different drives/partitions

```
WARNING: Device /dev/sdXXX not initialized in udev database even after waiting 10000000 microseconds.
```

I have tried adding the lvm.conf from the gentoo wiki https://wiki.gentoo.org/wiki/Custom_Initramfs#LVM but it seems to be completely ignored (also added some extra goodies to mine for testing)

```
global {

    use_lvmetad = 0

} 

devices {

    obtain_device_list_from_udev = 0

}

activation {

    udev_sync = 0

    udev_rules = 0

}
```

Rolling back to lvm2-2.02.145-r2 fixes it. I would prefer to keep using the new version if possible as it apparently contains a bunch of bugfixes. Any ideas?

----------

## Saundersx

I'm getting quite adept at finding issues that seem to affect only me.

In the end I think this is a bug in lvm2 if the page in the Gentoo wiki is correct. The lvm.conf is definitely loaded and subsequently ignored (as "lvm config" shows). In the end the workaround was throwing in a 

```
USE="-udev" /usr/bin/emerge -1 --quiet-build --quiet-fail --fail-clean --backtrack=0 lvm2
```

into my script. If this isn't fixed by next release I'll file a bug.

----------

## NeddySeagoon

Saundersx,

What use is udev in the initrd?

devtmpfs populates /dev and the initrd all runs as root, so udev setting permissions is not required.

Nothing survives the initrd passing control the the real root filesystem, so /dev permissions don't matter.

----------

## Saundersx

I'm not following what you mean. No I don't need nor want udev in init. Read the wiki link I posted to see what I'm trying to do.

----------

## NeddySeagoon

Saundersx,

I use usr/gen_init_cpio from the kernel directly. I don't have a lvm.conf but I made my last initrd about a year ago.

My /root/initrd/initramfs_list and the init script may help.

That does root in LVM on top of raid5. / (root) /usr and /var are all separate logical volumes.

Provided devtmpfs gets mounted on /dev, either with the kernel option or an init script line, /dev is populated for you.

----------

## Saundersx

Yeah mines pretty similar, just throw encryption in the mix. I may do what you have in your script down the road if lvm doesn't get fixed.

----------

## brokendreams

I dont know exactly where the issue stems from but i dealt with this error too. I didn't see it until udev was upgraded to 240. A downgrade to udev-239 fixed it or so i thought. Once i installed an older version of udisks (1.5x) it came back. So i disabled the udev flag on sys-fs/lvm2 and rebuilt. Error disappeared completely again. So try disabling udev on sys-fs/lvm2. I still have other problems with wirh udev-240 that im tracking down too...most notably no keyboard on the console. So id prob stay away from that udev version as well.

----------

## marcan

Throw this in /etc/lvm/lvm.conf (in your initramfs)

```
devices {

        multipath_component_detection = 0

        md_component_detection = 0

}

```

Yeah, this is horribly non-discoverable. I just spent 45 minutes figuring this out.

----------

## dwarfjay

I came across this issue and your advice solve my problem. thank you

----------

## jmbsvicetto

 *marcan wrote:*   

> Throw this in /etc/lvm/lvm.conf (in your initramfs)
> 
> ```
> devices {
> 
> ...

 

Thanks, this had been preventing me from updating my kernel from 4.19.6 on as I had failed to realize the issue was with lvm2.

----------

## equus

Thanks marcan,

I used your tip to modify my initramfs init script as follows :

```

        lvm2_config="

                global{

                        use_lvmetad = 0

                        }

                devices{

                        multipath_component_detection = 0

                        md_component_detection = 0

                        }"

        echo "Activating root volume $rootLV..."

        /sbin/lvm lvchange --sysinit --config "$lvm2_config" -ay $rootLV || rescue_shell

        echo "Creating all partition nodes..."

        /sbin/lvm vgscan --config "$lvm2_config" --mknodes || rescue_shell

```

My configuration is lvm/dmcrypt/mdraid.

----------

