Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

[gentoo-user] grub2 multiple kernels

227 views
Skip to first unread message

James

unread,
Jan 24, 2014, 3:40:01 PM1/24/14
to
Grub2 on gentoo, seems a bit confusing. I guess
I've just read too much that is system dependant ( version of grub2?)
(and to think the purpose of Grub2 was/is standarization?)


So I simple want to be able to add multiple linux kernels
to boot from. Many are experimental hacks, so I keep
quite a few around..... eventually, there will be
a windows7 boot need on lappys and tablets too.

Some reading suggests to simply build the kernels, and
put them in /boot/.... with acceptable namees like:
"kernel-3.10.25-gentoo" and they will automactically
appear in the boot menu? No limit to the number of
images?

Some pages suggest manually editing the grub.cfg file,
but I've also read that this is overwritten by the scipts
and info found in /etc/grub.d. I running Grub 2.00_p5107-r2.

I like to keep multiple version of kernels, complete sources
etc and keep several if not many of the bootable kernels
in /boot/.

Ideas and suggstions on how a grub(legacy) guy should approach
this need, with grub2 are most welcome. Just so you know, I
envision in the next 12 months to have many different arm(64)
systems using grub2 also (linaro has grub2 working on arm and
arm64); so a clean, well thought out strategy of similar
approaches to grub2 on many differnt arch's is what I'm really
after....

Also while we discussing grub 2, it boots blind (no feedback)
and takes too long to boot (estimated 5 minutes) : really slow
so what do I change there? No systemd on my systems.....


TIA,
James

Andrés Becerra Sandoval

unread,
Jan 24, 2014, 3:40:02 PM1/24/14
to
​Hi James,

If you put the kernels in /boot with proper names and launch:

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

Grub will set up the kernels for you.

If you want (not likely)  to create a manual entry, put it in /etc/grub.d/40_custom


--
  Andrés Becerra Sandoval

Lee

unread,
Jan 24, 2014, 3:50:02 PM1/24/14
to

I am using grub2 also, but on another distro, with multiple kernels/partitions. I don't have a lot of firsthand knowledge, because not having a lot of patience, I usu just drop to the grub cli.

However, IIRC there is a grub2 command called update-grub that scans all your boot sectors on all your devices. At least that's the way its _sposed_ to work - ymmv.
:-/

Chris Stout

unread,
Jan 24, 2014, 4:20:02 PM1/24/14
to
 

 

----- Original Message -----

From: James

Sent: 01/24/14 01:14 PM

To: gento...@lists.gentoo.org

Subject: [gentoo-user] Re: grub2 multiple kernels

 
Lee <ny6p01 <at> gmail.com> writes: 

> I am using grub2 also, but on another distro, with multiple 
> kernels/partitions. I don't have a lot of firsthand knowledge, because not 
> having a lot of patience, I usu just drop to the grub cli. 
> However, IIRC there is a grub2 command called update-grub that scans all 
> your boot sectors on all your devices. At least that's the way its 
_sposed_ > to work - ymmv. 

Yes, I read about update-grub, but it must be part of an additional packages, 
as I cannot find it (using whereis as root) ? 

On gentoo, which packages contains the update-grub command? 
Or is "grub2-mkconfig " the same command ? 

James

I could be remembering wrong, but I'm pretty sure update-grub was the command for legacy grub.

 

Like Andres* said, the command for grub2 is grub2-mkconfig -o /boot/grub/grub.cfg .

 

* Sorry for ASCII-ing your name; I've yet to set up unicode support.

Chris Stout

unread,
Jan 24, 2014, 4:20:02 PM1/24/14
to

 

----- Original Message -----

From: Lee

Sent: 01/24/14 12:46 PM

To: gento...@lists.gentoo.org

Subject: Re: [gentoo-user] grub2 multiple kernels

 

However, IIRC there is a grub2 command called update-grub that scans all your boot sectors on all your devices. At least that's the way its _sposed_ to work - ymmv.

:-/

 

 

I think update-grub was the command for legacy grub. On my system the appropriate command is grub2-mkconfig.

 

As a side note to James, if you don't see your secondary kernels on the grub2 screen on boot, look under the advanced options. My grub2 setup seems to put extra kernels under the advanced tab.

 

