Skip to contentSkip to conversation

(still ?) root on LVM problems

DISCUSSION Jean-Christophe Haessig 2 participants 11 messages Jan 12, 2008 – Jan 13, 2008

lore
Share & tools
lore
#0 lore raw

Hi,

I had a peek at the ML lately and saw a few messages reporting some success in using GRUB2 as a bootloader in a root-on-lvm setup.

I decided to give it a try, so I grabbed it from CVS, but unfortunately it didn't work, just as in my previous tries :(

I can't get why but grub-setup insists on overwriting some important blocks at the beginning of the disk, thus destroying the lvm metadata. Hopefully, there was no harm, I'm used to it so I had backups.

Still, I'd like to understand why it doesn't work on my setup… Does (as I understand) root-on-lvm mean everything-on-lvm including /boot ? Could someone help me find what I do wrong ?

Thanks,
JC

Signature · 3 lines
AVIS : Falsifier le contenu et usurper l'identité des auteurs des courriers
électroniques étant simplissime, j'exhorte mes correspondants à utiliser un
logiciel de signature électronique. Lire : http://openpgp.vie-privee.org/
#1 lore raw
Quoted 7 lines · Jean-Christophe Haessig

Hi,

I had a peek at the ML lately and saw a few messages reporting some success in using GRUB2 as a bootloader in a root-on-lvm setup.

I decided to give it a try, so I grabbed it from CVS, but unfortunately it didn't work, just as in my previous tries :(

I fixed some bugs affecting root-on-lvm, but not all. They aren't in CVS yet, though.

Which reminds me this would be a good time to commit, since nobody objected to my last patch.

Signature · 5 lines
Robert Millan

<GPLv2> I know my rights; I want my phone call!
<DRM> What use is a phone call, if you are unable to speak?
(as seen on /.)
#2 lore raw
Quoted 6 lines · Robert Millan
Quoted 5 lines · Jean-Christophe Haessig

Hi,

I had a peek at the ML lately and saw a few messages reporting some success in using GRUB2 as a bootloader in a root-on-lvm setup.

Quoted 8 lines
Quoted 2 lines

I decided to give it a try, so I grabbed it from CVS, but unfortunately it didn't work, just as in my previous tries :(

I fixed some bugs affecting root-on-lvm, but not all. They aren't in CVS yet, though.

Which reminds me this would be a good time to commit, since nobody objected to my last patch.

Try latest CVS.

You'll still have to add "pc" (or "gpt") module manually (--modules parameter).

Signature · 5 lines
Robert Millan

<GPLv2> I know my rights; I want my phone call!
<DRM> What use is a phone call, if you are unable to speak?
(as seen on /.)
#3 lore raw
Quoted 1 line · Robert Millan

Try latest CVS.

Done, but no success.

Quoted 1 line

You'll still have to add "pc" (or "gpt") module manually (--modules parameter).

These modules are for grub itself, right ? My problems seem to be caused by the installer. I can boot my system from a GRUB floppy by issuing the correct commands.
When I try to install GRUB on the hard disk, the installer writes in the MBR (first block), the second block, and a number of subsequent blocks (this seems to be the grub image). The LVM metadata is overwritten by this. Isn't the installer supposed to detect where it can safely write ?

Thanks,
JC

Signature · 3 lines
AVIS : Falsifier le contenu et usurper l'identité des auteurs des courriers
électroniques étant simplissime, j'exhorte mes correspondants à utiliser un
logiciel de signature électronique. Lire : http://openpgp.vie-privee.org/
#4 lore raw
Quoted 8 lines · Jean-Christophe Haessig
Quoted 1 line · Robert Millan

Try latest CVS.

Done, but no success.

Quoted 1 line

You'll still have to add "pc" (or "gpt") module manually (--modules parameter).

Quoted 7 lines

These modules are for grub itself, right ? My problems seem to be caused by the installer. I can boot my system from a GRUB floppy by issuing the correct commands.
When I try to install GRUB on the hard disk, the installer writes in the MBR (first block), the second block, and a number of subsequent blocks (this seems to be the grub image). The LVM metadata is overwritten by this. Isn't the installer supposed to detect where it can safely write ?

Try re-running grub-setup with verbose flag on, and see what it prints.

Signature · 5 lines
Robert Millan

<GPLv2> I know my rights; I want my phone call!
<DRM> What use is a phone call, if you are unable to speak?
(as seen on /.)
#5 lore raw
Quoted 1 line · Robert Millan

Try re-running grub-setup with verbose flag on, and see what it prints.

orion:/test/grub2# /usr/local/sbin/grub-setup --verbose '(hd1)'
grub-setup: info: prefix = /grub
grub-setup: info: changing current directory to /dev/mapper
grub-setup: info: getting the size of /boot/grub/boot.img
grub-setup: info: reading /boot/grub/boot.img
grub-setup: info: getting the size of /boot/grub/boot.img
grub-setup: info: getting the size of /boot/grub/core.img
grub-setup: info: reading /boot/grub/core.img
grub-setup: info: getting the size of /boot/grub/core.img
grub-setup: info: the size of hd1 is 40088160
grub-setup: info: setting the root device to `vg0-boot'
grub-setup: info: opening the device `/dev/hdc'
grub-setup: info: will embed the core image into after the MBR
grub-setup: info: dos partition is -2, bsd partition is -2, prefix is
(vg0-boot)/grub
grub-setup: info: opening the device `/dev/hdc'
grub-setup: info: opening the device `/dev/hdc'
grub-setup: info: opening the device `/dev/hdc'
grub-setup: info: opening the device `/dev/hdc'

