# GRUB2 and default kernel boot

## pking

I just migrated from grub-legacy to grub2, following the migration guide.  All went well

enough, except for one extremely minor puzzle.  Under grub-legacy, I had two kernels

installed, usually a new one and the immediately preceding version -- say, 3.10.7 as the

tried-and-true kernel, with the new testing kernel 3.10.7-r1.  Well, after running the command

to configure grub2:

```

grub2-mkconfig -o /boot/grub/grub.cfg

```

it seems that grub2 found both kernels, but it made the earlier kernel (3.10.7) the default,

and the testing kernel (3.10.7-r1) only available under "Advanced Boot Options" or whatever

it's called.  But I'd prefer to boot into the testing kernel, with the tried-and-true option as the

backup.  The actual grub.cfg file has multiple scary warnings about not editing that file but to

edit entries in /etc/grub.d/ instead -- but there is nothing, or nothing obvious, there to change

this behaviour.  There is an entry in /etc/default/grub for which menuentry to boot by default,

but there is no obvious way to figure out from the mess that is grub.cfg what the number of

the menuentry is.

Anyone have a straightforward answer/solution? Not a major problem, but annoying nonetheless.

Thanks.

----------

## Aquous

The file you're looking for is /etc/default/grub

----------

## pking

As stated above:

 *Quote:*   

> 
> 
> There is an entry in /etc/default/grub for which menuentry to boot by default, 
> 
> but there is no obvious way to figure out from the mess that is grub.cfg what the number of
> ...

 

Googling around I found several websites suggesting to just "try out numbers" to see which

one works.  That seems like a step backwards; grub-legacy at least had a reasonable way to

proceed...

----------

## nemectic

As long as you're confident on what to change, and you have a live cd/usb to boot just in case, just edit your grub.cfg.

----------

## pking

Well, yes. Of course I can edit grub.cfg directly (keeping a spare boot device handy).  The

question was, is there some sensible and sane way to set the default kernel to boot?  Clearly

you can work it out by experimentation, and just as clearly you can write it from scratch, but

a direct and straightforward way would be appreciated, especially since it was easy to do in

grub-legacy [either put the default boot menuentry first in the list or read off its position in the

numerical list and change the "default boot" entry before the menu list].

I see I'm not the only one to ask, and that the proposed answers listed don't seem to work:

http://unix.stackexchange.com/questions/62733/how-to-correctly-set-up-the-right-grub-2-default-menu-entry

Don't think I'll be switching to grub2 on other systems if it's this much trouble for little by way of

concrete gain, at least in my case.

----------

## nemectic

I dont think theres much to gain switching to grub2 unless you use uefi. I'm away at the moment & typing on my phone, but if you post your grub.cfg and tell me which you want to load as default I'll happily take a look when I'm at a computer tomorrow if you haven't got it sorted by then.

----------

## pking

Thanks, but after looking into it I decided it wasn't worth my time to learn grub2 -- for

the next round of computers I'll use some version of efi booting that doesn't need any

bootloader; for this round, well, I already understand grub-legacy and it doesn't seem

to have any particular bugs and it isn't a security issue, so why change? Yes, it won't

get bugfixes, but it doesn't seem broken, either.  Whereas grub2 -- at least given the

"helpful" scripts provided by gentoo -- would be another learning curve, and, given the

way the future seems to be shaping up, no reason to bother.  If I need a new bootloader

in the meantime I'll use syslinux.

----------

