How to Change Boot Order on Linux

After setting up a dual-boot system, the secondary OS often becomes the default boot option. That’s just one common scenario, but regardless of the exact reasoning, configuring the boot options in Linux is pretty easy.

Linux distros use the GRUB boot loader. As such, you can edit the GRUB config file to set a specific boot entry as the default one. For UEFI systems specifically, the efibootmgr tool works as well.

Or, if you don’t need a Linux-specific solution, you can also change the boot order via the BIOS/UEFI. We’ve covered all these methods with full steps in this article.

Ways to Change Boot Order

The steps covered were tested on Ubuntu, but they’re applicable to most other distros as well. The only thing that might slightly differ is the location of the GRUB config file.

Edit GRUB Config File

You can change the default boot entry on Linux systems by editing the GRUB configuration file. There are various GRUB config files but the one at /etc/default/grub is used for user customization.

Before you begin, you can either use the cat /boot/grub/grub.cfg | grep menuentry command or check the current order of GRUB menu entries when booting.

gnu-grub-menu-entries

The menu items are zero-indexed, so the first entry is represented by 0, the second entry is 1, the third is 2, and so on.

1- Start by creating a backup of the config file with the following command:
sudo cp /etc/default/grub /etc/default/grub.bak

2- Now, open the config file with a text editor. We’ll use nano.
sudo nano /etc/default/grub

3- Change the value of the GRUB_DEFAULT line according to your current boot menu order. Setting it to 0 will set the first entry on the list as the default, 1 will set the second entry as the default, and so on.

See also  Rymdport: Securely Share Your Files with Another Wormhole Client

4- Press CTRL + O, then Enter to write out the changes to the config file.

5- Then, press CTRL + X to exit nano.

6- Finally, update GRUB with sudo update-grub.

Use EFI Boot Manager

While we only changed the default boot entry with the previous method, the efibootmgr tool allows you to actually change the boot order. As stated, this method won’t for Legacy BIOS systems. But on UEFI systems, you can use the efibootmgr tool as such:

1- First, enter efibootmgr and check the current boot order.

2- Use the -o flag to change the boot order as such:
sudo efibootmgr -o <order>

3- In our dual-boot system shown above, we set the order so that the boot manager tries booting from removable drives first. If that doesn’t work, it’ll instead boot from Ubuntu.

Change via BIOS/UEFI

In a Windows-Linux dual-boot, if the boot order in the BIOS/UEFI is set to prioritize the Windows Boot Manager, it will run before the GRUB bootloader. As such, GRUB’s boot order would be irrelevant. In such cases, you can access the firmware interface and change the boot order as such:

1- When booting, press the BIOS setup key shown on the screen (Function keys or Del).

2- On systems with Fast Boot enabled, you might not have enough time to see and press this key. In such cases, you can bring up the GRUB menu first.
With BIOS, press and hold Shift. With UEFI, press Esc a few times when booting. Then, select the Firmware Settings option in the GRUB menu.

See also  Steps to Add Applications to the Ubuntu Desktop 23.04

3- Go to the Boot tab and change the boot order here so that the Linux installation is placed higher than the Windows Boot Manager.

4- Press the key shown on the screen (usually F10) to save the changes and exit.

Now, the GRUB bootloader should start by default when booting. If you want to make changes to the GRUB menu entries, you can check the steps from the first method.

Mohamed SAKHRI
Mohamed SAKHRI

I'm the creator and editor-in-chief of Tech To Geek. Through this little blog, I share with you my passion for technology. I specialize in various operating systems such as Windows, Linux, macOS, and Android, focusing on providing practical and valuable guides.

Articles: 1310

Newsletter Updates

Enter your email address below and subscribe to our newsletter

Leave a Reply

Your email address will not be published. Required fields are marked *