How to create custom GRUB menu entry for other OS

Endeavour controls booting with its GRUB configurations.

OS_prober is disabled by default but I see a custom .45 file which adds Windows to the menu.

I tried creating a custom40 entry which did not work.

If I enable os_prober it picks up the other install BUT also adds a second entry for Windows plus all the Windows recovery environments. Obviously, this is not what I want.

Thus, my main question is where and how do I create a custom menu entry for GRUB to add the 3rd OS I want to boot?

All suggestions gratefully welcomed.

Thanks and have a great day/night.

One way is to write file /boot/grub/custom.cfg. It can contain normal grub menuentries, so you can e.g. copy a menuentry from the existing grub.cfg and modify it to fit the other system.
Note that it works without running grub-mkconfig, and will not be overwritten by updates.

1 Like

I would try to disable the 45- file for Windows and enable os_prober.

Sorry for the delayed response. Work and life was keeping me busy.

Appreciate the response and will take a closer look at that soon.

Not sure that would work since os prober then picks up the Windows recovery entries and adds them. That is not what I want.

Appreciate the answer and will also look at that more closely.

Can you post your /etc/grub.d/40_custom file that did not work? Adding new OS entries to GRUB is quite easy, once you get the hang of it.

Here is mine - the entries are for different installations of EOS that I use for ISO testing (NOTE: these entries are basically copies of the ones that GRUB created):

#!/bin/sh
exec tail -n +3 $0
# This file provides an easy way to add custom menu entries.  Simply type the
# menu entries you want to add after this comment.  Be careful not to change
# the 'exec tail' line above.

# other virtual machine hosts
menuentry 'EndeavourOS (VMware w/LTS kernel)' --class vmware-workstation {
        load_video
        set gfxpayload=keep
        insmod gzio
        insmod part_gpt
        insmod ext2
        set root='hd0,gpt4'
        if [ x$feature_platform_search_hint = xy ]; then
                search --no-floppy --fs-uuid --set=root --hint-bios=hd0,gpt4 --hint-efi=hd0,gpt4 --hint-baremetal=ahci0,gpt4 3937c2b8-c7c6-4070-a012-1e36b1ed5b3b
        else
                search --no-floppy --fs-uuid --set=root 3937c2b8-c7c6-4070-a012-1e36b1ed5b3b
        fi
        echo    'Loading EndeavourOS (VMware w/LTS kernel) ...'
        linux   /boot/vmlinuz-linux-lts root=UUID=3937c2b8-c7c6-4070-a012-1e36b1ed5b3b rw  nvidia-drm.modeset=1 nowatchdog nvme_load=YES loglevel=3 iommu=pt
        echo    'Loading initial ramdisk ...'
        initrd  /boot/intel-ucode.img /boot/initramfs-linux-lts.img
}
menuentry 'EndeavourOS (VMware w/mainline kernel)' --class vmware-workstation {
        load_video
        set gfxpayload=keep
        insmod gzio
        insmod part_gpt
        insmod ext2
        set root='hd0,gpt4'
        if [ x$feature_platform_search_hint = xy ]; then
                search --no-floppy --fs-uuid --set=root --hint-bios=hd0,gpt4 --hint-efi=hd0,gpt4 --hint-baremetal=ahci0,gpt4 3937c2b8-c7c6-4070-a012-1e36b1ed5b3b
        else
                search --no-floppy --fs-uuid --set=root 3937c2b8-c7c6-4070-a012-1e36b1ed5b3b
        fi
        echo    'Loading EndeavourOS (VMware w/mainline kernel) ...'
        linux   /boot/vmlinuz-linux root=UUID=3937c2b8-c7c6-4070-a012-1e36b1ed5b3b rw  nvidia-drm.modeset=1 nowatchdog nvme_load=YES loglevel=3 iommu=pt
        echo    'Loading initial ramdisk ...'
        initrd  /boot/intel-ucode.img /boot/initramfs-linux.img
}

menuentry 'EndeavourOS (VirtualBox w/LTS kernel)' --class virtualbox {
        load_video
        set gfxpayload=keep
        insmod gzio
        insmod part_gpt
        insmod ext2
        set root='hd0,gpt5'
        if [ x$feature_platform_search_hint = xy ]; then
                search --no-floppy --fs-uuid --set=root --hint-bios=hd0,gpt5 --hint-efi=hd0,gpt5 --hint-baremetal=ahci0,gpt5 64ac5f9e-1088-4d36-aea9-1057ba9949a8
        else
                search --no-floppy --fs-uuid --set=root 64ac5f9e-1088-4d36-aea9-1057ba9949a8
        fi
        echo    'Loading EndeavourOS (VirtualBox w/LTS kernel) ...'
        linux   /boot/vmlinuz-linux-lts root=UUID=64ac5f9e-1088-4d36-aea9-1057ba9949a8 rw  nvidia-drm.modeset=1 nowatchdog nvme_load=YES loglevel=3 iommu=pt
        echo    'Loading initial ramdisk ...'
        initrd  /boot/intel-ucode.img /boot/initramfs-linux-lts.img
}

