A while back I had to solve the problem of removing an operating system entry from the Grub 2 bootloader.
Today I solved a related problem: changing the order in which the OS entries appear on the boot menu. It seems there are several solutions to this problem. The one I will show here was the most effective for me because I have already used the approach in the link above to remove an OS from Grub 2.
Here’s how you do it:
- Log in as root, or execute the following mv commands using “su” before your commands.
- Go to the “/etc/grub.d” directory.
$ cd /etc/grub.d
- Look at the directory:
- Which will give you a result that look something like this (numbers and names may vary).
00_header 10_linux 30_os-prober 41_custom
05_debian_theme 20_linux_xen 40_custom README
- Basically, the order of these numbers dictate what the order will be on the Grub menu. You can rename these files to change the order. In my case, I wanted to make one of my “custom” entries the first entry (because it was my Windows 7 partition).
$ mv 10_linux 15_linux
$ mv 40_custom 10_custom
- Now I just re-run update-grub to re-generate the boot menu table.
- We can check that things are ok by looking through the generated file. In my case, I checked that my Windows 7 entry was present in the file. Interpreting this file deeply requires a lot of knowledge, so don’t worry if it is mostly gibberish.
$ vi /boot/grub/grub.cfg
- Restart your computer to see the new boot menu order.