Booting to an encrypted Debian install, which has /boot on LVM-on-LUKS
3
votes
2
answers
2712
views
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
cryptdevice=UUID=ffe7a64d-e552-4db9-b0f3-1e42be118059:cryptolvm
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](https://wiki.archlinux.org/index.php/Dm-crypt/Encrypting_an_entire_system#LVM_on_LUKS) 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](http://www.howtogeek.com/howto/40702/how-to-manage-and-use-lvm-logical-volume-management-in-ubuntu/) . I will experiment with this and report back.
Note: I will come and clean this up later, when I have solved it.
Asked by Monsoon
(31 rep)
Feb 6, 2017, 06:17 AM
Last activity: Jun 13, 2025, 10:03 PM
Last activity: Jun 13, 2025, 10:03 PM