Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I am trying to make my Ubuntu machine boot from a /boot LVM, and it seems that the default core.img does not support LVM, so I am trying to figure out what modules I need to supply to grub-mkimage in order to make it find my /boot. So far no luck -- core_lvm.img either becomes too big (> 32k) or does not actually see my LVM vg.

Example:

grub-mkimage -P i386-pc -o /boot/grub/core_lvm.img part_msdos ext2 lvm
grub-setup -c core_lvm '(hd0)'

Upon boot this gets me into a rescue prompt where I can only see (hd0-*), not my LVM vg. What other modules do I need for LVM to work?

I'm continuing to experiment with this, but it would be great if someone has already done this and could tell me why the above is not enough for it to work.

share|improve this question
    
Are you sure you have lvm2 installed? –  Wolfer Jan 24 '13 at 10:14
1  
It is GRUB that cannot manage to see the partitions, not the initrd. The initrd works. Currently I am working around this by booting from a /boot partition, but it would be neat to eliminate that. –  clacke Jan 24 '13 at 11:21
    
Did you run insmod lvm on the Grub command line? Then do something like set root=lvm/lvm_group_name-lvm_logical_boot_partition_name. Please post your Grub configuration and read this. :) –  gertvdijk Jan 24 '13 at 12:17
    
insmod lvm on the Grub command line does not work as any modules would be ... on the LVM /boot partition. :-) –  clacke Feb 3 '13 at 18:57
    
That Arch wiki page on Grub is a great read. –  clacke Feb 3 '13 at 18:57

1 Answer 1

You also need to prepare and embed small early-grub.cfg file into core.img (grub-mkimage -c early-grub.cfg). It should set proper root and prefix variables and call configfile $prefix/grub.cfg. Example:

set root=lvm/lvm_group_name-lvm_logical_boot_partition_name
set prefix=($root)/boot/grub
configfile $prefix/grub.cfg
share|improve this answer
    
Also note, grub-mkimage automatically track dependant modules. –  clover Feb 19 at 21:39
    
Aha, interesting! Will take a look at this. If it works, I will set your answer as the accepted one. There is probably a badge for getting an answer accepted a whole year after the question was originally asked. :-) –  clacke Feb 23 at 22:42

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.