iTranslated by AI
How to Change the Default Boot OS in an Ubuntu and Windows Dual-Boot Setup
Goal
On a PC configured with a dual boot of Ubuntu 24.04 LTS and Windows 11, Ubuntu starts automatically by default. To start Windows 11, you must explicitly select it from the GRUB screen. In this article, we will change the settings to make Windows 11 the priority boot OS.
Environment
- OS
- Ubuntu 24.04 LTS
- Windows 11
- CPU: Intel Core i5-13600KF
- Motherboard: ASUS PRIME Z790-A WIFI-CSM
- Memory: DDR5 4800Mhz 16GB x 2
- Storage
- Ubuntu 24.04 LTS: NVMe SSD 512GB
- Windows 11: NVMe SSD 1TB
Procedure
Changes to the settings are made on the Ubuntu side.
1. Check the order of Windows in GRUB
First, check the GRUB configuration file by running the following command.
sudo grep -e "^\(menuentry\)\|\(submenu\)" /boot/grub/grub.cfg
menuentry 'Ubuntu' --class ubuntu --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-simple-c9ad25a9-c093-4a30-922a-701c9e646061' {
submenu 'Advanced options for Ubuntu' $menuentry_id_option 'gnulinux-advanced-c9ad25a9-c093-4a30-922a-701c9e646061' {
menuentry "Memory test (memtest86+x64.efi)" --class memtest $menuentry_id_option 'memtest86+' {
menuentry 'Memory test (memtest86+x64.efi, serial console)' --class memtest $menuentry_id_option 'memtest86+-serial' {
menuentry 'Windows Boot Manager (on /dev/nvme0n1p1)' --class windows --class os $menuentry_id_option 'osprober-efi-6AD7-3EFA' {
Looking at this, Windows Boot Manager is displayed in 5th place.
2. Change the settings
Next, edit the /etc/default/grub file.
sudo nano /etc/default/grub
Once you open this file, look for the following line:
GRUB_DEFAULT=0
This line specifies the OS that will be started by default. Change this line as follows. The numeric part should be changed according to the order of Windows confirmed earlier.
In this case, Windows Boot Manager is 5th, but since the sequence starts from 0, the value to set in GRUB_DEFAULT is 4.
GRUB_DEFAULT=4
3. Apply the settings
After changing the settings, update the GRUB configuration with the following command.
sudo update-grub
Now, when you restart, Windows 11 will be selected by default.
References
Discussion