I don't recall making any changes to Grub2 so it might be the default behaviour.

 

James

unread,
Jan 24, 2014, 4:20:02 PM1/24/14
to
Lee <ny6p01 <at> gmail.com> writes:

> I am using grub2 also, but on another distro, with multiple
> kernels/partitions. I don't have a lot of firsthand knowledge, because not
> having a lot of patience, I usu just drop to the grub cli.
> However, IIRC there is a grub2 command called update-grub that scans all
> your boot sectors on all your devices. At least that's the way its
_sposed_ > to work - ymmv.

Dale

unread,
Jan 24, 2014, 4:20:03 PM1/24/14
to
Andrés Becerra Sandoval wrote:

​Hi James,

If you put the kernels in /boot with proper names and launch:

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

Grub will set up the kernels for you.

If you want (not likely)  to create a manual entry, put it in /etc/grub.d/40_custom


--
  Andrés Becerra Sandoval



That has been my experience so far as well.  Little info for OP.

root@fireball / # ls -al /boot/kernel*
-rw-r--r-- 1 root root 5148896 Dec  6 21:05 /boot/kernel-3.11.6-1
-rw-r--r-- 1 root root 5023696 Oct 18 08:31 /boot/kernel-3.9.5-NEWMOBO
-rw-r--r-- 1 root root 5020432 Oct 20 22:30 /boot/kernel-3.9.5-NEWMOBO-1
root@fireball / # 

root@fireball / # grub2-mkconfig -o /boot/grub2/grub.cfg
Generating grub configuration file ...
Found linux image: /boot/kernel-3.11.6-1
Found linux image: /boot/kernel-3.9.5-NEWMOBO-1
Found linux image: /boot/kernel-3.9.5-NEWMOBO
done
root@fireball / #


What I have not figured out yet, how to know that it sees and applies that init thingy that dracut made.  It doesn't mention finding it so I don't know if it does or not.  Hmmmm.

Dale

:-)  :-) 

-- 
I am only responsible for what I said ... Not for what you understood or how you interpreted my words!

Lee

unread,
Jan 24, 2014, 5:30:01 PM1/24/14
to

I misremembered.  the correct command is indeed the mkconfig one. I'd recommend backing up your old config first or outputting to stdout so you can check everything first. 

James

unread,
Jan 24, 2014, 5:40:01 PM1/24/14
to
Chris Stout <chris.stout <at> gmx.com> writes:


> I think update-grub was the command for legacy grub.
> On my system the appropriate command is grub2-mkconfig.

yep, that did the trick.....

>  
> As a side note to James, if you don't see your secondary kernels on the
> grub2 screen on boot, look under the advanced options. My grub2 setup
> seems to put extra kernels under the advanced tab.

Yep, right again. (grub2-mkconfig -o /boot/grub/grub.cfg)

> I don't recall making any changes to Grub2 so it might be the
> default behaviour.

Yep. OK, so how to I make the latest kernel, copied to /boot/
the default on that shows up. Tabing to the advanced does work
but I'm guessing I'll need to flush this out, because one
these days, the default kernel will be deleted. So any advise
on how to update the default kernel, once one is happy with it?

Also, grub2 seems to take a long time to beging booting
any fixes for that?

Also, it (grub2) is not displaying any verbose info to the screen, except
at the very end.....? Settings to tweak for a quick, verbose grub2
boot experience?


James

Neil Bothwick

unread,
Jan 24, 2014, 6:10:02 PM1/24/14
to
On Fri, 24 Jan 2014 16:17:33 -0500, Chris Stout wrote:

> I could be remembering wrong, but I'm pretty sure update-grub was the
> command for legacy grub. Like Andres* said, the command for grub2 is
> grub2-mkconfig -o /boot/grub/grub.cfg .

update-grub is an Ubuntuism, it's just a wrapper script for grub-mkconfig.


--
Neil Bothwick

"You want us to do WHAT?" - Ancient Chinese wall engineer.
signature.asc

William Kenworthy

