(Solved) I can't change the boot order in Grub2

Questions about Grub, UEFI,the liveCD and the installer
Forum rules
Before you post read how to get help. Topics in this forum are automatically closed 6 months after creation.
Locked
owend

(Solved) I can't change the boot order in Grub2

Post by owend »

I've been running Mint 17.1 as the solo OS on a new-build machine. I've just installed 17.3 as a second OS. Grub2 picks both up, but always with 17.1 as the first, default, OS. Both OSs work fine when selected.

I want to put 17.3 as default and shorten the timeout from 10 to, say, 3 seconds but I can't! I've tried grub-customizer which I can alter to show the order and timeout I want but it makes no difference at the grub bootscreen.

It's not a major headache, I can scroll down the grub screen, and anyway when 17.3 is fully tested I can delete 17.1, but it's a) a small pain to have to pay attention on booting and scroll down and b) for my own education I want to know how to change the boot order. Any ideas please? I've searched the forum and Google but most suggest grub-customizer or playing with grub.cfg which I'm a bit reluctant to do as it tells me not to!
Last edited by LockBot on Wed Dec 28, 2022 7:16 am, edited 2 times in total.
Reason: Topic automatically closed 6 months after creation. New replies are no longer allowed.
Cosmo.
Level 24
Level 24
Posts: 22968
Joined: Sat Dec 06, 2014 7:34 am

Re: I can't change the boot order in Grub2

Post by Cosmo. »

Enter in a terminal

Code: Select all

gksudo gedit /etc/default/grub
This assumes that you use the Cinnamon desktop. You missed to tell us, which you actually use.

Edit the line

Code: Select all

GRUB_DEFAULT=0
and change the value accordingly; note that the numbering starts with 0 for the first entry.

You can also change the value for GRUB_TIMEOUT for the timeout.

Save the changes and quit the editor, than open a terminal and enter

Code: Select all

sudo update-grub
I disadvice to use the grub-customizer. Not only is it not necessary to reach what you want, but it also can give troubles at a later time, as I described here.
User avatar
Pjotr
Level 24
Level 24
Posts: 20048
Joined: Mon Mar 07, 2011 10:18 am
Location: The Netherlands (Holland) 🇳🇱
Contact:

Re: I can't change the boot order in Grub2

Post by Pjotr »

The solution is rather simple, thankfully: just boot into 17.3 and re-install Grub when in 17.3. That should make the Grub menu of 17.3 dominant, and in the 17.3 menu it's 17.3 itself that's on top of the boot list.
Tip: 10 things to do after installing Linux Mint 21.3 Virginia
Keep your Linux Mint healthy: Avoid these 10 fatal mistakes
Twitter: twitter.com/easylinuxtips
All in all, horse sense simply makes sense.
owend

Re: I can't change the boot order in Grub2

Post by owend »

Thanks for the quick replies, impressive!

