help-grub
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Trouble installing GRUB directly to LVM volume


From: P Orrifolius
Subject: Trouble installing GRUB directly to LVM volume
Date: Mon, 28 Nov 2011 16:58:58 +1300

Hello folks.

I'm having trouble getting GRUB to install and boot a vm within qemu, I'd
appreciate some help.  Please CC me on replies as I'm not subscribed to the
list.


I started out trying to install a Ubuntu 11.10 guest vm in qemu on Debian, it
all worked fine until it tried to install GRUB.  Now I'm trying to get GRUB
installed in a simpler direct chroot rather than in a vm.

What I've got now are two LVs, vm_root and vm_boot, that have a fully working
install of Ubuntu but no bootloader installed anywhere.

Effectively:

$lvcreate -L 64M -n vm_boot vg
$mkfs.ext4 /dev/vg/vm_boot
$lvcreate -L 10G -n vm_root vg
$mkfs.ext4 /dev/vg/vm_root
$lvcreate -L 4M -n vm_BOOTDISK vg
$fdisk /dev/vg/vm_BOOTDISK

[create one primary partition on last 500KB of device]

[install Ubuntu within vm on vm_root (as /dev/vdc) and vm_boot (as /dev/vdb),
grub install to vm_BOOTDISK (as /dev/vda) fails.]

Once I figured out tha vm_BOOTDISK needed a partition table (and I put a ext4
filesystem on the partition for good measure) I did actually manage to get grub
installed on vm_BOOTDISK by booting the vm with a rescue cd, mounting /dev/vdc,
/dev/vdb et al and doing a grub-install, however on rebooting the vm I just get:

error: no such device: <filesystem UUID of filesystem on vm_boot>
grub rescue>


So now I'm just trying to get grub installed onto vm_BOOTDISK from a chroot'd
environment:

$mount /dev/vg/vm_root /mnt/
$mount /dev/vg/vm_boot /mnt/boot
$form i in /dev /dev/pts /proc /sys; do mount -B $i /mnt$i; done
$chroot /mnt /bin/bash

chroot$apt-get purge grub grub-pc grub-common
chroot$apt-get install grub-pc grub-common

[everything looks ok but vg_BOOTDISK is *not* presented as an option to have
grub-install run automatically on... so I continue without installing grub]

chroot$grub-install /dev/vg/vm_BOOTDISK

Auto-detection of a filesystem of /dev/mapper/vg-vm_boot failed.
Try with --recheck.
If the problem persists please report this together with the output of
"/usr/sbin/grub-probe --device-map="/boot/grub/device.map" --target=fs
-v /boot/grub" to <address@hidden>

Using --recheck makes no difference.
Note that I do not have any device.map file.

chroot$/usr/sbin/grub-probe --device-map="/boot/grub/device.map"
--target=fs -v /boot/grub

/usr/sbin/grub-probe: info: cannot open `/boot/grub/device.map'.
...
/usr/sbin/grub-probe: info: changing current directory to /dev/mapper.
/usr/sbin/grub-probe: info: opening vg-vm_boot.
/usr/sbin/grub-probe: error: no such disk.

chroot$ls -l /dev/mapper/vg-vm_boot
lrwxrwxrwx 1 root root 7 2011-11-28 11:06 /dev/mapper/vg-vm_boot -> ../dm-7

If I run grub-mkdevicemap I get a device.map that just lists the two physical
devices on the host, but grub-install still fails.
Note that if I run grub-mkdevicemap within the vm it creates a device.map with
entries for vm_{root,boot,BOOTDISK}... but that doesn't help the 'no such
device error' on booting.


I'm stumped.  How do I get grub installed so I can boot the vm?  Any advice?


Thanks
P



reply via email to

[Prev in Thread] Current Thread [Next in Thread]