menuentry 'EndeavourOS (VirtualBox w/mainline kernel)' --class virtualbox {
        load_video
        set gfxpayload=keep
        insmod gzio
        insmod part_gpt
        insmod ext2
        set root='hd0,gpt5'
        if [ x$feature_platform_search_hint = xy ]; then
                search --no-floppy --fs-uuid --set=root --hint-bios=hd0,gpt5 --hint-efi=hd0,gpt5 --hint-baremetal=ahci0,gpt5 64ac5f9e-1088-4d36-aea9-1057ba9949a8
        else
                search --no-floppy --fs-uuid --set=root 64ac5f9e-1088-4d36-aea9-1057ba9949a8
        fi
        echo    'Loading EndeavourOS (VirtualBox w/mainline kernel) ...'
        linux   /boot/vmlinuz-linux root=UUID=64ac5f9e-1088-4d36-aea9-1057ba9949a8 rw  nvidia-drm.modeset=1 nowatchdog nvme_load=YES loglevel=3 iommu=pt
        echo    'Loading initial ramdisk ...'
    initrd  /boot/intel-ucode.img /boot/initramfs-linux.img
}

menuentry '' {
   true
}

# Microsoft Windows installations
menuentry 'Windows 11 Home' --class windows {
        search --fs-uuid --no-floppy --set=root 3040-4A9F
        chainloader (${root})/EFI/Microsoft/Boot/bootmgfw.efi
}

menuentry '' {
   true
}

# maintenance setups
# NOTE: need to add one for memtest86+

menuentry 'UEFI Firmware Settings' $menuentry_id_option 'uefi-firmware' --class settings {
   fwsetup
}
menuentry 'Clonezilla 3.1.2-9 [Live]' --class clonezilla {
    search --fs-uuid --no-floppy --set=root 4ACC495C6E20BEBC
    set isofile='/iso-images/clonezilla-live-3.1.2-9-amd64.iso'
    loopback loop (${root})${isofile}
    linux (loop)/live/vmlinuz boot=live union=overlay username=user config components quiet noswap edd=on nomodeset enforcing=0 locales=en_US.UTF-8 keyboard-layouts=NONE ocs_live_run="ocs-live-general" ocs_live_extra_param="" ocs_live_batch="no" ip= net.ifnames=0 splash vga=795 i915.blacklist=yes radeonhd.blacklist=yes nouveau.blacklist=no vmwgfx.enable_fbdev=1 toram=filesystem.squashfs findiso=${isofile}
    initrd (loop)/live/initrd.img
}

menuentry 'Clonezilla 3.1.2-9 [Autoclone - Windows 11 Home]' --class clonezilla {
        search --fs-uuid --no-floppy --set=root 4ACC495C6E20BEBC
    set isofile='/iso-images/clonezilla-live-3.1.2-9-amd64.iso'
    loopback loop (${root})${isofile}
    linux (loop)/live/vmlinuz boot=live union=overlay username=user config components quiet noswap edd=on nomodeset enforcing=0 locales=en_US.UTF-8 keyboard-layouts=NONE ocs_prerun="mount UUID=F846B89E46B85ED6 /mnt" ocs_prerun1="mount --bind /mnt/backups/Disk\ Images/windows-c /home/partimag/" ocs_live_run="ocs-sr -q2 -j2 -z0 -sfsck -senc -p poweroff --batch savedisk autoname-win11-year-month-day PTUUID=EE9D44F4-58B2-4CE1-9B5D-321A0BC2DD60" ocs_live_extra_param="" ocs_live_batch="yes" ip= net.ifnames=0 splash vga=795 i915.blacklist=yes radeonhd.blacklist=yes nouveau.blacklist=no vmwgfx.enable_fbdev=1 toram=filesystem.squashfs findiso=${isofile}
    initrd (loop)/live/initrd.img
}

menuentry 'Clonezilla 3.1.2-9 [Autoclone - Virtual Machine Hosts]' --class clonezilla {
        search --fs-uuid --no-floppy --set=root 4ACC495C6E20BEBC
    set isofile='/iso-images/clonezilla-live-3.1.2-9-amd64.iso'
    loopback loop (${root})${isofile}
    linux (loop)/live/vmlinuz boot=live union=overlay username=user config components quiet noswap edd=on nomodeset enforcing=0 locales=en_US.UTF-8 keyboard-layouts=NONE ocs_prerun="mount UUID=F846B89E46B85ED6 /mnt" ocs_prerun1="mount --bind /mnt/backups/Disk\ Images/vm-hosts /home/partimag/" ocs_live_run="ocs-sr -q2 -j2 -z0 -sfsck -senc -p poweroff --batch savedisk autoname-eos-vm-hosts-year-month-day PTUUID=9BDFADE8-11B8-460E-BBE5-CEC887347F37" ocs_live_extra_param="" ocs_live_batch="yes" ip= net.ifnames=0 splash vga=795 i915.blacklist=yes radeonhd.blacklist=yes nouveau.blacklist=no vmwgfx.enable_fbdev=1 toram=filesystem.squashfs findiso=${isofile}
    initrd (loop)/live/initrd.img
}

The most important settings are related to the UUID of the partition that contains the added OS.

Perfect! This worked.

Previously, I had enabled os-prober and while that did work it also added menu entries I did not want.

40_custom was the way to go. Added my custom entry, made the file executable, updated grub-mkconfig and now I have exactly what I wanted to begin with.

Thanks!

1 Like

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.