Skip to contentSkip to conversation

lvm does not work when included in core.img [resend]

DISCUSSION Jan Nieuwenhuizen 2 participants 8 messages Jan 8, 2008 – Jan 27, 2008

lore
Share & tools
lore
#0 lore raw

[resend from 2007-12-08]

Hi,

I'm trying out Grub2 to for a setup with root on lvm, and it almost works :-) (grub2 looks great, btw!) If I install grub on a non-lvm partition without lvm preloaded in core.img, it works fine. It looks as if the lvm module is defunct when it is loaded from core.img: ls shows no lvm devices.

Whenever I `insmod lvm' after grub starts (ie: from the grub rescue command line reading from a non-lvm partition, or from within grub.cfg with grub's root and grub.cfg on a non-lvm partition), ls will show my lvm devices.

Here is what I do

    grub-mkimage --output=/boot/grub/core.img lvm ext2 pc gpt biosdisk
    grub-setup --root-device='(lvmraid-lvm0)' '(hd0)'

(no errors)

mount |grep '/ '
/dev/mapper/lvmraid-lvm0 on / type ext3 (rw,errors=remount-ro)

(reboot)

grub rescue> set
prefix=(lvmraid-lvm0)/boot/grub
root=lvmraid-lvm0
grub rescue> insmod normal
error: unknown device
grub rescue> lsmod
Name Ref Count Dependencies
biosdisk 1
gpt 1
pc 1
ext2 1 fshelp
fshelp 2
lvm 1
grub rescue> ls
(hd0) (hd0,1) (hd0,5) (hd0,6) (hd0) (hd1,1) (hd1,5) (hd1,6) grub rescue> rmmod lvm
grub rescue> insmod (hd1,1)/boot/grub/lvm.mod grub rescue> ls
(lvmraid-lvm0) ...
grub rescue> insmod normal
grub rescue> normal

and the menu appears.

Any ideas? I'm using grub-pc 20071101-CVS from Ubuntu (on x86_64), but I also tried a core.img built using today's CVS.

Greetings,
Jan.

/boot/grub/grub.cfg
#
# DO NOT EDIT THIS FILE
#
# It is automaticaly generated by /usr/sbin/update-grub using templates

# from /etc/grub.d and settings from /etc/default/grub
#

### BEGIN /etc/grub.d/00_header ###
set default=2
set timeout=5
set root=(lvmraid-lvm0)
font (lvmraid-lvm0)/usr/share/grub/unifont.pff
set gfxmode=640x480
insmod gfxterm
insmod vbe
terminal gfxterm
### END /etc/grub.d/00_header ###

### BEGIN /etc/grub.d/10_hurd ###
### END /etc/grub.d/10_hurd ###

### BEGIN /etc/grub.d/10_linux ###

menuentry "Debian GNU/Linux, linux 2.6.22-14-generic" {
        linux   (lvmraid-lvm0)/boot/vmlinuz-2.6.22-14-generic
root=/dev/mapper/lvmraid-lvm0 ro 
        initrd  (lvmraid-lvm0)/boot/initrd.img-2.6.22-14-generic
}
menuentry "Debian GNU/Linux, linux 2.6.22-14-generic (single-user
mode)" {
        linux   (lvmraid-lvm0)/boot/vmlinuz-2.6.22-14-generic
root=/dev/mapper/lvmraid-lvm0 ro single 
        initrd  (lvmraid-lvm0)/boot/initrd.img-2.6.22-14-generic
}
menuentry "Debian GNU/Linux, linux 2.6.20-16-generic" {
        linux   (lvmraid-lvm0)/boot/vmlinuz-2.6.20-16-generic
root=/dev/mapper/lvmraid-lvm0 ro 
        initrd  (lvmraid-lvm0)/boot/initrd.img-2.6.20-16-generic-lvm0
}
menuentry "Debian GNU/Linux, linux 2.6.20-16-generic (single-user
mode)" {
        linux   (lvmraid-lvm0)/boot/vmlinuz-2.6.20-16-generic
root=/dev/mapper/lvmraid-lvm0 ro single 
        initrd  (lvmraid-lvm0)/boot/initrd.img-2.6.20-16-generic
}

### END /etc/grub.d/10_linux ###

### BEGIN /etc/grub.d/20_memtest86+ ###
menuentry "Memory test (memtest86+)" {
linux (lvmraid-lvm0)/boot/memtest86+.bin
}
### END /etc/grub.d/20_memtest86+ ###

Signature · 2 lines
Jan Nieuwenhuizen <[email protected]> | GNU LilyPond - The music typesetter
http://www.xs4all.nl/~jantien       | http://www.lilypond.org
#1 lore raw
Quoted 10 lines · Jan Nieuwenhuizen

[resend from 2007-12-08]

Hi,

I'm trying out Grub2 to for a setup with root on lvm, and it almost works :-) (grub2 looks great, btw!) If I install grub on a non-lvm partition without lvm preloaded in core.img, it works fine. It looks as if the lvm module is defunct when it is loaded from core.img: ls shows no lvm devices.

Quoted 4 lines

Whenever I `insmod lvm' after grub starts (ie: from the grub rescue command line reading from a non-lvm partition, or from within grub.cfg with grub's root and grub.cfg on a non-lvm partition), ls will show my lvm devices.

