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.


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.

  • 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

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
  • Also note, grub-mkimage automatically track dependant modules.
    – clover
    Feb 19 '14 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 '14 at 22:42
  • Where is the lines you wrote should I execute or place? Is it a shell command or content of config file?
    – fikr4n
    Jun 9 '16 at 13:18

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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