Cosmo: sorry, yes it's Cinnamon. I've tried your route several times and no change to the boot order. One of the oddities is that if I run update-grub it finds the kernel for 17.3 but no partition (it's on sda4), then finds and names 17.1:

owen@owen-Z97M-D3H ~ $ sudo update-grub
[sudo] password for owen:
Generating grub configuration file ...
Found linux image: /boot/vmlinuz-3.19.0-32-generic
Found initrd image: /boot/initrd.img-3.19.0-32-generic
No volume groups found
Found Linux Mint 17.1 Rebecca (17.1) on /dev/sda2
Adding boot menu entry for EFI firmware configuration
done
owen@owen-Z97M-D3H ~ $

Pjotr: I've reinstalled Grub2 while in 17.3, again no results. Did you mean for me to install Grub legacy, which is available through Software Manager? It seems a bit of a backward move!

Owen
Cosmo.
Level 24
Level 24
Posts: 22968
Joined: Sat Dec 06, 2014 7:34 am

Re: I can't change the boot order in Grub2

Post by Cosmo. »

The output looks OK. I think, that you did that from LM 17.3. Only 17.1 is listed in the lower part, as it is the only inactive system at that time.

The new value for GRUB_DEFAULT does not change the boot order, but changes the pre-selected entry.
User avatar
Pjotr
Level 24
Level 24
Posts: 20048
Joined: Mon Mar 07, 2011 10:18 am
Location: The Netherlands (Holland) 🇳🇱
Contact:

Re: I can't change the boot order in Grub2

Post by Pjotr »

My guess is, that the part of Grub that resides in the MBR, is (or was) pointing to the wrong Mint for its bootloader menu. Namely the bootloader menu of 17.1. This could happen after installing updates for Grub in 17.1. In the Grub menu of 17.1, of course 17.3 will be second.

Simply re-installing Grub when in 17.3 should solve that. Not changing to another Grub, but just re-installing the already installed Grub. That should cause the part of Grub that's in the MBR, to point to Mint 17.3 again for its bootloader menu. In which 17.3 is of course the first boot line.

The solution of Cosmo implies configuring the 17.1 bootloader menu to boot 17.3 first. My solution implies switching to the bootloader of 17.3.
Tip: 10 things to do after installing Linux Mint 21.3 Virginia
Keep your Linux Mint healthy: Avoid these 10 fatal mistakes
Twitter: twitter.com/easylinuxtips
All in all, horse sense simply makes sense.
owend

Re: I can't change the boot order in Grub2

Post by owend »

I've reinstalled grub-efi-amd64 and run efibootmgr:

owen@owen-Z97M-D3H ~ $ sudo efibootmgr
BootCurrent: 0009
Timeout: 1 seconds
BootOrder: 0009,0003,0005,0000,0006,0008
Boot0000* ubuntu
Boot0003* Samsung SSD 850 EVO 250GB
Boot0005* WDC WD10EZEX-00BN5A0
Boot0006* HL-DT-ST DVDRAM GH41N
Boot0008 UEFI: WDC WD10EZEX-00BN5A0
Boot0009* ubuntu

then update-grub and grub-install:

owen@owen-Z97M-D3H ~ $ sudo update-grub
[sudo] password for owen:
Generating grub configuration file ...
Found linux image: /boot/vmlinuz-3.19.0-32-generic
Found initrd image: /boot/initrd.img-3.19.0-32-generic
No volume groups found
Found Linux Mint 17.1 Rebecca (17.1) on /dev/sda2
Adding boot menu entry for EFI firmware configuration
done
owen@owen-Z97M-D3H ~ $

owen@owen-Z97M-D3H ~ $ sudo grub-install /dev/sda
Installing for x86_64-efi platform.
grub-install.real: error: cannot find EFI directory.
owen@owen-Z97M-D3H ~ $

grub-install always used to list the OSs it had found - not now? sda1 is 512Mb, 4.39Mb used, formatted fat32, flagged boot. As efibootmgr ran, I presume I DO have an EFI directory?

As you can tell, I'm not fluent - pjotr helped me with a freezing problem in November, which is fully cured now, so many thanks for that, but I seem to be lost again!
User avatar
austin.texas
Level 20
Level 20
Posts: 12003
Joined: Tue Nov 17, 2009 3:57 pm
Location: at /home

Re: I can't change the boot order in Grub2

Post by austin.texas »

owend wrote:I want to put 17.3 as default
Boot into 17.3 and enter the command:

Code: Select all

sudo grub-install /dev/sda
owend wrote:Pjotr: I've reinstalled Grub2 while in 17.3, again no results. Did you mean for me to install Grub legacy, which is available through Software Manager? It seems a bit of a backward move! Owen
You do not need to "reinstall Grub2", what you need to do is install Grub to the MBR with the above command .

EDIT: I see you posted the result of that as I was posting. If you have a UEFI installation you install Grub to the ESP, not the MBR.
Mint 18.2 Cinnamon, Quad core AMD A8-3870 with Radeon HD Graphics 6550D, 8GB DDR3, Ralink RT2561/RT61 802.11g PCI
Linux Linx 2018
owend

Re: I can't change the boot order in Grub2

Post by owend »

How do I do that? I tried /dev/sda1 (where my boot partition is):

owen@owen-Z97M-D3H ~ $ sudo grub-install /dev/sda1
[sudo] password for owen:
Installing for x86_64-efi platform.
grub-install.real: error: cannot find EFI directory.
owen@owen-Z97M-D3H ~ $
User avatar
austin.texas
Level 20
Level 20
Posts: 12003
Joined: Tue Nov 17, 2009 3:57 pm
Location: at /home

Re: I can't change the boot order in Grub2

Post by austin.texas »

If sudo grub-install sda and sudo grub-install sda1 both failed then you have a problem. Maybe you installed one Mint in UEFI mode and installed the other in Legacy mode and messed things up.
Boot into Mint 17.1 and run the command:

Code: Select all

[ -d /sys/firmware/efi ] && echo "Currently in EFI mode" || echo "Currently in Legacy mode"
Post the result of that here. Then do the same thing with Mint 17.3
Mint 18.2 Cinnamon, Quad core AMD A8-3870 with Radeon HD Graphics 6550D, 8GB DDR3, Ralink RT2561/RT61 802.11g PCI
Linux Linx 2018
owend

Re: I can't change the boot order in Grub2

Post by owend »

As requested:

In 17.1:
owen@owen ~ $ [ -d /sys/firmware/efi ] && echo "Currently in EFI mode" || echo "Currently in Legacy mode"
Currently in EFI mode
owen@owen ~ $

In 17.3:
owen@owen-Z97M-D3H ~ $ [ -d /sys/firmware/efi ] && echo "Currently in EFI mode" || echo "Currently in Legacy mode"
Currently in EFI mode
owen@owen-Z97M-D3H ~ $
User avatar
austin.texas
Level 20
Level 20
Posts: 12003
Joined: Tue Nov 17, 2009 3:57 pm
Location: at /home

Re: I can't change the boot order in Grub2

Post by austin.texas »

Great, thanks.
Review the process for creating a ESP here, and make sure your ESP conforms - http://forums.linuxmint.com/viewtopic.php?p=912036
Mint 18.2 Cinnamon, Quad core AMD A8-3870 with Radeon HD Graphics 6550D, 8GB DDR3, Ralink RT2561/RT61 802.11g PCI
Linux Linx 2018
owend

Re: I can't change the boot order in Grub2

Post by owend »

I tried all sorts then gave up! I did a fresh install of 17.3 on top of where 17.1 was (having done copious backups :D ) .sda1 used to have no entry for the Mount Point, and now its says /boot/efi, so the lack of an EFI directory is explained. The previous 17.3 also boots when selected, although I don't need it, so all works OK. I still don't know why the EFI directory was missing, but thanks to all for your help - I learned a lot about Mint's bootup, EFI etc!

Not strictly true but I'm marking this thread as solved.

Owen
Locked

Return to “Installation & Boot”