It's a known bug, but nobody has time to fix it.

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 4 lines · Robert Millan
Quoted 2 lines

It looks as if the lvm module is defunct when it is loaded from core.img: ls shows no lvm devices.

It's a known bug, but nobody has time to fix it.

Ah, that's a pity. Booting from lvm that's one of grub2's major features from my point of view...

Any hints on how I could dive into this?

Greetings,
Jan.

Signature · 2 lines
Jan Nieuwenhuizen <[email protected]> | GNU LilyPond - The music typesetter
http://www.xs4all.nl/~jantien       | http://www.lilypond.org
#3 lore raw
Quoted 11 lines · Jan Nieuwenhuizen
Quoted 4 lines · Robert Millan
Quoted 2 lines

It looks as if the lvm module is defunct when it is loaded from core.img: ls shows no lvm devices.

It's a known bug, but nobody has time to fix it.

Ah, that's a pity. Booting from lvm that's one of grub2's major features from my point of view...

Any hints on how I could dive into this?

If you mean getting lvm loaded, see my other mail. Otherwise, can you describe your problem ? When I said it's a known bug I was referring to the grub-install part.

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 /.)
#4 lore raw
In reply to Jan Nieuwenhuizen
Quoted 4 lines · Jan Nieuwenhuizen

Here is what I do

    grub-mkimage --output=/boot/grub/core.img lvm ext2 pc gpt biosdisk

To be more specific, grub-install already knows how to figure out that you need ext2', and whether you need pc' or `gpt' (you don't need both), but it needs to learn how to detect that lvm is needed.

There are other problems, I think, but this is the one that comes to mind right now.

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 5 lines · Robert Millan
Quoted 1 line
    grub-mkimage --output=/boot/grub/core.img lvm ext2 pc gpt biosdisk

To be more specific, grub-install already knows how to figure out that you need ext2', and whether you need pc' or `gpt' (you don't need both), but it needs to learn how to detect that lvm is needed.

Yes, I found that too, but that's of little use if lvm does not work when it's included in core.img. I figured: first report a bug on grub, only once that works go for grub-install?

Quoted 2 lines

There are other problems, I think, but this is the one that comes to mind right now.

I don't care so much for grub-install.

Greetings,
Jan.

Signature · 2 lines
Jan Nieuwenhuizen <[email protected]> | GNU LilyPond - The music typesetter
http://www.xs4all.nl/~jantien       | http://www.lilypond.org
#6 lore raw

Re: lvm does not work when included in core.img [FIXED]

In reply to Jan Nieuwenhuizen
Quoted 2 lines · Jan Nieuwenhuizen
    grub-mkimage --output=/boot/grub/core.img lvm ext2 pc gpt biosdisk
    grub-setup --root-device='(lvmraid-lvm0)' '(hd0)'

For the record: lvm should be last, ie

   grub-mkimage --output=/boot/grub/core.img ext2 pc gpt biosdisk lvm

works for me [pc gpt] is optional, but quite handy if you have non-lvm partitions around.

Jan.

Signature · 2 lines
Jan Nieuwenhuizen <[email protected]> | GNU LilyPond - The music typesetter
http://www.xs4all.nl/~jantien       | http://www.lilypond.org
#7 lore raw

Re: lvm does not work when included in core.img [FIXED]

Quoted 11 lines · Jan Nieuwenhuizen
Quoted 2 lines · Jan Nieuwenhuizen
    grub-mkimage --output=/boot/grub/core.img lvm ext2 pc gpt biosdisk
    grub-setup --root-device='(lvmraid-lvm0)' '(hd0)'

For the record: lvm should be last, ie

   grub-mkimage --output=/boot/grub/core.img ext2 pc gpt biosdisk lvm

works for me [pc gpt] is optional, but quite handy if you have non-lvm partitions around.

Hi Jan,

I can't get the layout you described using debian-installer. Please can you tell me how to reproduce your problem? Which layout do I have to setup, etc.

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