Ubuntu

initramfs-tools lvm2-hookscript won't include lvm.conf and claim devices it shouldn't

Reported by Dennis W. on 2008-07-07
56
This bug affects 5 people
Affects Status Importance Assigned to Milestone
drbd8 (Ubuntu)
Undecided
Unassigned
Nominated for Hardy by Numérigraphe
initramfs-tools (Ubuntu)
Undecided
Unassigned
Nominated for Hardy by Numérigraphe
lvm2 (Ubuntu)
High
Unassigned
Nominated for Hardy by Numérigraphe

Bug Description

Binary package hint: initramfs-tools

The default initramfs-tools hookscript for lvm does not include /etc/lvm/lvm.conf. If you need to exclude some devices through lvm.conf filters, like if you are using lvm on top of drbd, the base devices get claimed while executing the initrd and drbd etc. will fail.

Fix:
Include these lines in /usr/share/initramfs-tools/hooks/lvm2:

mkdir -p ${DESTDIR}/etc/lvm
cp -p /etc/lvm/lvm.conf ${DESTDIR}/etc/lvm/lvm.conf

Ubuntu Version:
Hardy (8.04)

Related branches

Luke Yelavich (themuso) wrote :

What version of Ubuntu are you using?

Dennis W. (dennis-wolff) on 2008-07-28
description: updated
Maxim Doucet (maximdoucet) wrote :

I also encounter this problem in the same configuration: LVM on top of DRBD.

Here's the setup:
 * a DRBD device is created from a standard partition (ie. /dev/sda6). The drbd device is named /dev/drbd0
 * /dev/drbd0 is a LVM's PV (Physical Volume): pvcreate /dev/drbd0
 * this DRBD's Physical Volume contains a LVM Volume Group (VG) which itself contains several LVM Logical Volumes (ie. /dev/mapper/vgstor-lv1)

Because /dev/drbd0 is a device based on /dev/sda6, we have to make sure that LVM does not use /dev/sda6 when it gets initalized. In other words, /dev/drbd0 must be the device to use for LVM's initialization. This is done thanks to a filter in /etc/lvm/lvm.conf which rejects all devices but DRBD ones. Here's the LVM rule inside /etc/lvm/lvm.conf:

    filter = [ "a|/dev/drbd.*|", "r|.*|" ]

Now indeed everything works fine... until the next boot.

Here's the problem on next boot: as described in the bug, the initramfs-tools hookscript doesn't include for /etc/lvm/lvm.conf. The consequence is that all devices are scanned for LVM tags, in order to create Logical Volumes devices in /dev/mapper/.

In my exemple, because /dev/sda6 is not filtered during initramfs's boot, the Logical Volume /dev/mapper/vgstor-lv1 is created. Now, /etc/init.d/drbd is launched later in the boot sequence. It tries to use /dev/sda6 to create /dev/drbd0 but it fails saying:

     /dev/drbd0: Failure: (114) Lower device is already claimed. This usually means it is mounted.

A dirty workaround is to delete the LVM device with:
    dmsetup remove /dev/mapper/vgstor-lv1

... then to launch DRBD.

The good fix is of course to take care to include /etc/lvm/lvm.conf with the initramfs-tools hookscript just as described in the bug.

Problem encountered on a default Ubuntu 8.10 Server edition.

Ante Karamatić (ivoks) wrote :

This is not a bug in drbd, but in LVM.

Changed in drbd8:
status: New → Invalid
Maxim Doucet (maximdoucet) wrote :

Yes, this is actually not an LVM bug but I think that in a standard setup this bug doesn't affect the system...

But when you are using the particular setup "LVM on DRBD", you are directly faced with the problem because DRBD simply can't be launched on the next reboot after setup.

So that's why I choosed to mark this bug also as a DRBD one : to let people using DRBD know about this issue. They are the most able to encounter the bug.

This is somekind of a "link" between DRBD and this bug. Maybe it's not the best way to show it ? I don't know if there's another way.

Ante Karamatić (ivoks) wrote :

lvm2 package should drop a hook for it's configuration in initramfs.

Changed in lvm2 (Ubuntu):
importance: Undecided → High
status: New → Confirmed
Simon Eisenmann (longsleep) wrote :

Please add

mkdir -p ${DESTDIR}/etc/lvm
cp -p /etc/lvm/lvm.conf ${DESTDIR}/etc/lvm/lvm.conf

to the lvm hook. This does no harm and helps a lot with drbd.

I have almost given up with drbd and ubuntu cause of this issue until i was pointed to this bug entry.

Problem exists in jaunty (9.04) as well.

Colin Watson (cjwatson) wrote :

I've uploaded a fix for lvm2. I don't think initramfs-tools itself requires any changes, so I'm marking that task Invalid.

Changed in initramfs-tools (Ubuntu):
status: New → Invalid
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package lvm2 - 2.02.39-0ubuntu11

---------------
lvm2 (2.02.39-0ubuntu11) karmic; urgency=low

  * Copy /etc/lvm/lvm.conf into the initramfs (LP: #246324).

 -- Colin Watson <email address hidden> Wed, 15 Jul 2009 13:52:21 +0100

Changed in lvm2 (Ubuntu):
status: Confirmed → Fix Released
Darik Horn (dajhorn) wrote :

This hook patch is needed to run backported kernels on Hardy systems with root-in-lvm and partitionless PVs because Ubuntu kernels after 2.6.24 need "sysfs_scan = 0" set in the lvm.conf file. Without it, a Hardy system can hang at the "waiting for root file system" boot message.

The change that was applied to the Karmic package also applies to the older lvm2-2.02.26-1ubuntu9 package that is in Hardy. I've got it in a PPA here:

  https://launchpad.net/~dajhorn/+archive/hardy-backports

To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Duplicates of this bug

Other bug subscribers