2

I've been reading many articles about Grub with LOTS of examples for configuration. Exactly 0 contain configuration for a separate root and boot partition on LVM.

This is my configuration:

menuentry 'Kali' {
insmod lvm
insmod gzio
insmod part_msdos
insmod ext2
set root=lvm/triagia-kaliboot
search --no-floppy --fs-uuid --set=root f1eb6904-c17e-40b7-8740-60e67b8d04de
linux /vmlinuz-4.0.0-kali1-amd64 root=/dev/mapper/triagia-kaliboot setkmap=us
initrd /initrd.img-4.0.0-kali1-amd64
}

And this is my LVM setup:

  sda3                 8:3    0 396.9G  0 part  
  ├─triagia-kaliboot 254:0    0   500M  0 lvm   
  ├─triagia-kaliroot 254:1    0    50G  0 lvm   
  └─triagia-kaliswap 254:2    0     4G  0 lvm 

This boots up but does not initiate, I think I'm using the wrong config regarding where the / is and where the /boot is.

1

You're telling the kernel to look for a root directory in: root=/dev/mapper/triagia-kaliboot. I think you need to change this.

Edit the kernel parameter used by GRUB2 to find a root directory by changing this line in your /etc/default/grub:

GRUB_CMDLINE_LINUX_DEFAULT="root=/dev/mapper/triagia-kaliroot" .

Since you are using LVM for your /boot partition under GRUB2, you also need to add this line to your /etc/default/grub:

GRUB_PRELOAD_MODULES="lvm".

When done issue an # update-grub or a # grub-mkconfig -o /boot/grub/grub.cfg command, and reboot.

  • I also boot another OS with this Grub so the LINUX_DEFAULT line allready contains this: GRUB_CMDLINE_LINUX_DEFAULT="resume=UUID=21f80129-085c-4f2d-9492-66adfd8d2ce2 quiet " and I am afraid that adding the root= part to this will break my other menu option. Thats why I try to solve this in 40_custom. – Thijs Aug 23 '15 at 19:57
  • In that case I think its safe to edit your menuentry into the /etc/grub.d/40_custom file, just change the line linux /vmlinuz-4.0.0-kali1-amd64 root=/dev/mapper/triagia-kaliboot setkmap=us to linux /vmlinuz-4.0.0-kali1-amd64 root=/dev/mapper/triagia-kaliroot setkmap=us, and if you have not already done it, add the GRUB_PRELOAD_MODULES="lvm" line to your /etc/default/grub. – nomad.rc Aug 23 '15 at 20:34
  • Thanks for your effort. I did try the line change for linux_default and now my system won't boot anymore and other systems can't find the LVM Volume Group on the disk. I give up on Grub + LVM + Luks and will erase the disk now. I'll look for something more stable. – Thijs Aug 23 '15 at 20:55
  • I feel sure that there is a means to do what you are trying to do in editing /etc/grub.d/40_custom, and sorry i could not help I've got an identical setup as yours except my /boot partition is not inside the LVM container. – nomad.rc Aug 23 '15 at 21:03

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.