unread,
Jan 24, 2014, 6:40:02 PM1/24/14
to
On 25/01/14 07:06, Neil Bothwick wrote:
> On Fri, 24 Jan 2014 16:17:33 -0500, Chris Stout wrote:
>
>> I could be remembering wrong, but I'm pretty sure update-grub was the
>> command for legacy grub. Like Andres* said, the command for grub2 is
>> grub2-mkconfig -o /boot/grub/grub.cfg .
>
> update-grub is an Ubuntuism, it's just a wrapper script for grub-mkconfig.
>
>

Also, dont forget /etc/default/grub (nicely hidden!) for fine tuning
such as custom commandline args like memmap to lock out bad memory.

BillK

James

unread,
Jan 24, 2014, 8:30:02 PM1/24/14
to
William Kenworthy <billk <at> iinet.net.au> writes:


> Also, dont forget /etc/default/grub (nicely hidden!) for fine tuning
> such as custom commandline args like memmap to lock out bad memory.


Is this where --verbose --quickbooting
--parallel booting? options are set?


I had a problem with the doc useflag, so I've been reading
across the net. So now all of those "docs" are installing.....


thx,


James

Chris Stout

unread,
Jan 24, 2014, 8:50:02 PM1/24/14
to
 

 

----- Original Message -----

From: James

Sent: 01/24/14 05:27 PM

To: gento...@lists.gentoo.org

Subject: [gentoo-user] Re: grub2 multiple kernels

 
 
I had a problem with the doc useflag, so I've been reading 
across the net. So now all of those "docs" are installing..... 

 I re-emerged with the doc flag. You can find the docs at

 

file:///usr/share/doc/grub-2.00_p5107-r2/html/grub.html/index.html

 

Though it appears the same manual is available here

 

https://www.gnu.org/software/grub/manual/grub.html

Neil Bothwick

unread,
Jan 25, 2014, 3:40:02 AM1/25/14
to
On Sat, 25 Jan 2014 01:27:52 +0000 (UTC), James wrote:

> > Also, dont forget /etc/default/grub (nicely hidden!) for fine tuning
> > such as custom commandline args like memmap to lock out bad memory.
>
>
> Is this where --verbose --quickbooting
> --parallel booting? options are set?

It contains default options used for automatically created menus, read
the commants in the file and "info grub2".

The location is logical in an unintuitive way, something
like /etc/grub.d/defaults.cfg would be friendlier, but grub-mkconfig
considers the contents of that directory to be scripts to execute.

--
Neil Bothwick

Cereal Killer Strikes Again! Cap'n Crunch found dead...
signature.asc

Graham Murray

unread,
Jan 25, 2014, 11:20:01 AM1/25/14
to
Andrés Becerra Sandoval <andres....@gmail.com> writes:

> If you put the kernels in /boot with proper names and launch:
>
> ​ grub2-mkconfig -o /boot/grub/grub.cfg
>
> Grub will set up the kernels for you.

How do you then choose which one to boot by default? I normally run
hardened-sources but also want to occasional boot (eg test) the latest
gentoo-sources kernel which is often a higher version than the latest
hardened one. So I might have (in /boot)
vmlinuz-3.12.6-hardened-r4
vmlinuz-3.12.8-hardened
vmlinuz-3.12.8-hardened-r1
vmlinuz-3.13.0-gentoo-r1

grub2-mkconfig will set the highest version as the default (ie without
manual menu selection) to boot. I would like to configure it so that the
default is the latest -hardened.

Mike Gilbert

unread,
Jan 25, 2014, 12:40:01 PM1/25/14
to
Overriding the default is a bit tricky. grub-mkconfig generates
submenus by default, so you end up having to do something like this in
/etc/default/grub:

GRUB_DEFAULT=""gnulinux-advanced-508868e4-54c6-4e6b-84b0-b3b28b1656b6>gnulinux-3.10.9-advanced-508868e4-54c6-4e6b-84b0-b3b28b1656b6"

Thats "gnulinux-advanced-508868e4-54c6-4e6b-84b0-b3b28b1656b6",
followed by a ">", and then
"gnulinux-3.10.9-advanced-508868e4-54c6-4e6b-84b0-b3b28b1656b6". The
former is the submenu id, and the latter is the menuentry within the
submenu.

I believe there will be a way to shut off the submenu stuff in
grub-2.02, which is in beta now.
0 new messages