I first had Windows 11 installed on my machine on one M.2 drive and then installed a 2nd M.2 drive on which I installed Ubuntu. This approach made Ubuntu the default OS in the grub boot loader.
To change it so it remembers that Windows should be the default OS on a reboot, I needed to follow these steps.
sudo grep menuentry /boot/grub/grub.cfg
That gave the output of:
if [ x"${feature_menuentry_id}" = xy ]; then
menuentry_id_option="--id"
menuentry_id_option=""
export menuentry_id_option
menuentry 'Ubuntu' --class ubuntu --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-simple-dbfe348d-411a-44f9-8122-bf0804dab992' {
submenu 'Advanced options for Ubuntu' $menuentry_id_option 'gnulinux-advanced-dbfe348d-411a-44f9-8122-bf0804dab992' {
menuentry 'Ubuntu, with Linux 6.5.0-28-generic' --class ubuntu --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-6.5.0-28-generic-advanced-dbfe348d-411a-44f9-8122-bf0804dab992' {
menuentry 'Ubuntu, with Linux 6.5.0-28-generic (recovery mode)' --class ubuntu --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-6.5.0-28-generic-recovery-dbfe348d-411a-44f9-8122-bf0804dab992' {
menuentry 'Ubuntu, with Linux 6.5.0-18-generic' --class ubuntu --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-6.5.0-18-generic-advanced-dbfe348d-411a-44f9-8122-bf0804dab992' {
menuentry 'Ubuntu, with Linux 6.5.0-18-generic (recovery mode)' --class ubuntu --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-6.5.0-18-generic-recovery-dbfe348d-411a-44f9-8122-bf0804dab992' {
enuentry 'Windows Boot Manager (on /dev/nvme1n1p1)' --class windows --class os $menuentry_id_option 'osprober-efi-A453-CEC1' {
menuentry 'UEFI Firmware Settings' $menuentry_id_option 'uefi-firmware' {
I copied this piece of information from near the end:
Windows Boot Manager (on /dev/nvme1n1p1)
Next I ran the command to edit grub:
sudo nano -B /etc/default/grub
In the editor the uncommented items are:
GRUB_DEFAULT=0
GRUB_TIMEOUT_STYLE=hidden
GRUB_TIMEOUT=10
GRUB_DISTRIBUTOR=`lsb_release -i -s 2> /dev/null || echo Debian`
GRUB_CMDLINE_LINUX_DEFAULT="quiet splash"
GRUB_CMDLINE_LINUX=""
You need to change it to:
GRUB_DEFAULT="Windows Boot Manager (on /dev/nvme1n1p1)"
GRUB_TIMEOUT_STYLE=hidden
GRUB_TIMEOUT=10
GRUB_DISTRIBUTOR=`lsb_release -i -s 2> /dev/null || echo Debian`
GRUB_CMDLINE_LINUX_DEFAULT="quiet splash"
GRUB_CMDLINE_LINUX=""
Note: Some versions of Ubuntu require single quote (') vice double quote (").
Update Grub
sudo update-grub
The output looked like this on my screen.
Sourcing file `/etc/default/grub'
Sourcing file `/etc/default/grub.d/init-select.cfg'
Generating grub configuration file ...
Found linux image: /boot/vmlinuz-6.5.0-28-generic
Found initrd image: /boot/initrd.img-6.5.0-28-generic
Found linux image: /boot/vmlinuz-6.5.0-18-generic
Found initrd image: /boot/initrd.img-6.5.0-18-generic
Memtest86+ needs a 16-bit boot, that is not available on EFI, exiting
Warning: os-prober will be executed to detect other bootable partitions.
Its output will be used to detect bootable binaries on them and create new boot entries.
Found Windows Boot Manager on /dev/nvme1n1p1@/efi/Microsoft/Boot/bootmgfw.efi
Adding boot menu entry for UEFI Firmware Settings ...
done