Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 255237 - sys-fs/lvm2-2.02.42: init.d/lvm should have 'need device-mapper' line
Summary: sys-fs/lvm2-2.02.42: init.d/lvm should have 'need device-mapper' line
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: New packages (show other bugs)
Hardware: All Linux
: High normal (vote)
Assignee: Robin Johnson
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-01-17 05:25 UTC by Mike Kazantsev
Modified: 2009-01-17 22:46 UTC (History)
2 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Mike Kazantsev 2009-01-17 05:25:52 UTC
On my system LVM init script starts before device-mapper, and, naturally, fails, resulting in failed fsck and localmount.
After that it makes another attempt to start and runs smoothly, because device-mapper gets started at that point. In fact, it starts right after lvm fails ;)
Both are present at the 'boot' runlevel.

I have several LVM partitions, which are necessary for normal operation, so starting LVM during boot is essential.
I have root on LVM partition as well, so I use initrd to mount it, and initrd itself have no trouble setting up all the mappings with device-mapper/lvm and simple vgscan/lvscan, mounting rootfs afterwards.

Fix is simple: just add 'device-mapper' to 'need ...' line, along with dmcrypt in /etc/init.d/lvm.

I'm quite sure that LVM always depends on device mapper, so I cant't quite understand whit this dependency should be omitted in initscript.


Reproducible: Always

Steps to Reproduce:
1. Add LVM mounts to fstab
2. Reboot the system

Actual Results:  
lvm fails to create lv device nodes

Expected Results:  
lvm successfully creates all existing lv nodes

Configuration is a laptop, where my actual hard drive have four primary partitions:

/dev/sda1: /boot ext3
/dev/sda2: unused

/dev/sda3: dm-encrypted partition (serpent-lrw-benbi:sha256)
  Mapped (decrypted) by initrd, as /dev/mapper/lvcrypt. Contains one LVM pv, used for vg 'prime' with three lvs:
  /dev/prime/core /home ext4
  /dev/prime/varz /var ext4
  /dev/prime/swap swap

/dev/sda4: one pv, used for vg 'aux' with three lvs:
  /dev/aux/portage /usr/portage xfs
  /dev/aux/extent /opt xfs
  /dev/aux/crypt /mnt/crypt reiserfs


sys-fs/lvm2-2.02.42
sys-fs/device-mapper-1.02.28
sys-apps/baselayout-2.0.0
sys-apps/openrc-0.4.1-r1


# rc-config list | g -e device-mapper -e lvm
  device-mapper             boot
  lvm                       boot


rc boot logging started at Sat Jan 17 14:41:16 2009

* Setting system clock using the hardware clock [Local Time]...
 [ ok ]
* Autoloaded 0 module(s)
* ERROR: cannot start lvm as device-mapper would not start
*   device-mapper uses addon code which is deprecated
*   and may not be available in the future.
* Setting up dm-crypt mappings...
* dm-crypt mapping lvcrypt is already configured
 [ ok ]
* Checking local filesystems ...
/sbin/fsck.xfs: /dev/aux/root does not exist
* Operational error
 [ !! ]
* Remounting root filesystem read/write...
 [ ok ]
* Updating /etc/mtab...
 [ ok ]
* Invalidating stale software suspend images...
 [ ok ]
* Mounting local filesystems...
mount: special device /dev/aux/portage does not exist
mount: special device /dev/aux/extent does not exist
mount: special device /dev/aux/crypt does not exist
mount: special device /dev/prime/varz does not exist
mount: special device /dev/prime/core does not exist

...

* About to start the service lvm
*   lvm uses addon code which is deprecated
*   and may not be available in the future.
* Setting up the Logical Volume Manager...
 [ ok ]

...

...and the rest is mostly ok, except for services that depends on data in /var or /home, which aren't mounted until you manually type 'mount -a', which works, since LVM is started at this point.
Comment 1 Mike Kazantsev 2009-01-17 05:34:23 UTC
Oh, forgot to mention that /dev/sda4-based vg 'aux' also contains /dev/aux/root lv (xfs), which is successfully mapped and mounted by initrd.
Comment 2 Wormo (RETIRED) gentoo-dev 2009-01-17 22:27:33 UTC
Thanks for reporting this issue (and your solution). Assigning to maintainers.
Comment 3 Robin Johnson archtester Gentoo Infrastructure gentoo-dev Security 2009-01-17 22:46:13 UTC
LVM itself depends on the device-mapper module. It does NOT depend on the device-mapper init script.

The device-mapper init script really should be called dmtab, because it creates all of the volumes defined in /etc/dmtab (After loading the device-mapper module if needed).

The LVM script loads the device-mapper module, and followed by pvscan, vgscan, vgchange.

"need device-mapper" is not correct. "after device-mapper" is.

However, you can still create systems that are foiled by that route.

Use DM-RAID on your disks, with LVM in the middle, and another DM layer on top of that.

I added "after device-mapper" for now.