I have an UEFI system with a custom grub that currently boots Arch Linux, Windows 10 and openSUSE Tumbleweed.
There is a bug open because openSUSE (and every other Linux system) does not correctly add the 2nd part of the Arch Linux initrd line. So, if you have Arch and do not want to edit that line every time you boot into Arch, this is the answer.
It is totally maintenance free; it does not need any updating when a new kernel is installed, it just always works. The only time you would ever need to touch this file is if you added/removed an OS, or if a UUID changed.
I tried installing Debian Testing on this system about 4 times and each time it would change the swap UUID causing major problems with all of my other systems. Needless to say I dropped that quest.
You can use /etc/grub.d/40_custom for a start and then save the file as /etc/grub.d/06_custom because the point is to have this at the top until you get comfortable with it booting your systems.
Then you make /etc/grub.d/10_linux and** /etc/grub.d/30_os-prober** unexecutable so only the custom menu entries display.
There are just UUIDs and partitions that will need to be changed for this to work on your system.
You can leave 40_custom as is but, you will not get any display output when grub is updated.
I like to see a line displaying something when it update myself and here is how:
The reason it says not to change the exec tail line is because +3 starts execution at line 3, the first menuentry line.
Below in my custom grub you can see that there is an echo line and the +3 has been changed to +4 to start execution at the 4th line.
#!/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.
First here are my partitions on the SSD /dev/sdc:
cavsfan@opensuse:~> sudo blkid | grep sdc
/dev/sdc1: UUID="688D-126B" TYPE="vfat" PARTLABEL="EFI System Partition" PARTUUID="3c1b6d6f-8a24-43da-b595-8c304ceee48d"
/dev/sdc2: PARTLABEL="Microsoft reserved partition" PARTUUID="49992d5b-79cd-4934-a12f-11782bb345bd"
/dev/sdc3: UUID="C4968A52968A44C0" TYPE="ntfs" PARTLABEL="Windows_10" PARTUUID="345c85f4-bce7-4bc7-bbe0-db03eb319cad"
/dev/sdc4: UUID="701AE4631AE427B4" TYPE="ntfs" PARTUUID="1e337754-b45d-45a5-a971-b8cdcae8a002"
/dev/sdc5: UUID="be437b2b-9c95-4590-8d32-4da8e6c90318" TYPE="swap" PARTLABEL="Basic data partition" PARTUUID="3a259867-656d-41ed-9931-cf15a3bd0148"
/dev/sdc6: LABEL="ArchLinux" UUID="bbca28b2-503e-4dc8-9850-c54bd0492da8" TYPE="ext4" PARTLABEL="Arch_Linux" PARTUUID="5312b771-0835-4957-80a6-9a8a7107f24a"
/dev/sdc7: LABEL="opensuse" UUID="274e3321-d7af-4544-9afa-b1b3c118c325" TYPE="ext4" PARTUUID="25d7851a-f45f-4d60-955a-4a31706f8452"
/dev/sdc8: UUID="55bba398-68d4-48db-9b54-d98d27cdf3ba" TYPE="ext4" PARTLABEL="Spare" PARTUUID="c4e0fdc9-7eac-4661-a7c6-c5a00c9a46fc"
/dev/sdc10: LABEL="Media" UUID="840ac879-510a-4b8d-be01-9d3a5f37dbb2" TYPE="ext4" PARTLABEL="Media" PARTUUID="61e2e7f9-1a98-44f7-881e-ae85fceaf994"
Here is my /etc/grub.d/06_custom file:
#!/bin/sh
echo 1>&2 "Adding Arch Linux, Windows 10 and openSUSE Tumbleweed"
exec tail -n +4 $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.
menuentry 'Arch Linux' --class arch --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-simple-bbca28b2-503e-4dc8-9850-c54bd0492da8' {
load_video
set gfxpayload=keep
insmod gzio
insmod part_gpt
insmod fat
set root='hd2,gpt1'
search --no-floppy --fs-uuid --set=root 688D-126B
linux /vmlinuz-linux root=UUID=bbca28b2-503e-4dc8-9850-c54bd0492da8 rw quiet
initrd /intel-ucode.img /initramfs-linux.img
}
menuentry 'Arch Linux (fallback kernel)' --class arch --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-linux-fallback-bbca28b2-503e-4dc8-9850-c54bd0492da8' {
load_video
set gfxpayload=keep
insmod gzio
insmod part_gpt
insmod fat
set root='hd2,gpt1'
search --no-floppy --fs-uuid --set=root 688D-126B
linux /vmlinuz-linux root=UUID=bbca28b2-503e-4dc8-9850-c54bd0492da8 rw quiet
initrd /initramfs-linux-fallback.img
}
menuentry 'Windows 10' --class windows --class os $menuentry_id_option 'osprober-efi-688D-126B' {
insmod part_gpt
insmod fat
set root='hd2,gpt1'
search --no-floppy --fs-uuid --set=root 688D-126B
chainloader /EFI/Microsoft/Boot/bootmgfw.efi
}
menuentry 'openSUSE Tumbleweed' --class opensuse --class gnu-linux --class gnu --class os $menuentry_id_option 'osprober-gnulinux-simple-274e3321-d7af-4544-9afa-b1b3c118c325' {
insmod part_gpt
insmod ext2
set root='hd2,gpt7'
search --no-floppy --fs-uuid --set=root 274e3321-d7af-4544-9afa-b1b3c118c325
linux /boot/vmlinuz root=/dev/sdc7 splash=silent resume=/dev/disk/by-uuid/be437b2b-9c95-4590-8d32-4da8e6c90318 quiet
initrd /boot/initrd
}
Then make it executable: sudo chmod +x /etc/grub.d/06_custom.
If you do not add the red swap UUID to the openSUSE entry you will not be able to wake from suspend. Been there…
Of course be sure and change the partitions on each entry as shown in color purple as well as the colored UUIDs.
I’ve been using this with nary a problem for some time now.
MBR partitioned drives are much more simple to customize but, here is an UEFI SSD customized.
This is the link to a Wiki that I maintain for Ubuntu to customize MBR partitioned drives - https://help.ubuntu.com/community/MaintenanceFreeCustomGrub2Screen
It’s always good to label your ext4 partitions with a name that is contiguous so that files can be copied across partitions.
On Arch Linux, I added a background but, on openSUSE I did not try to add a background, I just left the default background theme as I think it looks nice.
After you have added this and it’s executable, if you do not want the first menuentry to be your default just edit sudo nano /etc/default/grub and change GRUB_DEFAULT=n to whatever you want.
This will produce a list of which number to put there - numbering starts at zero:
sudo grep -e "menuentry " -e "submenu" /boot/grub2/grub.cfg | sed 's/^ ]*//' | cut -d "{" -f1 | nl --starting-line-number=0
Be sure to update grub after you make any changes or you will lose those changes and wonder what happened during the next boot:
sudo grub2-mkconfig -o /boot/grub2/grub.cfg
I hope that I have presented this in a way that is easily understandable. If you have any questions let me know.