grub2 prompt vs LVM

Braden McDaniel braden at endoframe.com
Fri Mar 30 07:02:36 UTC 2012


On Thu, 2012-03-29 at 19:49 -0700, T.C. Hollingsworth wrote:
> 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?

I do.

>  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 instructions at

        https://fedoraproject.org/wiki/Upgrading_Fedora_using_yum

say to do:

        /sbin/grub-install BOOTDEVICE

But after upgrading the packages, I had no "grub-install"; only
"grub2-install".  So I did that.  Clearly it was insufficient.

Now that I look at that page again, I see in the "Fedora 15 -> 16"
section, it talks about running "grub2-mkconfig".  I missed that part
before.  Whoops.

Your instructions were very helpful.  Thank you.  For the possible
benefit of others, I'll mention a few thingsā€¦

> 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

You meant to write

        $ grub2-install --boot-directory=/mnt/root/boot /dev/sdX

> 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

FYI, I tried it without chroot'ing and it didn't work.  (Which could
just mean I did it wrong.)

> 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

This part failed for me until I went back and did

  $ sudo mount -o bind /dev /mnt/root/dev

before chroot'ing.

> 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.

Problem solved.  Thanks again.

-- 
Braden McDaniel <braden at endoframe.com>



More information about the users mailing list