Type: text/x-devicetree-source, Size: 4277 bytes, SHA256: 49001555957e43636f70148bf2e9675806e6e347dd35fd0ec3bb9c7bb472d1fd.
UTC timestamps: upload: 2026-05-01 07:21:40, download: 2026-05-20 02:26:41, max lifetime: 2026-05-31 07:21:40.

#language en

~-[[DebianWiki/EditorGuide#translation|Translation(s)]]: English - [[it/GrubReboot|Italiano]]-~

----

= GrubReboot =

== Choosing a Menuentry ==

GRUB has the ability to reboot into a specified menuentry '''once'''. This can be useful

with DualBoot / a different Kernel and no direct access to the system.

As an example on how to use [[https://manpages.debian.org/stable/grub2-common/grub-reboot.8.en.html|grub-reboot(8)]] with submenus we look at the following output.

{{{

# awk -F\'\|\" '/(submenu|menuentry) / { printf "%s\t%s\n", $1, $2}' /boot/grub/grub.cfg

menuentry Debian GNU/Linux

submenu Advanced options for Debian GNU/Linux

menuentry Debian GNU/Linux, with Linux 6.6.13-amd64

menuentry Debian GNU/Linux, with Linux 6.6.13-amd64 (recovery mode)

menuentry Debian GNU/Linux, with Linux 6.6.9-amd64

menuentry Debian GNU/Linux, with Linux 6.6.9-amd64 (recovery mode)

menuentry Memory test (memtest86+x64.bin, serial console)

}}}

This will result in the following MENU_ENTRYs we can use. The submenu entry won't work but are listed for clarification.

{{{

0 menuentry Debian GNU/Linux

1 submenu Advanced options for Debian GNU/Linux

1>0 menuentry Debian GNU/Linux, with Linux 6.6.13-amd64

1>1 menuentry Debian GNU/Linux, with Linux 6.6.13-amd64 (recovery mode)

1>2 menuentry Debian GNU/Linux, with Linux 6.6.9-amd64

1>3 menuentry Debian GNU/Linux, with Linux 6.6.9-amd64 (recovery mode)

2 menuentry Memory test (memtest86+x64.bin, serial console)

}}}

So if we want to boot the "6.6.9" kernel the next time we boot the system.

{{{

# grub-reboot '1>2'

}}}

To check what is currently configured you can use DebianMan:grub-editenv.

{{{

# grub-editenv - list

next_entry=1>2

}}}

No further configuration is necessary for booting a different boot-entry '''once'''.

== Persistent Configuration ==

=== With GRUB v2 ===

in your /etc/default/grub GRUB_DEFAULT should be set to saved, for

example:

{{{

# If you change this file, run 'update-grub' afterward to update

# /boot/grub/grub.cfg.

# For full documentation of the options in this file, see:

# info -f grub -n 'Simple configuration'

GRUB_DEFAULT=saved ## important.

GRUB_TIMEOUT=5

GRUB_DISTRIBUTOR=`lsb_release -i -s 2> /dev/null || echo Debian`

GRUB_CMDLINE_LINUX_DEFAULT="quiet"

GRUB_CMDLINE_LINUX=""

}}}

Next you need to run {{{update-grub}}} to set up the default change.

== grub-set-default ==

Next you need to specify the default OS for grub to boot. This is the OS booted if we don't use grub-reboot.

For this we use the grub-set-default command.

{{{

grub-set-default [num]

}}}

Where [num] is the number of a entry in /boot/grub/menu.lst or /boot/grub/grub.cfg

To set the first OS (Debian in example) as the default run

{{{

grub-set-default 0

}}}

== Usage ==

We can use the grub-reboot command to select the OS we want to boot only once.

{{{

grub-reboot [num]

}}}

Where [num] is the number of a entry in /boot/grub/menu.lst or /boot/grub/grub.cfg.

For example:

{{{

grub-reboot 1

}}}

Will select WinXP for the next boot in the example. If we reboot now,

WinXP will boot once. The time after that the boot will be again

on the default entry.

=== With GRUB v1 ===

In your /boot/grub/menu.list you need to set "default" to "saved". For example.

{{{

default saved ## important.

timeout 5

color cyan/blue white/blue

title Debian GNU/Linux, kernel 2.6.18-4-k7

root (hd0,2)

kernel /boot/vmlinuz-2.6.18-4-k7 root=/dev/sda3 ro

initrd /boot/initrd.img-2.6.18-4-k7

title WinXP

root (hd0,0)

makeactive

chainloader +1

}}}

Next you need to run [[GrubConfiguration#installation|grub-install]] to set up the default change.

=== KDE usage ===

Kde has a built in implementation of this.

To set this up go to

Control Center > System Administration > Login Manager > Shutdown > Miscellaneous

And set Boot Manager to "Grub"

Now when you go to reboot, at the shutdown screen if you click-hold the mouse over reboot you get a drop down menu where you can select which OS you want to go to.