I have both Windows 7 and Ubuntu installed on a shared machine. Because a lot of the non-developers use Windows, I'd like to change the boot order to make it easier for them.
Currently the boot order looks like the following:
- Ubuntu 11.10 kernelgeneric *86
- Ubuntu 11.10 kernelgeneric *86 (safe boot)
- Memory test
- Memory test
- Windows 7 on
/dev/sda6
How do I change the default order so that Windows 7 is at the top of the list?
- Windows 7 on
/dev/sda6
- Ubuntu 11.10 kernelgeneric *86
- Ubuntu 11.10 kernelgeneric *86 (safe boot)
- Memory test
- Memory test
You can use an easy-to-use the GUI application called Grub Customizer to make your life a little bit easier. As the name suggests, you can do much more than just reordering GRUB menu entries with it. You can install it from a PPA in 18.04 and older releases, and from the official repositories in 20.04 and newer.
In 18.04 and older releases, add this PPA (you can skip this command on 20.04 and newer):
And then run:
(See also this Ask Ubuntu question: https://askubuntu.com/questions/35629.)
There is an How-To Geek article about it, How to Configure the Linux GRUB 2 Boot Menu the Easy Way. Take a look at it if you're interested. Also, there is a solved thread on the Ubuntu Forums, Change boot order in GRUB 2 that mentions this tool.
Here are some screenshots:
Some troubleshooting:
The Grub Customizer settings may work only from within the latest Linux/Ubuntu installation, the one that installed the Grub.
For example, if somebody has two OS-es installed (Windows and Ubuntu), and then installs a third OS (Manjaro, etc) and then tries to follow the above answer, Grub Customizer changes will not work when made from the second OS (Ubuntu, in the example). The program has to be installed in the third OS, as it seems that Grub Customizer can only edit the Grub files created by the installation of the system on which itself is installed.
The files that determine the Grub boot menu come in most cases with the latest system installed on a machine, so Grub Customizer has to be installed and used from that Linux system.
You can also change the grub default boot entry from the command line without having to install any additional tool. This won't change the order in the list but it will allow a different OS to boot by default, which sounds like what you may want anyway.
First, make a backup copy of
/etc/default/grub
. In case something goes wrong, you can easily revert to the known-good copy:Then edit the file using
vim
or the text editor of your choice:Find the line that contains
and set it to
where
x
is the index of grub menu item to which you would like to boot to by default. Note that the menu items are zero-indexed. That means that the first item in the list is0
and that the sixth item is actually5
. So to boot to the sixth item in the list, the line would read:If you forgot the order of the items, take a look at
/boot/grub/grub.cfg
. Each menu entry is specified by a line of type:You can also chose the default by the name instead of index, e.g.:
if there was a
menuentry 'Ubuntu'
line on/boot/grub/grub.cfg
. This may be a better method, as it does not depend on the order of the entries, which could change.To use a kernel in the "Previous Linux Versions" sub-menu use:
(make sure to include the quotations), where
x
is the index of the old kernel on the sub-menu, or the name of the kernel as it appears in/boot/grub/grub.cfg
. For example,Then build the updated grub menu:
From the tombuntu site (article by Tom):
I know this is a very old question and I don't have enough reputation to comment this, so for anyone still looking to do it without Grub-Customizer because of it's infamy:
This method assumes you have a dual-boot with one Linux and a Windows installation. Since the order in
/etc/grub.d
specifies the order in which they are called, you could simply callos-prober
first and then add the remaining entries.This works great and puts Windows on top of the list.
I can't find the source, but will provide it if I come across it again.
first
second
third
Open
Grub Customizer
And you can edit your grub You can even change your grub wallpaper it's a great toolRisk Involved whether you use the tool or edit the grub.cfg file
BEFORE STARTING
Please note that this will make a large mess of all of your GRUB files. Please be aware of that annoying issue! That is all you need to know prior to starting.
On startup, enter Ubuntu. When Ubuntu starts up, enter either the terminal. Enter the following commands:
When that command opens, chnage GRUB_DEFAULT=0 to GRUB_DEFAULT=saved and then enter. Update GRUB with the command
Finally, set default OS with
sudo grub-set-default NUMBER
. NUMBER is the number of the OS that you want to set to default.OR
Install GRUB-customizer with the following commands:
Cited from: https://tipsonubuntu.com/2016/07/20/grub2-boot-order-ubuntu-16-04/
This may provide more detailed information on what you are looking for. I hope this helps.
I tried the following and got good results.
Open up a terminal window (Ctrl+Alt+T),
Type
sudo gksu nautilus
and press Enter. Type in your user password.Navigate to the file
/boot/grub/grub.cfg
. Copy and Paste the file into same directory, should create copy of the grub.cfg file for backup purposes. Then double-click grub.cfg to open the file in a text editor.In the file you will find the line (
set default="0"
). Edit the 0 to the line number in Grub that you want to load. Mine was the sixth line, so I used 5, as the first line is considered 0. Save the file. Reboot the pc and if you chose the correct line it will be the highlighted one when Grub loads.Good luck
Open up a terminal window (Ctrl+Alt+T), or press Alt+F2.
Type
gksu nautilus
and press Enter.That will open up the file browser Nautilus with permission to change files owned by root.
Navigate to the file
/boot/grub/grub.cfg
and double-click to open the file in a text editor.Cut, move and paste the sections in that file that belongs to different operating systems. You must be very careful when doing this, as if you do it wrong then you won't be able to boot anymore. Windows boot can always be repaired with the tools from a windows installation disc (
FIXMBR
), that overwrites GRUB-MBR with a typical Windows-MBR.I have tested it from Ubuntu 9.04 to 12.04 and it has worked fine every time.
But I have only tried to move the Windows boot section to the top of the list to make it become the default.
If my memory is correct, each boot menu section in the file starts with a
begin
... and ends with an ...end
. And spans multiple text rows.The text in that file has become a bit more complicated and it doesn't look the same in the last Ubuntu version as in previous versions. So use your brain to save you from doing a mistake.