Reboot from running Linux OS layer to GRUB 2.x
“grub-reboot”. This command works with GRUB 2.x versions, including GRUB 2.06 and later.
To use “grub-reboot”, you'll first need to know the menu entry index number or name of the target OS or menu item you want to boot into. You can find this information by examining the “/boot/grub/grub.cfg” file or by running the “grep” command:
grep '^menuentry' /boot/grub/grub.cfg
This command will return a list of menu entries along with their index numbers, starting from 0. For example:
0: menuentry 'Ubuntu'
1: menuentry 'Advanced options for Ubuntu'
2: menuentry 'Memory test (memtest86+)'
Once you know the index number or name of the target OS, you can use the “grub-reboot” command. To do so, open a terminal and run the following command with “sudo” and the appropriate index number or name:
sudo grub-reboot 0
or
sudo grub-reboot 'Ubuntu'
After executing the command, reboot your system:
sudo reboot
The system will then reboot directly into the specified GRUB menu entry. Keep in mind that this method only sets the default boot entry for the next reboot. After that, GRUB will revert to its normal boot behavior.
Please note that the “grub-reboot” command may not be available on some distributions by default. In that case, you may need to install the “grub2-common” package or a similar package provided by your distribution.