#3557 closed defect (fixed)
LVM (vgchange) hang & missing /dev/mapper/ entries during initramfs startup
Reported by: | Ian Macintosh | Owned by: | Bruce Dubbs |
---|---|---|---|
Priority: | high | Milestone: | |
Component: | BOOK | Version: | SVN |
Severity: | major | Keywords: | LVM, LVM boot, LVM root, initrd, initrd.img, initramfs, mkinitramfs |
Cc: |
Description
Summary:
- vgchange for mkinitramfs (init.in) needs --noudevsync switch.
- /etc/rc.d/init.d/udev needs udevadm trigger --action=change --type=devices
/usr/share/mkinitramfs/init.in
Refer: http://www.linuxfromscratch.org/blfs/view/svn/postlfs/initramfs.html
The generated /usr/share/mkinitramfs/init.in has the following line near the bottom (about 5 lines up) shortly before doing switch_root:
if [ -x /sbin/vgchange ] ; then /sbin/vgchange -a y > /dev/null ; fi
I found that this worked fine in some initial tests of an LVM root and LVM swap partition (with boot on the root LVM). I would see the message:
2 logical volume(s) in volume group "xx" now active
However, after creating a more extensive LVM structure, where for example /, /boot, swap, /root, /usr, /usr/src, /opt, /var, /var/log and /tmp were created, then it would hang on this line. Specifically, vgchange never exited.
It did output '10 logical volume(s) .... now active' and it did activate the volumes. I changed it to 'vgchange -ay &' and added a short rootdelay to give it some time to settle.
After booting the vgchange process was still running, though not using a measurable amount of CPU. It never exited in some 10 minutes of system usage on the test machine.
Digging thorough various similar bug reports on other systems it led me to suspect a udev synchronisation issue. Adding --noudevsync fixed it for me. I would like to recommend modifying the relevant line in /usr/share/mkinitramfs/init.in to read:
if [ -x /sbin/vgchange ]; then /sbin/vgchange --noudevsync -ay > /dev/null; fi
Missing LVM volumes in /dev/mapper/
However after fixing the problem above it failed after switch_root because the /dev/mapper/xx-yyyy entries were missing though they had previously existed after the first initramfs vgchange -ay. (I seem to remember finding they went missing after killing udevd just prior to switch_root)
I found the message http://archives.linuxfromscratch.org/mail-archives/lfs-support/2012-January/042134.html and adding the suggested line into the udevadm trigger section fixed the problem:
original code:
# Start the udev daemon to continually watch for, and act on, # uevents /lib/udev/udevd --daemon # Now traverse /sys in order to "coldplug" devices that have # already been discovered /sbin/udevadm trigger --action=add --type=subsystems /sbin/udevadm trigger --action=add --type=devices # Now wait for udevd to process the uevents we triggered /sbin/udevadm settle # If any LVM based partitions are on the system, ensure they # are activated so they can be used. if [ -x /sbin/vgchange ]; then /sbin/vgchange -a y >/dev/null; fi
add this:
/sbin/udevadm trigger --action=change --type=devices
resulting /etc/rc.d/init.d/udev section:
# Now traverse /sys in order to "coldplug" devices that have # already been discovered /sbin/udevadm trigger --action=add --type=subsystems /sbin/udevadm trigger --action=add --type=devices /sbin/udevadm trigger --action=change --type=devices # Now wait for udevd to process the uevents we triggered /sbin/udevadm settle
PS: udevadm trigger --action defaults to 'change' according to the manual, so --action could be left out if you're feeling concise.
PPS: I flagged it as high priority, major severity as LVM root & boot via initrd is a no go without it. Feel free to adjust if that is incorrect or simply bad form.
Change History (3)
comment:1 by , 12 years ago
Owner: | changed from | to
---|---|
Status: | new → assigned |
comment:2 by , 12 years ago
Resolution: | → fixed |
---|---|
Status: | assigned → closed |
This required changes to LFS as well as BLFS. Fixed in BLFS revision 10634 and LFS revision 9986.