The Ubuntu20.04 system is installed under win10. By default, the Ubuntu system is started.
To set the default boot system to win10, the method is as follows:
1. Enter the ubuntu system, hold down the Ctrl+Alt+T keys, and open the terminal.
2. Enter the command:
sudo gedit /etc/default/grub
Change line 6 GRUB_DEFAULT=0
to the serial number of the system you want to start by default, and save it after setting;
# If you change this file, run 'update-grub' afterwards to update
# /boot/grub/grub.cfg.
# For full documentation of the options in this file, see:
# info -f grub -n 'Simple configuration'
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=""
The system number is the order of the menus displayed on the computer screen at startup.
Ubuntu defaults to the first one, with a serial number of 0, and the win10 system is generally at the third, with a serial number of 2, so set GRUB_DEFAULT=2.
# If you change this file, run 'update-grub' afterwards to update
# /boot/grub/grub.cfg.
# For full documentation of the options in this file, see:
# info -f grub -n 'Simple configuration'
GRUB_DEFAULT=2
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=""
3. Enter (sudo) update-grub command to update the grub file
root@a512-3060:/home/lyq# update-grub
Sourcing file `/etc/default/grub'
Sourcing file `/etc/default/grub.d/init-select.cfg'
Generating grub configuration file ...
Found linux image: /boot/vmlinuz-5.15.0-53-generic
Found initrd image: /boot/initrd.img-5.15.0-53-generic
Found linux image: /boot/vmlinuz-5.15.0-52-generic
Found initrd image: /boot/initrd.img-5.15.0-52-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/nvme0n1p4@/efi/Microsoft/Boot/bootmgfw.efi
Adding boot menu entry for UEFI Firmware Settings ...
done
4. Restart the system to enter the Windows system by default.
Note:
The file under the path /etc/default/grub is modified, and then update-grub is used to automatically update the file /boot/grub/grub.cfg.
You cannot modify /boot/grub/grub.cfg directly.
If you directly modify /boot/grub/grub.cfg here, the system will not start.
And it says in the file that this file cannot be modified. told the correct way.