I have a setup with a grub2 bootloader, and the rest of the system on an encrypted partition (LVM-on-LUKS). I have two OSes installed inside of the LUKS container, Kali Sana and Debian 8, as well as a shared swap partition.

This was setup by installing Kali with full disk encryption, and then making room for Debian. The grub install is from Kali.

I am fully aware that it is simply easier to have a second /boot partition for Debian. However, given the way this was setup, there is no room left for the Debian bootloader, and resizing everything to make room will be a pain.

So, here is what I need to do under grub:

  • Mount the encrypted partition (already managed to do this)
  • Start initramfs and the kernel for Debian (This is where there is trouble).

I have done some research on this, and I am attempting to do this by editing the /boot/grub/custom.cfg file. After each edit, I have run sudo grub-mkconfig and sudo update-grub. Then I have restarted to see if it will boot. While it can decrypt the LUKS container, it can't find initramfs or the kernel.

Here is my custom.cfg file. Note: I am fuzzy on what all of this does. It is most likely completely wrong.

menuentry "Debian 8 Jessie"{
  insmod luks
  insmod lvm
  set root=/dev/Outsider-vg/Outsider-debianroot
  linux /boot/vmlinuz-3.16.0-4-amd64 root=/dev/Outsider-vg/Outsider-debianroot
  initrd /boot/initrd.img-3.16.0-4-amd64

Note about the above: cryptdevice=UUID=ffe7a64d-e552-4db9-b0f3-1e42be118059:cryptolvm was originally set root=/dev/sda5. This version of the file fails to decrypt the container. Note that I already know how to get this to work, I was just messing with it to see if changing it would help.

I have been referencing this link for help editing this file.

Basically, I need to know the syntax to point grub at the correct initramfs and vmlinuz files, after the LUKS partition has been decrypted. They are under the logical volume Outsider--debianroot. My only real issue is that I don't know how to do this.

I apologize for being somewhat vague. Part of the problem is that I am not sure what I am looking for. If you do not have an answer, but can direct me to a comprehensive guide to editing custom.cfg, that would also be appreciated. Please let me know if you need more details.

EDIT: Upon further research, here is what I have found:

Basically, I need to give Grub the correct path to a root directory which is on an LVM. After doing some digging around on the file system, I have found two paths which could work: /dev/mapper/volumeGroup-volumeName and /dev/volumeGroup/volumeName. In the case of the above example, they are /dev/mapper/Outsider--vg-Outsider--debianroot and /dev/Outsider-vg/Outsider-debianroot.

I need to know which is the path to the correct root directory, allowing that distro to boot. Either one is right, both need to be used together, or there is a different path which I am missing which I need to use instead. Any ideas?

Furthermore, what is the difference between these two paths? What do they each point to? What is the difference between /dev/mapper/volumeGroup and just /dev/volumeGroup?

EDIT 2: I believe that /dev/volumeGroup/volumeName is the correct path, based off of the end syntax for this tutorial. I will experiment with this and report back.

Note: I will come and clean this up later, when I have solved it.

  • If you've solved the problem, add it as an Answer, not as an edit to the post, please.
    – Jeff Schaller
    Mar 26 '17 at 19:04
  • This question is 4 years old, did you ever solve it?
    – Typewar
    Aug 15 '21 at 5:34

You should have something like:

menuentry 'Debian' --class debian --class gnu-linux --class gnu --class os {
  set gfxpayload=keep
  insmod gzio
  insmod ext2
  insmod fat
  echo  'Loading Linux ...'
  linux /boot/vmlinuz-3.16.0-4-amd64 cryptdevice=UUID=ffe7a64d-e552-4db9-b0f3-1e42be118059:cryptolvm root=/dev/Outsider-vg/Outsider-debianroot rw
  echo  'Loading initial ramdisk ...'
  initrd /boot/initrd.img-3.16.0-4-amd64

But note that insmod part_gpt should already be added in your grub.cfg. lvm and luks are not needed because it is the kernel that will handle it (you need proper kernel hooks), grub only load the linux image.

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.