How to manually add menu items to GRUB2 menu on Arch Linux

During the process of setting Arch Linux as the primary operating system, I was faced with the task of adding a menu item to GRUB2 so that I can boot to the secondary operating system by selecting on the Grub2 menu to boot to the secondary operating system (Gentoo) . This feature works on any Linux distribution that you want to dual-boot with Arch Linux.

First, check the UUID of the root partition of the Linux operating system you want to add to the grub entry. Use blkid command:

sudo blkid

The Uuid of my Gentoo root partition is 242a7abb-3547-4504-a9f8-bfbc479a3f0e
Now install the root partiton for that Linux system and check the name of the executable Linux kernel under the / boot directory.
Once we have the two pieces of information we need, we can now configure the Grub menu items.

vim /etc/grub.d/40_custom

Then add the following lines according to your specifications.

menuentry "Gentoo Linux" {
    search --set=root --fs-uuid 242a7abb-3547-4504-a9f8-bfbc479a3f0e
  linux /boot/vmlinuz-* root=UUID=242a7abb-3547-4504-a9f8-bfbc479a3f0e rw  quiet

Replace 242a7abb-3547-4504-a9f8-bfbc479a3f0e with the uuid of the root partition you want to add and replace / boot / vmlinuz- * with the location of the executable linux file.
Then update grub to generate a new grub.conf file.

grub-mkconfig -o /boot/grub/grub.cfg

that’s it. When restarting, you should see the entry on the grub menu. You may also see:

How to set up built-in fingerprint reader authentication using PAM on any Linux

Install, configure and customize Zsh on Linux

How to use RW to automatically mount USB and external storage devices in Arch Linux

How to install and configure Fail2ban on CentOS 7, CentOS 6.x and Ubuntu 14.04

How to add a new grub menu in Linux
Configure the grub.conf file to add new menu items on Arch Linux
Arch Linux GRUB2 configuration.