GRUB Choose Default Explained: Pick Your Boot Entry Permanently
GRUB (GRand Unified Bootloader) controls which OS or kernel your machine boots. “Choose Default” means configuring GRUB so a specific menu entry is selected automatically at boot. Below is a concise, actionable guide to set a permanent default and related tips.
How GRUB selects the default
- GRUB_DEFAULT in /etc/default/grub defines the default entry.
- Numeric index: 0 = first entry, 1 = second, etc.
- Quoted string: exact menu entry title.
- submenu_entry syntax: “1>2” selects the third entry inside the second submenu.
- grub-reboot and grub-set-default toggle temporary vs permanent defaults:
- grub-reboot X — make X the default for the next boot only.
- grub-set-default X — make X the default until changed.
Step-by-step: Set a permanent default (common Debian/Ubuntu)
- Open /etc/default/grub with root privileges.
- Set GRUB_DEFAULT to the desired value:
- By index: GRUB_DEFAULT=2
- By full menu title: GRUB_DEFAULT=“Ubuntu, with Linux 5.15.0-xx-generic”
- By submenu: GRUB_DEFAULT=“1>2”
- Save and update GRUB configuration:
- Debian/Ubuntu: sudo update-grub
- Fedora/RHEL: sudo grub2-mkconfig -o /boot/grub2/grub.cfg
- Reboot to confirm.
Using grub-set-default (preferred when menu entries change)
- List saved entries:
- awk -F”‘” ‘/menuentry / {print ++i “ : ” $2}’ /boot/grub/grub.cfg
- Set permanent default by menu title or index:
- sudo grub-set-default “Ubuntu, with Linux 5.15.0-xx-generic”
- sudo grub-set-default 2
- Check current saved default:
- sudo grub-editenv list
Troubleshooting
- Menu titles change after kernel updates — use grub-set-default with full title or use saved entries via grub-editenv.
- Submenu miscounting — verify with the menuentry listing command above.
- UEFI vs BIOS paths differ for grub.cfg; ensure you update the correct file (check distro docs).
Tips
- Use names (quoted titles) for clarity but update them after kernel upgrades.
- For scripting, prefer index-based or use awk to find the matching menuentry dynamically.
- To set a one-time next-boot entry, use grub-reboot; for permanent use grub-set-default.
If you want, I can generate the exact command sequence for your distro and current kernel list.
Leave a Reply