1

I am trying to setup a full-encrypted Debian os, alongside my preinstalled unencrypted Ubuntu.

so far, I have(traditional BIOS) installed the Debian with the following scheme..

  1. /boot as extended partition; format-ext4 (unencrypted)
  2. LVM on LUKS: / partition -ext4 (encrypted), SWAP (encrypted)
  3. grub2 of Debian, installed on /boot instead MBR, since Ubuntu's grub2 is my primary bootloader.
  4. then from Ubuntu side, I mounted /boot & LVM partitions, then updated grub.

    but, my grub2 dont recognize Debian.

    What should I do next ??

muru
  • 69,900
  • 13
  • 192
  • 292
bijay
  • 31
  • 8
  • related https://unix.stackexchange.com/questions/399626/why-is-kali-linux-so-hard-to-set-up-why-wont-people-help-me – Rui F Ribeiro Oct 08 '18 at 13:18
  • Yeah, mounting the partitions of another Linux distro and using the grub update tool won't do what you want. Try this: https://unix.stackexchange.com/questions/335247/two-linux-distributions-grub-does-not-detect-other-one/335384#335384 – Emmanuel Rosa Oct 09 '18 at 13:16
  • @EmmanuelRosa Ok. I got it. but the problem here is I have 'legacy boot' & am not technically good with command line. I only got 2 related links on the internet. None of them, are straightforward to fix the problem. so, It would be helpful if someone write a How-to at least, a workaround on the topic. – bijay Oct 10 '18 at 14:54
  • cryptsetup & lvm2 are installed. – bijay Oct 10 '18 at 14:56
  • @EmmanuelRosa It worked. thanks a lot. I made it up with dual-booting. – bijay Oct 24 '18 at 07:34

2 Answers2

2

I also tried an alternative method with grub2. I made a mistake when mounting the logical root partition. Since, I am not good with cli, so I wanted not to mess with grub2 config file. However, grub2 can handle LVM2 & LUKS partitions efficiently. look here (https://wiki.gentoo.org/wiki/GRUB2#Extended_features).

So,here what I tried alternatively

  1. step1, mounted the /boot partition.
  2. step2, $ sudo modprobe dm-crypt | grep dm-crypt
  3. step3, unlock the luks-encrypted partition with 'cryptsetup' command.
  4. step4, run $ sudo pvscan | vgscan | lvsacan
  5. step5, activate the volume-group
  6. step6, mount the logical root volume. No need to mount the logical swap.
  7. step7, sudo update-grub

Done!

Grub2 will autodetect the installed OS & list it on grub menu.

bijay
  • 31
  • 8
  • life saver for who cannot install a bootable nvme.m2 debian, and need to boot it from other disk. – dawid Dec 13 '20 at 19:37
1

OK, here's what you can do.

Warning: this procedure will require heavy use of the command line and for the most part will require root access:

  1. Boot Ubuntu.
  2. Open /etc/grub.d/40_custom with a text editor.
  3. Append the following to the file:

ignore this line (it's here to address formatting issues)

menuentry 'Debian' --class gnu-linux --class gnu --class os $menuentry_id_option 'debian-0aca58bc-8fdb-4a07-aa2f-56406bcf19b7' {
   set root='hd0,msdos4'
   configfile /boot/grub/grub.cfg
}
  1. Change the part that says hd0,msdos4 to reflect your Debian's /boot partition. In this example, hd0 is the first disk and msdos4 is the 4th partition; This means disks begin at 0 and partitions begin at 1.
  2. Save the /etc/grub.d/40_custom file.
  3. Check to see if you have the file /boot/grub/grub.cfg. If not that means you need to mount your /boot filesystem by running mount /boot.
  4. Make a backup copy of /boot/grub/grub.cfg
  5. Run grub-mkconfig -o /boot/grub/grub.cfg
  6. Cross your fingers and reboot.

If all goes well you'll have a Debian entry in your Ubuntu GRUB menu. When you select that entry your screen will refresh and display your Debian GRUB menu, from which you can boot Debian.

Emmanuel Rosa
  • 6,808
  • 2
  • 18
  • 22