DEV Community

svhl
svhl

Posted on

Changing the GRUB boot order in current year

There are way too many forum posts talking about reordering entries in the GRUB menu. Some methods are too complicated, some don't work anymore, and some people even advise against doing it. Here's the simplest method I've found so you don't have to go through dozens of Google results.

Avoid GRUB Customizer!

Before we begin, I'd suggest steering clear of GRUB Customizer since it can cause issues. Initially, I tried this method, but it created duplicate entries in my GRUB menu. In case your GRUB menu also got messed up, I'll cover how to fix it in the below section as well.

The actual solution

In this example, I am going to move Windows above Linux. Go to /etc/grub.d. You'll see a file called 30_os-prober or something similar in the directory.

$ ls /etc/grub.d/
00_header
05_debian_theme
10_linux
20_linux_xen
20_memtest86+
30_os-prober
40_custom
41_custom
README
Enter fullscreen mode Exit fullscreen mode

You'll also notice two files called 00_header and 05_debian_theme.

00_header sets environmental variables such system file locations, video settings, and previously saved entries.

05_debian_theme sets the GRUB 2 background image, text colors, selection highlighting and themes.

The boot entry after these will show up first in GRUB. Change the number of the os-prober file to change the order. Rename 30_os-prober to something like 09_os-prober, then update GRUB.

$ sudo mv 30_os-prober 09_os-prober
$ sudo update-grub
Enter fullscreen mode Exit fullscreen mode

In case GRUB Customizer created duplicate boot entries, delete those files from this directory. Afterwards, update GRUB like above. That's it! Reboot your system to see the changes.

Top comments (1)

Collapse
 
sanikava profile image
sanikava

It's true breaking your boot loader is common but customizing them without checking or testing is bad idea lol if it works don't touch it

I also broke my boot loader grub many times
and fixed too by using CHROOT from live usb