Grub It is that menu that appears on our computer and that allows us to choose which distro (or operating system) we want to use at that moment. That is, many of you will see in Grub several options for Ubuntu, Debian, ArchLinux or another distro, as well as the option to start with Windows (in case you have it installed).
By default they will enter through the 1st option, generally through the most updated kernel that they have in their distro, in my case by default it enters through Debian kernel v3.2.0-4-686-pae regardless of whether you have other kernels or other operating systems, then the question:
How to configure our computer so that by default it accesses NOT by the first option but by the one we want?
Although there are graphical applications that do this, here I will show you how to do it using only the terminal.
First we must know what options we have, for this in a terminal we write the following:
grep menuentry /boot/grub/grub.cfg
Our options will appear, something like this:
As you can see, every line that starts with «menentry" it is an option. Let's say that I want to set by default so that my system always accesses (by default I repeat) through Windows XP, located in / dev / sda1.
For this we must edit another file, in this case we must edit: / Etc / default / grub
To do this in a terminal we write the following:
sudo nano /etc/default/grub
su
through which they will be asked for the root password, and then they will be able to execute: nano /etc/default/grub
You will see something like this:
As you can see in the image, I pointed out GRUB_DEFAULT = 0 which is the line that indicates the option by which it will be accessed by default. That is, suppose that I want my laptop to always enter Windows XP by default (option number 9, as indicated in the first image) then that line should be: GRUB_DEFAULT = 8
Also in the next line it says: GRUB_TIMEOUT = 5, this refers to the waiting time, the seconds that Grub2 will wait before opening the default option, that is, the seconds they have to use the Up and Down arrow keys to change the option that will be accessed.
Once this has been changed, we simply have to execute:
sudo update-grub
This will update what new they did, make the changes effective.
And voila, we are done 🙂
This tutorial was a bit long for me, but it doesn't mean that changing Grub2's default input is complex, it's actually quite simple.
Anyway, nothing more to add about it.
regards
/ code
The use of the terminal in linux is important and interesting, but for that I use grub costumizer, you download only one package in Ubuntu and you install it, it helps you to customize grub in all its aspects, which is what interests me and you don't have so much can or waste time remembering commands.
There are problems loading the page desdelinux.net review.
Yes ... the current hosting is not enough. Proof http://justice.desdelinux.net and you tell me how fast this blog clone is.
Thanks for your help 🙂
But what black magic did you do?
It is much faster.
heh heh ... elav already made a post about this 😉
Thanks for the advice. Anyway, I'll use it on my other old PC when I put Debian with Slackware on it.
the tutor is good ... about the Grub
Hello, I would like to add that in Archlinux to update the grub menu the following command is used:
grub-mkconfig -o /boot/grub/grub.cfg (done as root)
on other distros it is: grub2-mkconfig -o /boot/grub2/grub.cfg
I really didn't think it was so simple to do it.
I am going off the subject a bit, but I take the opportunity to ask, can you put an extra input to boot from CD or USB in Grub2?
Greetings to all
One doubt, seeing the example, I BELIEVE that the first option is 0, therefore for WinXP it would be 8. Is this correct?
All the best
Indeed, thank you very much for the warning, I have already edited the post 🙂
Thanks, you put it as it is, SIMPLE
Could you explain how to change grub's face, please, 😀
Hello, how are you?
We have already published several things about Grub, how to put a password, how to change its appearance, etc, take a look here - » https://blog.desdelinux.net/tag/grub/
regards
I test if he is in a fedora, the fedora grub is different from the oldbian grub
Thank you very much for the tutorial and making it easy for us KZKG ^ Gaara.
Best regards
Thank you very much, the topic was accurate. I learn from you.
very good my friend, very detailed
Thank you
Muchaaaaaaaaaaaaas thanks!
It helped me a lot.
Perfect on grub 2.02 beta ubuntu 14.4
Thank you very much, effective, direct, easy to understand… .. and better than a live disk with supergrub or more complex things. Thanks for your time for others
Hi KZKG ^ Gaara, I recently bought a computer without OS, I installed windows 7 ultimate first and then Ubuntu 14.04.
When I try to set it to boot with windows 7 by default, I modify the grub file but put the number that I put by default (either that of windows 7, in my case GRUB DEFAULT = 7, or any other) it does not move from ubuntu when I turn off and on the computer again. I have updated after modifying so that would not be.
Do you know any reason why even if I modify the file the boot does not move from Ubuntu?
Thank you very much in advance.
hello how are you, I have a problem, I had installed ubuntu 14.10 and mint 17.1, and I decided to install elementary os luna, when doing so, the grub was modified and ubuntu changed from being the default option to being in the 5 position, and after applying The changes as you say in any way possible I cannot make Ubuntu the operating default again and leave elementary os as a last option. What can I do about it, thank you very much, I appreciate a prompt response. thanks.
Thank you very much!
It has helped me a lot, I was already beginning to be worried. But thanks for this tutorial, although it is something "basic", it is important
Good Morning.
Dear very successful, your very simple and easy knowledge helped me a lot, thank you
Thank you! Re simple and well explained.
How do I configure grub2 to start from another disk to the one already configured?
Regards. Excellent explanation
After having configured the grub, now Windows does not come out ... Far from the first boot option ... What could I do to fix it ... Thanks
Hi. Thanks for your time. I adhere to the IMS comment, easy and direct. Cheers
Simple explanation and very well exposed. Thank you
friend, the image is nice, but I like to use more 15s / px in TIMEOUT, it is a tip for you.
You also have mixed kebab with free cocacolo potatoes, you pay in my kebab
luck in your life ♥
What do you say INFIDEL, I stoned you and you don't even realize uuuhuhuhuhuhuhuhu
I ask a question can you do the same from Windows? I explain I want to be able to start one or another operating system by remote desktop, so if I am on Linux I can modify the Grub so that it starts Windows. Now if I am on Windows, can I modify it to start Ubuntu?
Hi ADrian, your question is very interesting, I'm sorry to tell you that from windows 98 you can't, it's a shame but you have to hold on….
also the tablets conflict with MAC Yosemite, FUCK I'M UP TO THE EGGS ALREADY
By the way do you like databases?
Thanks for your explanation, quite broad and precise