You are not logged in.

#1 2025-02-15 19:46:59

kamikarsten
Member
Registered: 2025-02-15
Posts: 3

Multiboot setup efi partition file setup

hello everyone, I wanted to set up a multiboot setup with windows (separate disk), kali and arch.
I've gone the painful way of destroying my gpt several times and now I'm wondering what the EFI file structure/partitioning looks like for a multiboot? I thought it would be enough to create one UEFI partition and use it as mount points for the /boot directories. Now I've understood that you don't actually do that because each operating system stores its own kernel and initramfs files there and these may overlap.
But where is Grub located, for example?
Do I then have to install grub for each operating system or can I create a partition for efi (sda1) in which grub lives?

Then for each operating system additional partitions for /boot
(sda2) kali: kernel, initramfs, etc
(sda3) arch: kernel, initramfs, etc.

and then use the central efi partition for /boot/efi with mount?
kali:
/boot = sda2
/boot/efi = sda1

Arch:
/boot = sda3
/boot/efi = sda1

thanks in advance, i have spent more than 20 hours on this and  i can't find any information on how to implement this efficiently.

Offline

#2 2025-02-15 20:25:54

V1del
Forum Moderator
Registered: 2012-10-16
Posts: 25,175

Re: Multiboot setup efi partition file setup

If you're not doing disk encryption you can keep /boot an thus the kernels different from the ESPs and just install "one" GRUB's payload to your ESP. not sure how kali handles the kernels, but it might be better to have kali be the main GRUB, as Arch's kernels generally don't change names and thus don't need an update of GRUB config. To have "foreign" systems detected you need to mount /boot of the "other" system somewhere in your system that's controlling GRUB, enable and install grub-os-prober in your config and run grub-mkconfig which should inform you about having detected a different kernel than the one of the main system. Alternatively if you want two distinct GRUBs for the distinct systems, your main concern is that when running the grub-install command you need to pass distinct --bootloader-id options per GRUB install. E.g. GrubArch and GrubKali that will install different variants of GRUB each with the config to boot it's respective system.

Generally where "GRUB is located" depends on how your grub-install command looks like. At least one bit needs to land on the ESP so that your UEFI has something to boot. the --efi-directory of the grub-install command determines on which ESP a GRUB lands, --bootloader-id which exact sub-directory under esp/EFI/$bootloader-id the EFI payload lands, the exact config and where it is read lands on /boot and whatever is mounted there by default (changeable with the --boot-directory= option), so a potential configuration will have to land on /boot/grub/grub.cfg

Last edited by V1del (2025-02-15 20:45:50)

Offline

#3 2025-02-17 12:43:06

kamikarsten
Member
Registered: 2025-02-15
Posts: 3

Re: Multiboot setup efi partition file setup

Thank you for your answer. I understand the second part of the answer. The question was more about how the partitioning of a hard disk, say sdc, should look like, with a multiboot and ESP. Not including Windows, since that is on a different disk (as said with os-prober).
How I install and configure grub is not the problem, as I unfortunately deleted my GPT several times by now and had to rewrite it. ^^

But I also think I haven't quite understood the connection between ESP and boot and which parts are located where.

Any good resources where the difference between ESP and boot is visualized and explained?

Another edit:
I think I can narrow down my question now.

If I want to use one ESP for all my systems, how can I ensure that arch for example places its kernels and initramfs files to EFI/arch for example thus /EFI/kali for kali?
If I mount sdc1 (esp) as my boot partition, it will place its kernel and files in directly in my top entry. If I then move them to EFI/arch Grub is not able to find it.
Or is this the configuration issue you mentioned in your answer?
(found it now https://wiki.archlinux.org/title/EFI_sy … nt_points)

Okay I got it now:
my setup would look like this right?
sdc1 => ESP partition (Grub)
sdc2 => Boot partition(arch and linux? depends if kernel or initramfs files conflicts)
sdc3 => Root (arch)
sdc4 => Root(kali)
(sdc6 => SWAP)
(sdc7 => /home)

if I really want to seperate kernels:
sdc1 => ESP partition (Grub)
sdc2 => Boot partition(arch)
sdc3 => Boot partition(kali)
sdc4 => Root (arch)
sdc5 => Root(kali)
(sdc6 => SWAP)
(sdc7 => /home)

Last edited by kamikarsten (2025-02-17 14:58:12)

Offline

#4 2025-02-17 16:22:09

V1del
Forum Moderator
Registered: 2012-10-16
Posts: 25,175

Re: Multiboot setup efi partition file setup

There is no inherent relation between the ESP and /boot. /boot is the default spot where most distributions will put their kernels to be booted into. ESP is a partition that your UEFI needs, to know whether it can load something from a disk. You can make them the same (i.e. mount an ESP to /boot) but they don't have to be. Especially with GRUB, I'd strongly reccommend you just keep the ESP on /efi or whatever and keep /boot a distinct seperate (partition -- or just as part of your root) and then run grub-install either twice but with different ids (so

#Assuming a chroot into the relevant environment
mount /dev/sdc1 /efi #From both
grub-install --efi-direcory=/efi --bootloader-id=GrubArch #From Arch
grub-install --efi-direcory=/efi --bootloader-id=GrubKali #From Kali
grub-mkconfig -o /boot/grub/grub.cfg #From both

that will give you distinct GRUB entry points.

If you want to boot both from a single GRUB then Arch is more amenable to be the secondary system because you don't need to regenerate GRUB config to boot new kernels. So for that from the Kali chroot your approach would be

mount /dev/sdc1 /efi
grub-install --efi-direcory=/efi --bootloader-id=GrubKali #From Kali
apt install os-prober #Or so, not using that so double check what the os-prober name for Kali is.
#Edit your /etc/default/grub and enable the GRUB_DISABLE_OS_PROBER=false option
mkdir /mnt/bootArch
mount /dev/sdc2 /mnt/bootArch #The mount point here doesn't matter as long as it doesn't shadow something in use by Kali so best make a new dir for that
grub-mkconfig -o /boot/grub/grub.cfg #you should see it detecting the "foreign" kernels from /mnt/bootArch and generating entries for them

Offline

#5 2025-02-17 18:01:11

Head_on_a_Stick
Member
From: The Wirral
Registered: 2014-02-20
Posts: 9,003
Website

Re: Multiboot setup efi partition file setup

Note that Kali can't use the ESP for /boot/ because dpkg needs make symlinks during kernel upgrades and that won't work on FAT.

Kali symlinks the current kernel & initramfs images to /vmlinuz & /initrd.img so you can use those in a custom menuentry, it won't need to be updated, just like Arch.

The problem with os-prober is that the foreign systems don't use UUIDs to identify the root partition in the kernel command line, which can be unreliable. Using a custom menuentry would be better, I think.

Why do you even want separate /boot/ partitions? I see that regularly in support threads and it always seems to cause problems rather than solve them hmm

Last edited by Head_on_a_Stick (2025-02-17 18:02:55)


Jin, Jîyan, Azadî

Offline

#6 2025-02-17 19:52:34

kamikarsten
Member
Registered: 2025-02-15
Posts: 3

Re: Multiboot setup efi partition file setup

Head_on_a_Stick wrote:

Note that Kali can't use the ESP for /boot/ because dpkg needs make symlinks during kernel upgrades and that won't work on FAT.
Kali symlinks the current kernel & initramfs images to /vmlinuz & /initrd.img so you can use those in a custom menuentry, it won't need to be updated, just like Arch.

Hm, nice to read this now before I would have gotten to this point. Thanks xD

Head_on_a_Stick wrote:

The problem with os-prober is that the foreign systems don't use UUIDs to identify the root partition in the kernel command line, which can be unreliable. Using a custom menuentry would be better, I think.

If I do it this way, is it redundant? Because then I install Grub twice right?

Head_on_a_Stick wrote:

Why do you even want separate /boot/ partitions? I see that regularly in support threads and it always seems to cause problems rather than solve them hmm

The reason I started this whole thread was because I had partitions on my computer that were super old or redundant. (old Lenovo boot partition)
Then I thought to myself, since I've destroyed all these partitions so many times anyway, and I can now do everything from scratch, I'll read up on it.
My aim was to make the whole thing as efficient and redundancy-free as possible, hence the idea of installing Grub only once instead of twice.
My next thought was that the operating systems could also share the boot partitions. (like swap and home) and then I stumbled upon the fact that the kernel and initramfs images are stored directly in /boot, which could lead to conflicts. So my initial plan was to have a single boot partition but with seperation in sub-folders.

So from my understanding now and your comments, you would prefer a partition for efi where grub and its configurations are located, separate boot partitions for the respective operating systems and a grub entry from each operating system?

Offline

#7 2025-02-17 20:52:05

Head_on_a_Stick
Member
From: The Wirral
Registered: 2014-02-20
Posts: 9,003
Website

Re: Multiboot setup efi partition file setup

kamikarsten wrote:

If I do it this way, is it redundant? Because then I install Grub twice right?

No need to install GRUB in both systems, just pick one to control the bootloader.

The Kali installer will install & configure GRUB automatically in a UEFI system unless "expert" mode is selected. If you want to change the configuration after installation use

dpkg-reconfigure grub-efi-amd64

^ Also use that command instead of grub-install & grub-mkconfig in Kali (and other Debian systems) to ensure the configuration is stored in the debconf database and re-applied after updates.

kamikarsten wrote:

you would prefer a partition for efi where grub and its configurations are located, separate boot partitions for the respective operating systems and a grub entry from each operating system?

I was suggesting a single root partition each for both systems with a single ESP holding GRUB's core.img & modules from whichever system is controlling the bootloader.

Last edited by Head_on_a_Stick (2025-02-17 20:53:07)


Jin, Jîyan, Azadî

Offline

Board footer

Powered by FluxBB