grub2 prompt vs LVM

T.C. Hollingsworth tchollingsworth at gmail.com
Fri Mar 30 02:49:07 UTC 2012


On Thu, Mar 29, 2012 at 3:12 PM, Braden McDaniel <braden at endoframe.com> wrote:
> I've had an rpm upgrade from Fedora 15 tio 16 go slightly sideways and I've
> wound up with a grub prompt upon boot.  I found
> <https://fedoraproject.org/wiki/GRUB_2>; alas, it seems to be missing
> information about what one does when one's root partition is on an LVM
> volume.

By "rpm upgrade" I assume you mean yum upgrade? Yum upgrades don't
update the bootloader to GRUB2, only anaconda/preupgrade is smart
enough to figure that out, so the only way you'd be running GRUB2 is
if you updated it manually. GRUB1 is *supposed* to still work fine in
the interim, though apparently that didn't work out so well for you.
;-)

The good news here is that GRUB1 knew nothing about LVM, so you have
to have a seperate /boot partition, which is all GRUB cares about.
Fedora's initramfs does the hard work with LVM.  So even though GRUB2
now speaks LVM, it doesn't have to deal with it in your case.

> Do I need a Live CD to recover at this point?

Yes, that would be best.  Make sure it matches the arch of the
installed system so you can chroot into your installation if
necessary.

The prescription for repairing your bootloader from should be
something like this:

Become root.  `sudo` doesn't work on Fedora live media so just:
su -

Activate your LVM volumes:
vgchange -a y
lvchange -a y

Mount your root partition somewhere (run `lvdisplay` if you're not
sure of the device path):
mkdir /mnt/root
mount /dev/mapper/vg_hostname-lv_root /mnt/root

Mount your /boot partition into it (run `print all` in `parted` if
your not sure of the device):
mount /dev/sdX# /mnt/root/boot

Verify that your boot partition is copacetic.  Make sure there's a
kernel and initramfs that has .fc16 in it:.  Then, check
/etc/default/grub and make sure that the GRUB_CMDLINE_LINUX variable
mentions your LVM logical volume.  There should be a kernel argument
that looks like
"rd.lvm.lv=vg_hostname/lv_root"  If there is not, copy the one from
/mnt/root/boot/grub/menu.lst or add one in that format that matches
your configuration.

Now you can install GRUB2:
grub2-install --boot-directory=/mnt/root/boot

Next, chroot into your root paritition.  (I think grub2-mkconfig is
smart enough to not need this, but still, it can't hurt.)
chroot /mnt/root

Generate a grub configuration file.  (Remember, you're chrooted now so
/boot is your real boot, not the live media's.)
grub2-mkconfig -o /boot/grub2/grub.cfg

Finally, make sure it finds the F16 kernel you verified the existence
of earlier, either by looking at what grub2-mkconfig spits out to the
screen or checking grub.cfg.

With any luck, nothing else will go wrong and you can now reboot into F16.

-T.C.


More information about the users mailing list