For example, Arch-based distributions on Intel x86 hardware will add two options to the initrd line (to load the CPU µcode before the initramfs) but this is not recognised by Debian's `grub-mkconfig` script and will cause any Arch-based menu entries to fail:
http://forums.debian.net/viewtopic.php?f=10&t=139060
As a solution to this issue, it is possible to install GRUB's modules and configuration file to a (very) small standalone partition and use that to load all the other distributions on the disk.
The upstream guide is here: https://www.gnu.org/software/grub/manua ... ual-config
As noted in that guide, it is important to make sure that the bootloader is disabled if any new distributions are installed, the MBR or NVRAM boot entry must always point to the standalone partition and installing another bootloader to the disk will break this.
It is also necessary to disable `os-prober` in all of the installed distributions by editing /etc/default/grub and changing the GRUB_DISABLE_OS_PROBER line to true then running `update-grub` to change the configuration.
Create the standalone partition first, it needs to be on a primary partition if an msdos ("MBR" style) partition table is used, I find that 32MiB is plenty.
Once created, format the partition, I prefer xfs:
Code: Select all
mkfs.xfs /dev/sdXY
For installing the bootloader itself, I prefer to use the Arch ISO image but it can be done from any GNU/Linux system that is already installed on the drive.
First, mount the partition and create a boot directory:
Code: Select all
mount /dev/sdXY /mnt
mkdir -p /mnt/boot
Code: Select all
grub-install --boot-directory=/mnt/boot /dev/sdX
Code: Select all
mkdir /esp # delete this afterwards
mount /dev/sdXZ /esp # replace X & Z with the drive letter and partition number
Code: Select all
grub-install --efi-directory=/esp --boot-directory=/mnt/boot /dev/sdX
Code: Select all
menuentry 'OpenBSD' {
search --set=root --UUID $uuid_openbsd --hint hd0,msdos1
chainloader +1
}
menuentry 'Debian' {
search --set=root --UUID $uuid_debian --hint hd0,msdos2
linux /vmlinuz ro root=UUID=$uuid_debian
initrd /initrd.img
}
menuentry 'Arch' {
search --set=root --UUID $uuid_arch --hint hd0,msdos3
linux /boot/vmlinuz-linux rw root=UUID=$uuid_arch
initrd /boot/intel-ucode.img /boot/initramfs-linux.img
}
For disks with a GUID partition table, use the hd0,gpt1 (&c) nomenclature.
Replace $uuid_{arch,debian,openbsd} with the correct UUIDs for the respective partitions.
This technique allows the user to freely delete any operating systems on the disk without fear of breaking the bootloader, which can be very useful, and it also mitigates against post-upgrade bootloader failure (because we won't be updating the bootloader, ever).
If the MBR or NVRAM entry gets overwritten and the custom menu stops loading then mount the partition and run the `grub-install` command again to wrest back control.
For troublesome UEFI implementations try adding the `--removable` flag to the `grub-install` command.