[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Stupid question



On 2/12/2022 4:04 AM, Hans wrote:
Dear list,

I am thinking of a solution of a problem. But I have an understanding problem,
maybe you can give some background knowledge.

The problem: I have one harddrive, there are two linuces installed.

The partitions are as followed:

kali-linux: 1st primary -> /boot
                  2nd > /


debian    3rd primary -> /boot
                4th logical > /
	             > swap
                                 > /home (encrypted)
                                 > /usr (encrypted)
                                 > /var (encrypted)


This is the structure, and as said before, only ONE drive.

Now my question: Is it possible to configure grub that way, that I can choose
either kali or debian to boot?

What I might to know, please correct me:
Both are running different kernels. As far as I understood grub, I can set the
root partition ( / ) with the UUID. This is an entry in grub.cfg and maybe in
/etc/default/grub.

But how can I tell grub, to use the kernel of the second /boot?

I dunno, if it is possible at all, to get a dual boot, the way I want it. With
a combination of Windows + Linux on one harddrive this is working, however,
just because grub does not touch the windows bootloader (as fas as I know),
and what of course is also working, if you got two harddrives, each with
different linux. They all can be booted from one grub installation, of course.

Maybe I could find a solution, if I would have fully understood how grub is
working, and what it is doing.

Any hints are welcome, and if this does never work at all, please drop me a
line.

Best regards

Hans







This is my understanding of how grub works.

It looks you are using the old MBR partitioning scheme. The logical partition indicates that. So I also assume you are using the legacy booting (not UEFI). So the first thing that happens is that you will have an active partition set that your BIOS will boot (if you have standard bootcode installed in the first sector of the disk). The active partition is either 1st primary in which case you will boot from the grub from kali, or 3rd primary in which case you will boot the grub from Debian. So first you need to see which partition your BIOS boots. You can view or change the partitions and which one is the active boot
partition using a disk partition tool such as fdisk.

If you set Debian's grub on the 3rd partition as the active boot partition, you should be able to fairly easily display a menu to select either kali or Debian on the grub menu. You will need to make sure os-prober is enabled, it is enabled by default on bullseye and older, but I think in bookworm and sid you need to enable it by a setting in /etc/default/grub). The changelog for grub on bookworm and unstable has an entry to tell you how, I think. You also need to set the timeout to something (usually 5 or 10
seconds) to display the menu, and you can also set a default OS to boot in
/etc/default/grub to handle the case when you do not select an OS before the
timeout expires.

After that, you just run sudo update-grub from your Debian system and then on the next
reboot the grub menu should have entries for both kali and Debian.

Cheers,

Chuck


Reply to: