Sunday, April 28, 2024
 Popular · Latest · Hot · Upcoming
175
rated 0 times [  175] [ 0]  / answers: 1 / hits: 316710  / 2 Years ago, sat, october 8, 2022, 12:03:30

I installed a mainline kernel for testing purposes. I would like to set grub to boot from the older kernel by default.



I know I can set the GRUB_DEFAULT=0 setting for the first page of grub but how do I set it to boot by default from one kernel in the second page (Advanced page)?



I would prefer doing this without installing other software (ex. grub-customizer).




Related Questions:

How do I set Windows to boot as the default in the boot loader?

How do I change the grub boot order?



More From » grub2

 Answers
0

First, make a backup copy of /etc/default/grub. If something goes wrong, you can easily revert to the known-good copy.



sudo cp /etc/default/grub /etc/default/grub.bak


Then edit the file using the text editor of your choice (e.g. gedit, etc.).



sudo -H gedit /etc/default/grub


Find the line that contains GRUB_DEFAULT - this is what you'll want to edit to set the default. You must know the full name of the kernel you want - e.g. Ubuntu, with Linux 3.13.0-53-generic - along with the full name of the "advanced menu" - e.g. Advanced options for Ubuntu.



You then combine those two strings with > and set GRUB_DEFAULT to them as: GRUB_DEFAULT="Advanced options for Ubuntu>Ubuntu, with Linux 3.13.0-53-generic" (including quotes).



Save it, then build the updated grub menu.



sudo update-grub


See also: GNU GRUB Manual 2.02 or more specifically section 15.1.0 on setting the default.






Note: There is a method utilizing numbers to access kernels and menus but this is not recommended as it is unreliable when kernel updates occur.


[#34329] Sunday, October 9, 2022, 2 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
onbean

Total Points: 29
Total Questions: 102
Total Answers: 115

Location: Benin
Member since Fri, Mar 24, 2023
1 Year ago
onbean questions
Fri, Mar 18, 22, 19:49, 2 Years ago
Tue, Dec 6, 22, 11:51, 1 Year ago
Mon, Jun 7, 21, 17:21, 3 Years ago
Mon, Jan 16, 23, 04:48, 1 Year ago
Mon, Oct 17, 22, 14:51, 2 Years ago
;