What is this stuff about dos and bsd partitions ? There are no dos nor bsd partitions on that disk.
Grub-setup states that it "will embed the core image into after the MBR", which I believe is bad, since the lvm data is here.

Thanks,
JC

Signature · 3 lines
AVIS : Falsifier le contenu et usurper l'identité des auteurs des courriers
électroniques étant simplissime, j'exhorte mes correspondants à utiliser un
logiciel de signature électronique. Lire : http://openpgp.vie-privee.org/
#6 lore raw
Quoted 24 lines · Jean-Christophe Haessig
Quoted 1 line · Robert Millan

Try re-running grub-setup with verbose flag on, and see what it prints.

orion:/test/grub2# /usr/local/sbin/grub-setup --verbose '(hd1)'
grub-setup: info: prefix = /grub
grub-setup: info: changing current directory to /dev/mapper
grub-setup: info: getting the size of /boot/grub/boot.img
grub-setup: info: reading /boot/grub/boot.img
grub-setup: info: getting the size of /boot/grub/boot.img
grub-setup: info: getting the size of /boot/grub/core.img
grub-setup: info: reading /boot/grub/core.img
grub-setup: info: getting the size of /boot/grub/core.img
grub-setup: info: the size of hd1 is 40088160
grub-setup: info: setting the root device to `vg0-boot'
grub-setup: info: opening the device `/dev/hdc'
grub-setup: info: will embed the core image into after the MBR
grub-setup: info: dos partition is -2, bsd partition is -2, prefix is
(vg0-boot)/grub
grub-setup: info: opening the device `/dev/hdc'
grub-setup: info: opening the device `/dev/hdc'
grub-setup: info: opening the device `/dev/hdc'
grub-setup: info: opening the device `/dev/hdc'
Quoted 2 lines

What is this stuff about dos and bsd partitions ? There are no dos nor bsd partitions on that disk.

Don't worry about that, it's just unfortunate naming.

Quoted 2 lines

Grub-setup states that it "will embed the core image into after the MBR", which I believe is bad, since the lvm data is here.

LVM doesn't reserve any space at the beginning of its partitions? Most filesystems do.

Signature · 5 lines
Robert Millan

<GPLv2> I know my rights; I want my phone call!
<DRM> What use is a phone call, if you are unable to speak?
(as seen on /.)
#7 lore raw
Quoted 2 lines · Robert Millan

LVM doesn't reserve any space at the beginning of its partitions? Most filesystems do.

I created a new empty volume group with an empty disk to do some testing. The lvm label identifying physical disks can be put in sector 0, 1, 2 or 3 (default 1). Grub needs the MBR and one sector for its "boot image", so that's okay.
However, LVM metadata starts at block 5 and apparently spans all the way down to the first logical volume, so there's no room for the core image. Would it be possible to create a small LV at the beginning of the disk and put the image there ?

Signature · 3 lines
AVIS : Falsifier le contenu et usurper l'identité des auteurs des courriers
électroniques étant simplissime, j'exhorte mes correspondants à utiliser un
logiciel de signature électronique. Lire : http://openpgp.vie-privee.org/
#8 lore raw
Quoted 5 lines · Jean-Christophe Haessig
Quoted 2 lines · Robert Millan

LVM doesn't reserve any space at the beginning of its partitions? Most filesystems do.

Quoted 8 lines

I created a new empty volume group with an empty disk to do some testing. The lvm label identifying physical disks can be put in sector 0, 1, 2 or 3 (default 1). Grub needs the MBR and one sector for its "boot image", so that's okay.
However, LVM metadata starts at block 5 and apparently spans all the way down to the first logical volume, so there's no room for the core image. Would it be possible to create a small LV at the beginning of the disk and put the image there ?

What happens if you comment out the "must_embed = 1" line?

Signature · 5 lines
Robert Millan

<GPLv2> I know my rights; I want my phone call!
<DRM> What use is a phone call, if you are unable to speak?
(as seen on /.)
#9 lore raw
Quoted 1 line · Robert Millan

What happens if you comment out the "must_embed = 1" line?

orion:/test/grub2# /usr/local/sbin/grub-setup --verbose '(hd1)'
grub-setup: info: prefix = /grub
grub-setup: info: changing current directory to /dev/mapper
grub-setup: info: getting the size of /boot/grub/boot.img
grub-setup: info: reading /boot/grub/boot.img
grub-setup: info: getting the size of /boot/grub/boot.img
grub-setup: info: getting the size of /boot/grub/core.img
grub-setup: info: reading /boot/grub/core.img
grub-setup: info: getting the size of /boot/grub/core.img
grub-setup: error: unknown device
Signature · 3 lines
AVIS : Falsifier le contenu et usurper l'identité des auteurs des courriers
électroniques étant simplissime, j'exhorte mes correspondants à utiliser un
logiciel de signature électronique. Lire : http://openpgp.vie-privee.org/
#10 lore raw

Le dimanche 13 janvier 2008 à 21:09 +0100, Jean-Christophe Haessig a écrit :

Quoted 5 lines · Robert Millan
Quoted 2 lines

What happens if you comment out the "must_embed = 1" line?

orion:/test/grub2# /usr/local/sbin/grub-setup --verbose '(hd1)'

[…]

Quoted 1 line

grub-setup: error: unknown device

I looked for where the error came from (kern/device.c) and printf'ed the device name : vgT-boot, which is the name of the logical volume containing /boot for my tests. Of course, this is no physical device Grub can make use of…

JC

Signature · 3 lines
AVIS : Falsifier le contenu et usurper l'identité des auteurs des courriers
électroniques étant simplissime, j'exhorte mes correspondants à utiliser un
logiciel de signature électronique. Lire : http://openpgp.vie-privee.org/