Cogito ergo sum

How to make Windows the default OS to boot into instead of Ubuntu Linux on a computer with dual-boot4 min read

Like many developers, I run Windows 10 alongside Ubuntu 20.04. I use both of them regularly, but I use Windows most of the time since I work with a couple of programs that are only available on Windows.

When I boot up my computer, the following screen is being displayed on the monitor. As you can see , Ubuntu is the default boot option. If I don’t touch the keyboard (moving the arrow keys up and down) or choose Windows, the computer will boot into Ubuntu Linux. It’s really annoying when I turn on my computer and I go to the kitchen to grab a coffee, and by the time I am back the computer has already booted into Linux. Grub_menu_screen_with_Ubuntu_as_default_option_Peshmerge_io
Here is how to change that and your daily tragedy 😛

  1. Boot into Ubuntu (for doing this just let the computer to boot into Ubuntu, lmao ) and open the terminal by pressing alt+ctrl+t.
  2. Run the following command: sudo fgrep menuentry /boot/grub/grub.cfg. You are supposed to see an output similar to what I have (it could be slightly different in your case) :
    [sudo] password for peshmerge: 
    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-92ea7af3-4ae5-42f3-8f43-fce35056913a' {
    submenu 'Advanced options for Ubuntu' $menuentry_id_option 'gnulinux-advanced-92ea7af3-4ae5-42f3-8f43-fce35056913a' {
    menuentry 'Ubuntu, with Linux 5.8.0-34-generic' --class ubuntu --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-5.8.0-34-generic-advanced-92ea7af3-4ae5-42f3-8f43-fce35056913a' {
    menuentry 'Ubuntu, with Linux 5.8.0-34-generic (recovery mode)' --class ubuntu --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-5.8.0-34-generic-recovery-92ea7af3-4ae5-42f3-8f43-fce35056913a' {
    menuentry 'Ubuntu, with Linux 5.4.0-58-generic' --class ubuntu --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-5.4.0-58-generic-advanced-92ea7af3-4ae5-42f3-8f43-fce35056913a' {
    menuentry 'Ubuntu, with Linux 5.4.0-58-generic (recovery mode)' --class ubuntu --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-5.4.0-58-generic-recovery-92ea7af3-4ae5-42f3-8f43-fce35056913a' {
    menuentry 'Windows Boot Manager (on /dev/sda1)' --class windows --class os $menuentry_id_option 'osprober-efi-3A76-66A1' {
    menuentry 'UEFI Firmware Settings' $menuentry_id_option 'uefi-firmware' {

    Select the following entry and copy it: 'Windows Boot Manager (on /dev/sda1)' which is obviously the entry responsible for booting the computer into Windows 10.

  3. Then, run the following command: sudo vim /etc/default/grub. You are supposed to see something like this:
    # 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=""
    
    # Uncomment to enable BadRAM filtering, modify to suit your needs
    # This works with Linux (no patch required) and with any kernel that obtains
    # the memory map information from GRUB (GNU Mach, kernel of FreeBSD ...)
    #GRUB_BADRAM="0x01234567,0xfefefefe,0x89abcdef,0xefefefef"
    
    # Uncomment to disable graphical terminal (grub-pc only)
    #GRUB_TERMINAL=console
    
    # The resolution used on graphical terminal
    # note that you can use only modes which your graphic card supports via VBE
    # you can see them in real GRUB with the command `vbeinfo'
    #GRUB_GFXMODE=640x480
    
    # Uncomment if you don't want GRUB to pass "root=UUID=xxx" parameter to Linux
    #GRUB_DISABLE_LINUX_UUID=true
    
    # Uncomment to disable generation of recovery mode menu entries
    #GRUB_DISABLE_RECOVERY="true"
    
    # Uncomment to get a beep at grub start
    #GRUB_INIT_TUNE="480 440 1"
  4. Replace the value of GRUB_DEFAULT which is 0 with the entry you have copied earlier in step 2 'Windows Boot Manager (on /dev/sda1)' and save & close the file.
  5. After that, run the following command sudo update-grubto update the /boot/grub/grub.cfg file.
  6. Finally, reboot your computer. You are supposed to see that Windows is being selected as a default OS in your GRUB menu just like what I have here Grub_menu_screen_with_Windows10_as_default_option_Peshmerge_io.jpg

References:

Grub2

About the author

Peshmerge Morad

A IT-student and a programmer based in the Netherlands whose interests span multiple fields.

Add comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Cogito ergo sum