Home / Alt manpages / grub-reboot(8)

  • grub-reboot(8)
  • Admin command
  • linux

Set a One-Time GRUB Boot Entry with grub-reboot

You will schedule one GRUB menu entry for the next boot, leaving the normal default unchanged for later boots. This is useful for testing a kernel, selecting a recovery entry, or booting another installed system once. Allow about ten minutes, plus the time needed to identify the exact menu entry. The examples target GRUB 2.12-1ubuntu7.3 from Ubuntu's grub2-common package.

Safety: the command changes bootloader state and the next reboot will follow that choice. Do not use it on a remote machine unless you have a tested way back in if the selected entry fails.

1. Check the installed command

Run these checks as your ordinary user. They do not change boot settings:

$ command -v grub-reboot
/usr/sbin/grub-reboot
$ grub-reboot --version
grub-reboot (GRUB) 2.12-1ubuntu7.3
$ dpkg-query -W -f='${Package} ${Version}\n' grub2-common
grub2-common 2.12-1ubuntu7.3

Your package revision may differ. The important prerequisite is a GRUB installation whose generated configuration supports a saved environment block. The command expects GRUB data below /boot/grub unless you provide another boot directory.

Checkpoint

Stop here if command -v finds nothing, or if this machine does not actually boot through GRUB. Installing or repairing a bootloader is a separate change with a larger recovery risk.

2. Choose the entry name GRUB understands

grub-reboot accepts one menu entry argument. It can be a number, a visible title, or a menu entry identifier. A number is counted from zero at each menu level, so it is easy to get wrong when kernels are added or removed. A stable identifier is usually better when your GRUB configuration exposes one.

Use the exact spelling and capitalisation displayed by GRUB. To inspect generated entries without changing them, search the configuration as your ordinary user:

$ sudo grep -nE "^(menuentry|submenu) " /boot/grub/grub.cfg
12:menuentry 'Ubuntu, with Linux 6.8.0-xx-generic' --class ubuntu --id 'gnulinux-6.8.0-xx-generic-advanced-...'
27:submenu 'Advanced options for Ubuntu' $menuentry_id_option 'gnulinux-advanced-...'

The output is installation-specific, so treat the example lines as a shape rather than values to copy. Reading /boot/grub/grub.cfg normally needs no privilege; sudo is shown only because permissions vary. Do not edit grub.cfg by hand for this task.

3. Handle entries inside submenus

For a submenu, join the submenu component and the entry component with a greater-than character and no spaces. You can use titles, identifiers, or numbers for each component:

$ sudo grub-reboot 'Advanced options for Ubuntu>Ubuntu, with Linux 6.8.0-xx-generic'

The single quotes matter: without them, the shell treats > as output redirection. The same form works with identifiers, for example:

$ sudo grub-reboot 'gnulinux-advanced-...>gnulinux-6.8.0-xx-generic-advanced-...'

Replace every placeholder with the complete value from this machine. Do not copy the ellipses. If your chosen entry is at the top level, the command has only one argument.

4. Schedule the next boot

This is the state-changing step. Use elevated privileges because the command must write GRUB's environment block:

$ sudo grub-reboot 'EXACT MENU ENTRY OR ID'
$ printf 'exit status: %s\n' "$?"
exit status: 0

A zero status means the command completed its write operation. It does not boot the machine immediately, and it does not prove that the selected operating system will start successfully. Reboot only when you are ready:

$ sudo systemctl reboot

Do not run the reboot command until you have checked the selected entry and confirmed that console or out-of-band access is available if this is a server.

5. Confirm what happens afterwards

After the machine starts, check the running kernel or operating system using the relevant local command. For a Linux kernel, for example:

$ uname -r
6.8.0-xx-generic

Then check the normal GRUB selection on the next reboot rather than assuming the one-time choice became permanent. grub-reboot is intended for the next boot only; grub-set-default is the separate command for a persistent saved choice. Do not substitute it casually.

6. Diagnose an entry that stays selected

The installed manual warns that GRUB may be unable to write its environment block when it is stored on an MDRAID or LVM device. In that case, the selected entry can remain the default even after reboot. This is a serious boundary: a successful-looking command is not enough evidence that one-time behaviour is available.

If the same entry keeps booting, first check the storage layout and environment-block location without editing boot files:

$ findmnt -no SOURCE,FSTYPE,TARGET /boot /boot/grub 2>/dev/null
$ sudo grub-editenv /boot/grub/grubenv list

The second command reads GRUB's environment block. If it reports that the file is missing, unreadable, or unsuitable for writing, stop and investigate the distribution's GRUB layout. Do not create a replacement environment file or change mount and RAID settings as a quick fix on a production system. Those changes affect boot reliability and need a separate recovery plan.

If you selected the wrong entry but have not rebooted, schedule the intended entry again with grub-reboot. If you need to clear a pending choice and your GRUB environment block is writable, use the supported tooling for your distribution after checking its documentation; do not edit /boot/grub/grubenv as ordinary text.

Done means

  • grub-reboot --version identifies the installed GRUB release and the command is available.
  • The exact top-level or submenu path was copied from this machine's GRUB configuration.
  • The submenu path uses > with no spaces and is protected from shell redirection by quoting.
  • The command returned status 0 before the reboot was started.
  • You understand that environment-block storage can prevent the choice from being one-time, and you have recovery access before rebooting.