public inbox for gentoo-dev@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-dev] grub-2 configuration
@ 2016-10-05  3:34 William Hubbs
  2016-10-05  4:46 ` Kent Fredric
  2016-10-08 14:28 ` Tom H
  0 siblings, 2 replies; 26+ messages in thread
From: William Hubbs @ 2016-10-05  3:34 UTC (permalink / raw
  To: gentoo-dev

[-- Attachment #1: Type: text/plain, Size: 1380 bytes --]

I broke the thread, because grub-2 configuration is an interesting
topic, but I think it deserves a separate thread from the removal of
grub-0 discussion.

On Wed, Oct 05, 2016 at 03:57:25PM +1300, Kent Fredric wrote:
> On Tue, 4 Oct 2016 22:22:12 -0400
> Rich Freeman <rich0@gentoo.org> wrote:
> 
> > How do you generate your grub-0 config files?
> 
> I didn't, it came as a stock example file with comments which I edited
> in a minimal fashion until it worked.
> 
> > 
> > You can just use the same method to generate the grub-2 ones...
> 
> No, I regenerated it with mkconfig, replacing the file.
> 
> The new file has a whole lot of stuff I don't understand, and direct
> editing of it terrifies me to an extent because there's no clear
> explanation of what half of it does.
> Hence, my exposition.
> 
> I am thus mostly just relying on mkconfig now and crossing my fingers.

That's what I've been doing, and it works pretty well.

I can tell you a bit of how it works. It uses the settings in
/etc/default/grub along with the templates in /etc/grub.d to generate
grub.cfg. You can tweak a lot of what gets generated by tweaking the
settings in /etc/default/grub.

You don't have to use grub-mkconfig. You can write /boot/grub/grub.cfg
by hand if you want, and it appears that the syntax is documented in the
grub info pages.

William


[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 181 bytes --]

^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: [gentoo-dev] grub-2 configuration
  2016-10-05  3:34 [gentoo-dev] grub-2 configuration William Hubbs
@ 2016-10-05  4:46 ` Kent Fredric
  2016-10-05  5:09   ` Kent Fredric
  2016-10-08 14:28 ` Tom H
  1 sibling, 1 reply; 26+ messages in thread
From: Kent Fredric @ 2016-10-05  4:46 UTC (permalink / raw
  To: gentoo-dev

[-- Attachment #1: Type: text/plain, Size: 1346 bytes --]

On Tue, 4 Oct 2016 22:34:11 -0500
William Hubbs <williamh@gentoo.org> wrote:

> You don't have to use grub-mkconfig. You can write /boot/grub/grub.cfg
> by hand if you want, and it appears that the syntax is documented in the
> grub info pages.
> 
> William

Just saying, it would be really nice to have some documented example cases
ship with grub-2, like it did with grub:0 

grub:0 via http://www.portagefilelist.de

/usr/share/doc/grub-0.97-r17/grub.conf.gentoo.bz2 	obj 	amd64, x86 	custom-cflags, ncurses, netboot
/usr/share/doc/grub-0.97-r17/grub.conf.gentoo.xz 	obj 	amd64 	ncurses
/usr/share/doc/grub-0.97-r17/grub.conf.sample.bz2 	obj 	amd64, x86 	custom-cflags, ncurses, netboot
/usr/share/doc/grub-0.97-r17/grub.conf.sample.xz 	obj 	amd64 	ncurses

grub-2 via qlist grub | grep -i conf 

/usr/share/man/man8/grub-mkconfig.8.bz2
/usr/share/grub/grub-mkconfig_lib
/usr/sbin/grub-mkconfig
/usr/lib/grub/i386-pc/configfile.module
/usr/lib/grub/i386-pc/configfile.mod
/usr/lib/grub/i386-pc/config.h
/usr/lib/grub/i386-multiboot/configfile.module
/usr/lib/grub/i386-multiboot/configfile.mod
/usr/lib/grub/i386-multiboot/config.h
/usr/lib/grub/i386-qemu/configfile.module
/usr/lib/grub/i386-qemu/configfile.mod
/usr/lib/grub/i386-qemu/config.h

Its pretty clear which of these we're getting pushed to use.

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 801 bytes --]

^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: [gentoo-dev] grub-2 configuration
  2016-10-05  4:46 ` Kent Fredric
@ 2016-10-05  5:09   ` Kent Fredric
  2016-10-05 14:26     ` Mike Gilbert
  0 siblings, 1 reply; 26+ messages in thread
From: Kent Fredric @ 2016-10-05  5:09 UTC (permalink / raw
  To: gentoo-dev

[-- Attachment #1: Type: text/plain, Size: 1247 bytes --]

On Wed, 5 Oct 2016 17:46:29 +1300
Kent Fredric <kentnl@gentoo.org> wrote:

> On Tue, 4 Oct 2016 22:34:11 -0500
> William Hubbs <williamh@gentoo.org> wrote:
> 
> > You don't have to use grub-mkconfig. You can write /boot/grub/grub.cfg
> > by hand if you want, and it appears that the syntax is documented in the
> > grub info pages.
> > 
> > William  
> 
> Just saying, it would be really nice to have some documented example cases
> ship with grub-2, like it did with grub:0 
> 
> grub-2 via qlist grub | grep -i conf 
> 
> Its pretty clear which of these we're getting pushed to use.


There does however exist a /usr/portage/sys-boot/grub/files/grub.conf.gentoo on my system,
It just has to be 

a) Updated to stay relevant
b) Placed in a place I expect to find it
c) Be referenced in the grub-2 post-install messages or at very least, more prevalent in 
https://wiki.gentoo.org/wiki/GRUB2_Quick_Start 

Because encouraging everyone to use it the way that has clearly seen
resistance in gentoo doesn't seem to be helping.

Though I do see the documentation is better than it was when I
switched, the message that you can use a simpler configuration scheme
is not prevalent enough for people to be noticing it. 

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 801 bytes --]

^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: [gentoo-dev] grub-2 configuration
  2016-10-05  5:09   ` Kent Fredric
@ 2016-10-05 14:26     ` Mike Gilbert
  2016-10-05 16:52       ` [gentoo-dev] " Martin Vaeth
  2016-10-08 14:33       ` [gentoo-dev] " Tom H
  0 siblings, 2 replies; 26+ messages in thread
From: Mike Gilbert @ 2016-10-05 14:26 UTC (permalink / raw
  To: Gentoo Dev

On Wed, Oct 5, 2016 at 1:09 AM, Kent Fredric <kentnl@gentoo.org> wrote:
> On Wed, 5 Oct 2016 17:46:29 +1300
> Kent Fredric <kentnl@gentoo.org> wrote:
>
>> On Tue, 4 Oct 2016 22:34:11 -0500
>> William Hubbs <williamh@gentoo.org> wrote:
>>
>> > You don't have to use grub-mkconfig. You can write /boot/grub/grub.cfg
>> > by hand if you want, and it appears that the syntax is documented in the
>> > grub info pages.
>> >
>> > William
>>
>> Just saying, it would be really nice to have some documented example cases
>> ship with grub-2, like it did with grub:0
>>
>> grub-2 via qlist grub | grep -i conf
>>
>> Its pretty clear which of these we're getting pushed to use.
>
>
> There does however exist a /usr/portage/sys-boot/grub/files/grub.conf.gentoo on my system,
> It just has to be
>
> a) Updated to stay relevant
> b) Placed in a place I expect to find it
> c) Be referenced in the grub-2 post-install messages or at very least, more prevalent in
> https://wiki.gentoo.org/wiki/GRUB2_Quick_Start
>
> Because encouraging everyone to use it the way that has clearly seen
> resistance in gentoo doesn't seem to be helping.
>
> Though I do see the documentation is better than it was when I
> switched, the message that you can use a simpler configuration scheme
> is not prevalent enough for people to be noticing it.

I have added an example grub.cfg to the gentoo repository.

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=ec629c23a6e8cf6c18fa51d69ae11932c7ada3cc

Please feel free to commit any obvious improvements or corrections. If
you have a common scenario you would like to see added, feel free to
ping me about it.


^ permalink raw reply	[flat|nested] 26+ messages in thread

* [gentoo-dev] Re: grub-2 configuration
  2016-10-05 14:26     ` Mike Gilbert
@ 2016-10-05 16:52       ` Martin Vaeth
  2016-10-05 19:21         ` William Hubbs
  2016-10-08 14:33       ` [gentoo-dev] " Tom H
  1 sibling, 1 reply; 26+ messages in thread
From: Martin Vaeth @ 2016-10-05 16:52 UTC (permalink / raw
  To: gentoo-dev

Mike Gilbert <floppym@gentoo.org> wrote:
>
> I have added an example grub.cfg to the gentoo repository.

I finally made a repository of my grub.cfg "library"
with a correpsonding example.
This is a more sophisticated setup with a menu where
one can choose resolution, init-program, etc.

It can be found here:
https://github.com/vaeth/grub-cfg-mv/

Library and exmample can also be installed by portage:
Package sys-boot/grub-cfg-mv in the mv overlay (over layman)



^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: [gentoo-dev] Re: grub-2 configuration
  2016-10-05 16:52       ` [gentoo-dev] " Martin Vaeth
@ 2016-10-05 19:21         ` William Hubbs
  0 siblings, 0 replies; 26+ messages in thread
From: William Hubbs @ 2016-10-05 19:21 UTC (permalink / raw
  To: gentoo-dev

[-- Attachment #1: Type: text/plain, Size: 791 bytes --]

On Wed, Oct 05, 2016 at 04:52:31PM +0000, Martin Vaeth wrote:
> Mike Gilbert <floppym@gentoo.org> wrote:
> >
> > I have added an example grub.cfg to the gentoo repository.
> 
> I finally made a repository of my grub.cfg "library"
> with a correpsonding example.
> This is a more sophisticated setup with a menu where
> one can choose resolution, init-program, etc.
> 
> It can be found here:
> https://github.com/vaeth/grub-cfg-mv/
> 
> Library and exmample can also be installed by portage:
> Package sys-boot/grub-cfg-mv in the mv overlay (over layman)

Here is another good example from the previous thread.

https://archives.gentoo.org/gentoo-dev/message/6ecb120a299300c0224be6b69000191c

This example uses UUIDS/PARTUUIDS instead of BIOS disk numbers.

William


[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 163 bytes --]

^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: [gentoo-dev] grub-2 configuration
  2016-10-05  3:34 [gentoo-dev] grub-2 configuration William Hubbs
  2016-10-05  4:46 ` Kent Fredric
@ 2016-10-08 14:28 ` Tom H
  2016-10-08 23:03   ` [gentoo-dev] " Duncan
  2016-10-08 23:57   ` [gentoo-dev] " Ben Kohler
  1 sibling, 2 replies; 26+ messages in thread
From: Tom H @ 2016-10-08 14:28 UTC (permalink / raw
  To: Gentoo Devel

On Tue, Oct 4, 2016 at 11:34 PM, William Hubbs <williamh@gentoo.org> wrote:
>
> You don't have to use grub-mkconfig. You can write /boot/grub/grub.cfg
> by hand if you want, and it appears that the syntax is documented in
> the grub info pages.

If you write "/boot/grub/grub.cfg" by hand and run grub-mkconfig by
mistake, you'll wipe out your config. It's safer to write it to
"/etc/grub.d/40_custom" and "chmod -x" the other files in
"/etc/grub.d/".


^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: [gentoo-dev] grub-2 configuration
  2016-10-05 14:26     ` Mike Gilbert
  2016-10-05 16:52       ` [gentoo-dev] " Martin Vaeth
@ 2016-10-08 14:33       ` Tom H
  2016-10-08 15:00         ` Mike Gilbert
  1 sibling, 1 reply; 26+ messages in thread
From: Tom H @ 2016-10-08 14:33 UTC (permalink / raw
  To: Gentoo Devel

On Wed, Oct 5, 2016 at 10:26 AM, Mike Gilbert <floppym@gentoo.org> wrote:
>
> I have added an example grub.cfg to the gentoo repository.
>
> https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=ec629c23a6e8cf6c18fa51d69ae11932c7ada3cc
>
> Please feel free to commit any obvious improvements or corrections. If
> you have a common scenario you would like to see added, feel free to
> ping me about it.

Shouldn't "timeout=5", "default=0", "gfxmode=auto", and
"gfxpayload=keep" be prefixed with "set "?


^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: [gentoo-dev] grub-2 configuration
  2016-10-08 14:33       ` [gentoo-dev] " Tom H
@ 2016-10-08 15:00         ` Mike Gilbert
  2016-10-11 14:34           ` Tom H
  0 siblings, 1 reply; 26+ messages in thread
From: Mike Gilbert @ 2016-10-08 15:00 UTC (permalink / raw
  To: Gentoo Dev

[-- Attachment #1: Type: text/plain, Size: 650 bytes --]

On Oct 8, 2016 10:33 AM, "Tom H" <tomh0665@gmail.com> wrote:
>
> On Wed, Oct 5, 2016 at 10:26 AM, Mike Gilbert <floppym@gentoo.org> wrote:
> >
> > I have added an example grub.cfg to the gentoo repository.
> >
> >
https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=ec629c23a6e8cf6c18fa51d69ae11932c7ada3cc
> >
> > Please feel free to commit any obvious improvements or corrections. If
> > you have a common scenario you would like to see added, feel free to
> > ping me about it.
>
> Shouldn't "timeout=5", "default=0", "gfxmode=auto", and
> "gfxpayload=keep" be prefixed with "set "?
>

Using the set keyword for variable assignments is optional.

[-- Attachment #2: Type: text/html, Size: 1069 bytes --]

^ permalink raw reply	[flat|nested] 26+ messages in thread

* [gentoo-dev] Re: grub-2 configuration
  2016-10-08 14:28 ` Tom H
@ 2016-10-08 23:03   ` Duncan
  2016-10-08 23:57   ` [gentoo-dev] " Ben Kohler
  1 sibling, 0 replies; 26+ messages in thread
From: Duncan @ 2016-10-08 23:03 UTC (permalink / raw
  To: gentoo-dev

Tom H posted on Sat, 08 Oct 2016 10:28:05 -0400 as excerpted:

> On Tue, Oct 4, 2016 at 11:34 PM, William Hubbs <williamh@gentoo.org>
> wrote:
>>
>> You don't have to use grub-mkconfig. You can write /boot/grub/grub.cfg
>> by hand if you want, and it appears that the syntax is documented in
>> the grub info pages.
> 
> If you write "/boot/grub/grub.cfg" by hand and run grub-mkconfig by
> mistake, you'll wipe out your config. It's safer to write it to
> "/etc/grub.d/40_custom" and "chmod -x" the other files in
> "/etc/grub.d/".

Or simply install-mask grub-mkconfig, like I did, via package.env to 
avoid polluting INSTALL_MASK for everything. =:^)

In /etc/portage/package.env:

sys-boot/grub	pkg.env/installmask/grub

In /etc/portage/env/pkg.env/grub:

# don't use grub(2)-mkconfig at all

INSTALL_MASK="$INSTALL_MASK /etc/default /etc/grub.d grub2-mkconfig grub-
mkconfig"

PKG_INSTALL_MASK="$INSTALL_MASK"


Now that I'm thinking about it, it /would/ be kinda nice to have a USE 
flag that did that, tho.  Yeah, it's just a few arguably small files, but 
when the absence of those files means the absence of a potential fat-
fingering...

(Tho not mounting /boot by default helps reduce the fat-fingering 
chances, and having a backup /boot partition and grub installation on a 
second drive helps avoid both that being a huge problem, and grub-upgrade 
mishaps too...)

-- 
Duncan - List replies preferred.   No HTML msgs.
"Every nonfree program has a lord, a master --
and if you use the program, he is your master."  Richard Stallman



^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: [gentoo-dev] grub-2 configuration
  2016-10-08 14:28 ` Tom H
  2016-10-08 23:03   ` [gentoo-dev] " Duncan
@ 2016-10-08 23:57   ` Ben Kohler
  2016-10-09  2:45     ` M. J. Everitt
  1 sibling, 1 reply; 26+ messages in thread
From: Ben Kohler @ 2016-10-08 23:57 UTC (permalink / raw
  To: gentoo-dev

[-- Attachment #1: Type: text/plain, Size: 860 bytes --]

On Sat, Oct 8, 2016 at 9:28 AM, Tom H <tomh0665@gmail.com> wrote:

> On Tue, Oct 4, 2016 at 11:34 PM, William Hubbs <williamh@gentoo.org>
> wrote:
> >
> > You don't have to use grub-mkconfig. You can write /boot/grub/grub.cfg
> > by hand if you want, and it appears that the syntax is documented in
> > the grub info pages.
>
> If you write "/boot/grub/grub.cfg" by hand and run grub-mkconfig by
> mistake, you'll wipe out your config. It's safer to write it to
> "/etc/grub.d/40_custom" and "chmod -x" the other files in
> "/etc/grub.d/".
>
> Well "grub2-mkconfig" by itself doesn't write anywhere unless you pass a
-o parameter.  If you are "accidentally" running "grub2-mkconfig -o
/boot/grub/grub.cfg" and it catches you by surprise that
/boot/grub/grub.cfg is overwritten, you have bigger problems.

Let's not make up problems where there are none.

-Ben

[-- Attachment #2: Type: text/html, Size: 1485 bytes --]

^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: [gentoo-dev] grub-2 configuration
  2016-10-08 23:57   ` [gentoo-dev] " Ben Kohler
@ 2016-10-09  2:45     ` M. J. Everitt
  2016-10-09 16:05       ` William Hubbs
  0 siblings, 1 reply; 26+ messages in thread
From: M. J. Everitt @ 2016-10-09  2:45 UTC (permalink / raw
  To: gentoo-dev


[-- Attachment #1.1: Type: text/plain, Size: 1052 bytes --]

On 09/10/16 00:57, Ben Kohler wrote:
>
>
> On Sat, Oct 8, 2016 at 9:28 AM, Tom H <tomh0665@gmail.com
> <mailto:tomh0665@gmail.com>> wrote:
>
>     On Tue, Oct 4, 2016 at 11:34 PM, William Hubbs
>     <williamh@gentoo.org <mailto:williamh@gentoo.org>> wrote:
>     >
>     > You don't have to use grub-mkconfig. You can write
>     /boot/grub/grub.cfg
>     > by hand if you want, and it appears that the syntax is documented in
>     > the grub info pages.
>
>     If you write "/boot/grub/grub.cfg" by hand and run grub-mkconfig by
>     mistake, you'll wipe out your config. It's safer to write it to
>     "/etc/grub.d/40_custom" and "chmod -x" the other files in
>     "/etc/grub.d/".
>
> Well "grub2-mkconfig" by itself doesn't write anywhere unless you pass
> a -o parameter.  If you are "accidentally" running "grub2-mkconfig -o
> /boot/grub/grub.cfg" and it catches you by surprise that
> /boot/grub/grub.cfg is overwritten, you have bigger problems.
>
> Let's not make up problems where there are none.
>
> -Ben
+1

[-- Attachment #1.2: Type: text/html, Size: 2342 bytes --]

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 901 bytes --]

^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: [gentoo-dev] grub-2 configuration
  2016-10-09  2:45     ` M. J. Everitt
@ 2016-10-09 16:05       ` William Hubbs
  2016-10-10  2:03         ` [gentoo-dev] " Duncan
  2016-10-11 14:42         ` [gentoo-dev] " Tom H
  0 siblings, 2 replies; 26+ messages in thread
From: William Hubbs @ 2016-10-09 16:05 UTC (permalink / raw
  To: gentoo-dev

[-- Attachment #1: Type: text/plain, Size: 1160 bytes --]

On Sun, Oct 09, 2016 at 03:45:11AM +0100, M. J. Everitt wrote:
> On 09/10/16 00:57, Ben Kohler wrote:
> >
> >
> > On Sat, Oct 8, 2016 at 9:28 AM, Tom H <tomh0665@gmail.com
> > <mailto:tomh0665@gmail.com>> wrote:
> >
> >     On Tue, Oct 4, 2016 at 11:34 PM, William Hubbs
> >     <williamh@gentoo.org <mailto:williamh@gentoo.org>> wrote:
> >     >
> >     > You don't have to use grub-mkconfig. You can write
> >     /boot/grub/grub.cfg
> >     > by hand if you want, and it appears that the syntax is documented in
> >     > the grub info pages.
> >
> >     If you write "/boot/grub/grub.cfg" by hand and run grub-mkconfig by
> >     mistake, you'll wipe out your config. It's safer to write it to
> >     "/etc/grub.d/40_custom" and "chmod -x" the other files in
> >     "/etc/grub.d/".
> >
> > Well "grub2-mkconfig" by itself doesn't write anywhere unless you pass
> > a -o parameter.  If you are "accidentally" running "grub2-mkconfig -o
> > /boot/grub/grub.cfg" and it catches you by surprise that
> > /boot/grub/grub.cfg is overwritten, you have bigger problems.
> >
> > Let's not make up problems where there are none.
> >
> > -Ben
> +1

+1000

William


[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 181 bytes --]

^ permalink raw reply	[flat|nested] 26+ messages in thread

* [gentoo-dev] Re: grub-2 configuration
  2016-10-09 16:05       ` William Hubbs
@ 2016-10-10  2:03         ` Duncan
  2016-10-11 14:42         ` [gentoo-dev] " Tom H
  1 sibling, 0 replies; 26+ messages in thread
From: Duncan @ 2016-10-10  2:03 UTC (permalink / raw
  To: gentoo-dev

William Hubbs posted on Sun, 09 Oct 2016 11:05:43 -0500 as excerpted:

> On Sun, Oct 09, 2016 at 03:45:11AM +0100, M. J. Everitt wrote:
>> On 09/10/16 00:57, Ben Kohler wrote:
>> >
>> >
>> > On Sat, Oct 8, 2016 at 9:28 AM, Tom H <tomh0665@gmail.com
>> > <mailto:tomh0665@gmail.com>> wrote:
>> >
>> > On Tue, Oct 4, 2016 at 11:34 PM, William Hubbs
>> > <williamh@gentoo.org <mailto:williamh@gentoo.org>> wrote:
>> > >
>> > > You don't have to use grub-mkconfig. You can write
>> > > /boot/grub/grub.cfg by hand if you want
>> >
>> > If you write "/boot/grub/grub.cfg" by hand and run grub-mkconfig
>> > by mistake, you'll wipe out your config. It's safer to write it
>> > to "/etc/grub.d/40_custom" and "chmod -x" the other files in
>> > "/etc/grub.d/".
>> >
>> > Well "grub2-mkconfig" by itself doesn't write anywhere unless you
>> > pass a -o parameter.  If you are "accidentally" running
>> > "grub2-mkconfig -o /boot/grub/grub.cfg" and it catches you by
>> > surprise that /boot/grub/grub.cfg is overwritten, you have bigger
>> > problems.
>> >
>> > Let's not make up problems where there are none.
>> >
>> +1
> 
> +1000

What I was worried most about was some so-called "helper" app deciding it 
could run grub-mkconfig for me.

Anyway, the functionality isn't going to be used, so best security 
practices say the executable shouldn't even be on the system.

If it's not there, it can't be run, a great solution to both the above. 
=:^)

Tho the point that it needs a -o parameter to write somewhere is a good 
one as well, certainly ameliorating the problem to some extent. =:^)

-- 
Duncan - List replies preferred.   No HTML msgs.
"Every nonfree program has a lord, a master --
and if you use the program, he is your master."  Richard Stallman



^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: [gentoo-dev] grub-2 configuration
  2016-10-08 15:00         ` Mike Gilbert
@ 2016-10-11 14:34           ` Tom H
  0 siblings, 0 replies; 26+ messages in thread
From: Tom H @ 2016-10-11 14:34 UTC (permalink / raw
  To: Gentoo Devel

On Sat, Oct 8, 2016 at 11:00 AM, Mike Gilbert <floppym@gentoo.org> wrote:
> On Oct 8, 2016 10:33 AM, "Tom H" <tomh0665@gmail.com> wrote:
>>
>> Shouldn't "timeout=5", "default=0", "gfxmode=auto", and
>> "gfxpayload=keep" be prefixed with "set "?
>
> Using the set keyword for variable assignments is optional.

Many thanks.


^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: [gentoo-dev] grub-2 configuration
  2016-10-09 16:05       ` William Hubbs
  2016-10-10  2:03         ` [gentoo-dev] " Duncan
@ 2016-10-11 14:42         ` Tom H
  2016-10-11 14:54           ` M. J. Everitt
  2016-10-12 14:40           ` William Hubbs
  1 sibling, 2 replies; 26+ messages in thread
From: Tom H @ 2016-10-11 14:42 UTC (permalink / raw
  To: Gentoo Devel

On Sun, Oct 9, 2016 at 12:05 PM, William Hubbs <williamh@gentoo.org> wrote:
> On Sun, Oct 09, 2016 at 03:45:11AM +0100, M. J. Everitt wrote:
>> On 09/10/16 00:57, Ben Kohler wrote:
>>> On Sat, Oct 8, 2016 at 9:28 AM, Tom H <tomh0665@gmail.com
>>> <mailto:tomh0665@gmail.com>> wrote:
>>> On Tue, Oct 4, 2016 at 11:34 PM, William Hubbs
>>> <williamh@gentoo.org <mailto:williamh@gentoo.org>> wrote:
>>>>
>>>> You don't have to use grub-mkconfig. You can write
>>> /boot/grub/grub.cfg
>>>> by hand if you want, and it appears that the syntax is documented in
>>>> the grub info pages.
>>>
>>> If you write "/boot/grub/grub.cfg" by hand and run grub-mkconfig by
>>> mistake, you'll wipe out your config. It's safer to write it to
>>> "/etc/grub.d/40_custom" and "chmod -x" the other files in
>>> "/etc/grub.d/".
>>>
>>> Well "grub2-mkconfig" by itself doesn't write anywhere unless you pass
>>> a -o parameter. If you are "accidentally" running "grub2-mkconfig -o
>>> /boot/grub/grub.cfg" and it catches you by surprise that
>>> /boot/grub/grub.cfg is overwritten, you have bigger problems.
>>>
>>> Let's not make up problems where there are none.
>>
>> +1
>
> +1000

I was sharing what I do because I've overwritten a manually-edited
grub.cfg by running grub-mkconfig/grub2-mkconfig/update-grub (re
grub2-mkconfig, I use grub-mkconfig on Gentoo because I set
"-multislot") more than once - and I know other sysadmins who've made
the same mistake.

You can use exactly the same text in 40_grub that you'd use in
grub.cfg and have the latter generated. I don't see why anyone would
be opposed to that, unless you hate that tool - and hate's never a
good rationale for an MO.


^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: [gentoo-dev] grub-2 configuration
  2016-10-11 14:42         ` [gentoo-dev] " Tom H
@ 2016-10-11 14:54           ` M. J. Everitt
  2016-10-18 16:45             ` Tom H
  2016-10-12 14:40           ` William Hubbs
  1 sibling, 1 reply; 26+ messages in thread
From: M. J. Everitt @ 2016-10-11 14:54 UTC (permalink / raw
  To: gentoo-dev

[-- Attachment #1: Type: text/plain, Size: 628 bytes --]

On 11/10/16 15:42, Tom H wrote [excerpted]:
> I was sharing what I do because I've overwritten a manually-edited
> grub.cfg by running grub-mkconfig/grub2-mkconfig/update-grub (re
> grub2-mkconfig, I use grub-mkconfig on Gentoo because I set
> "-multislot") more than once - and I know other sysadmins who've made
> the same mistake.
>
> You can use exactly the same text in 40_grub that you'd use in
> grub.cfg and have the latter generated. I don't see why anyone would
> be opposed to that, unless you hate that tool - and hate's never a
> good rationale for an MO.
>
That's a useful tit-bit .. thanks!

MJE


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 901 bytes --]

^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: [gentoo-dev] grub-2 configuration
  2016-10-11 14:42         ` [gentoo-dev] " Tom H
  2016-10-11 14:54           ` M. J. Everitt
@ 2016-10-12 14:40           ` William Hubbs
  1 sibling, 0 replies; 26+ messages in thread
From: William Hubbs @ 2016-10-12 14:40 UTC (permalink / raw
  To: gentoo-dev

[-- Attachment #1: Type: text/plain, Size: 675 bytes --]

On Tue, Oct 11, 2016 at 10:42:43AM -0400, Tom H wrote:
> I was sharing what I do because I've overwritten a manually-edited
> grub.cfg by running grub-mkconfig/grub2-mkconfig/update-grub (re
> grub2-mkconfig, I use grub-mkconfig on Gentoo because I set
> "-multislot") more than once - and I know other sysadmins who've made
> the same mistake.

Multislot is a downstream feature that renames parts of grub-2.x to
grub2-* instead of grub-* so that grub-0.x and grub-2.x can be on the
system at the same time. My understanding is that it is there to make
switching back and forth between grub-0 and grub-2 easier . In my
opinion, the better choice is to turn it off.

William

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 163 bytes --]

^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: [gentoo-dev] grub-2 configuration
  2016-10-11 14:54           ` M. J. Everitt
@ 2016-10-18 16:45             ` Tom H
  2016-10-18 17:20               ` Joakim Tjernlund
  0 siblings, 1 reply; 26+ messages in thread
From: Tom H @ 2016-10-18 16:45 UTC (permalink / raw
  To: Gentoo Devel

On Tue, Oct 11, 2016 at 10:54 AM, M. J. Everitt <m.j.everitt@iee.org> wrote:
> On 11/10/16 15:42, Tom H wrote:
>>
>> You can use exactly the same text in 40_grub that you'd use in
>> grub.cfg and have the latter generated.
>
> That's a useful tit-bit .. thanks!

You're welcome.

I doubt that the grub developers intended 40_custom to be the only
"/etc/grub.d/" file to be executed but it's practical for generating a
simple grub.cfg. This is what I use in a Debian VM:

#!/bin/sh

cat <<EOF
# kernel
insmod gzio

# disk/partition
insmod part_msdos

# filesystem
insmod ext2

# /boot
search --no-floppy --fs-uuid --set=root e14bb0ac-4b43-41db-ac97-d67feaa7e291

# video
terminal_input console
terminal_output console

# menu
set default=0
set timeout=2

menuentry 'upstream 4.8.2' {
linux /boot/vmlinuz-4.8.2 root=UUID=e14bb0ac-4b43-41db-ac97-d67feaa7e291 ro
}

menuentry 'distro 4.6' {
linux /boot/vmlinuz-4.6.0-1-amd64
root=UUID=e14bb0ac-4b43-41db-ac97-d67feaa7e291 ro
initrd /boot/initrd.img-4.6.0-1-amd64
}
EOF


^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: [gentoo-dev] grub-2 configuration
  2016-10-18 16:45             ` Tom H
@ 2016-10-18 17:20               ` Joakim Tjernlund
  2016-10-19 19:21                 ` Tom H
  2016-10-19 21:35                 ` Robin H. Johnson
  0 siblings, 2 replies; 26+ messages in thread
From: Joakim Tjernlund @ 2016-10-18 17:20 UTC (permalink / raw
  To: gentoo-dev@lists.gentoo.org

On Tue, 2016-10-18 at 12:45 -0400, Tom H wrote:
> On Tue, Oct 11, 2016 at 10:54 AM, M. J. Everitt <m.j.everitt@iee.org> wrote:
> > 
> > On 11/10/16 15:42, Tom H wrote:
> > > 
> > > 
> > > You can use exactly the same text in 40_grub that you'd use in
> > > grub.cfg and have the latter generated.
> > 
> > That's a useful tit-bit .. thanks!
> 
> You're welcome.
> 
> I doubt that the grub developers intended 40_custom to be the only
> "/etc/grub.d/" file to be executed but it's practical for generating a
> simple grub.cfg. This is what I use in a Debian VM:
> 

We still use grub-1 and I really like the automatic generation of new grub
menu entries using genkernel --bootloader=grub, does this work with grub2 as well?

 Jocke

^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: [gentoo-dev] grub-2 configuration
  2016-10-18 17:20               ` Joakim Tjernlund
@ 2016-10-19 19:21                 ` Tom H
  2016-10-19 20:43                   ` Joakim Tjernlund
  2016-10-19 21:35                 ` Robin H. Johnson
  1 sibling, 1 reply; 26+ messages in thread
From: Tom H @ 2016-10-19 19:21 UTC (permalink / raw
  To: Gentoo Devel

On Tue, Oct 18, 2016 at 1:20 PM, Joakim Tjernlund
<Joakim.Tjernlund@infinera.com> wrote:
> On Tue, 2016-10-18 at 12:45 -0400, Tom H wrote:
>> On Tue, Oct 11, 2016 at 10:54 AM, M. J. Everitt <m.j.everitt@iee.org> wrote:
>>> On 11/10/16 15:42, Tom H wrote:
>>>>
>>>> You can use exactly the same text in 40_grub that you'd use in
>>>> grub.cfg and have the latter generated.
>>>
>>> That's a useful tit-bit .. thanks!
>>
>> You're welcome.
>>
>> I doubt that the grub developers intended 40_custom to be the only
>> "/etc/grub.d/" file to be executed but it's practical for generating a
>> simple grub.cfg. This is what I use in a Debian VM:
>
> We still use grub-1 and I really like the automatic generation of new
> grub menu entries using genkernel --bootloader=grub, does this work
> with grub2 as well?

It looks ike you can pass "--bootloader=grub2" but it's not documented
in the man page because gen_bootloader.sh has:

set_bootloader() {
case "${BOOTLOADER}" in
grub)
set_bootloader_grub
;;
grub2)
set_bootloader_grub2
;;
*)
print_warning "Bootloader ${BOOTLOADER} is not currently supported"
;;
esac
}

but it looks like, unlike for grub-legacy, you need a grub config file
("/boot/grub{,2}/grub.cfg") to exist.


^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: [gentoo-dev] grub-2 configuration
  2016-10-19 19:21                 ` Tom H
@ 2016-10-19 20:43                   ` Joakim Tjernlund
  2016-10-20 15:03                     ` Tom H
  0 siblings, 1 reply; 26+ messages in thread
From: Joakim Tjernlund @ 2016-10-19 20:43 UTC (permalink / raw
  To: gentoo-dev@lists.gentoo.org

On Wed, 2016-10-19 at 15:21 -0400, Tom H wrote:
> On Tue, Oct 18, 2016 at 1:20 PM, Joakim Tjernlund
> <Joakim.Tjernlund@infinera.com> wrote:
> > 
> > On Tue, 2016-10-18 at 12:45 -0400, Tom H wrote:
> > > 
> > > On Tue, Oct 11, 2016 at 10:54 AM, M. J. Everitt <m.j.everitt@iee.org> wrote:
> > > > 
> > > > On 11/10/16 15:42, Tom H wrote:
> > > > > 
> > > > > 
> > > > > You can use exactly the same text in 40_grub that you'd use in
> > > > > grub.cfg and have the latter generated.
> > > > 
> > > > That's a useful tit-bit .. thanks!
> > > 
> > > You're welcome.
> > > 
> > > I doubt that the grub developers intended 40_custom to be the only
> > > "/etc/grub.d/" file to be executed but it's practical for generating a
> > > simple grub.cfg. This is what I use in a Debian VM:
> > 
> > We still use grub-1 and I really like the automatic generation of new
> > grub menu entries using genkernel --bootloader=grub, does this work
> > with grub2 as well?
> 
> It looks ike you can pass "--bootloader=grub2" but it's not documented
> in the man page because gen_bootloader.sh has:

OK, good.

> 
> set_bootloader() {
> case "${BOOTLOADER}" in
> grub)
> set_bootloader_grub
> ;;
> grub2)
> set_bootloader_grub2
> ;;
> *)
> print_warning "Bootloader ${BOOTLOADER} is not currently supported"
> ;;
> esac
> }
> 
> but it looks like, unlike for grub-legacy, you need a grub config file
> ("/boot/grub{,2}/grub.cfg") to exist.

That is reasonable, to create a new entry one needs to copy the previous and replace the
kernel.

Would be nice if someone could confirm this though.

    Jocke

^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: [gentoo-dev] grub-2 configuration
  2016-10-18 17:20               ` Joakim Tjernlund
  2016-10-19 19:21                 ` Tom H
@ 2016-10-19 21:35                 ` Robin H. Johnson
  1 sibling, 0 replies; 26+ messages in thread
From: Robin H. Johnson @ 2016-10-19 21:35 UTC (permalink / raw
  To: gentoo-dev

On Tue, Oct 18, 2016 at 05:20:09PM +0000, Joakim Tjernlund wrote:
> We still use grub-1 and I really like the automatic generation of new grub
> menu entries using genkernel --bootloader=grub, does this work with
> grub2 as well?
Yes, grub2 is supported by Genkernel.

You just have to touch or otherwise create your grub.cfg at least once
first, in /boot/grub/grub.cfg or /boot/grub2/grub.cfg depending on your
setup.

It uses grub(2)-mkconfig to generate the configuration.

-- 
Robin Hugh Johnson
Gentoo Linux: Dev, Infra Lead, Foundation Trustee & Treasurer
E-Mail   : robbat2@gentoo.org
GnuPG FP : 11ACBA4F 4778E3F6 E4EDF38E B27B944E 34884E85
GnuPG FP : 7D0B3CEB E9B85B1F 825BCECF EE05E6F6 A48F6136


^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: [gentoo-dev] grub-2 configuration
  2016-10-19 20:43                   ` Joakim Tjernlund
@ 2016-10-20 15:03                     ` Tom H
  2016-10-28 10:56                       ` Joakim Tjernlund
  0 siblings, 1 reply; 26+ messages in thread
From: Tom H @ 2016-10-20 15:03 UTC (permalink / raw
  To: Gentoo Devel

On Wed, Oct 19, 2016 at 4:43 PM, Joakim Tjernlund
<Joakim.Tjernlund@infinera.com> wrote:
> On Wed, 2016-10-19 at 15:21 -0400, Tom H wrote:
>>
>> but it looks like, unlike for grub-legacy, you need a grub config file
>> ("/boot/grub{,2}/grub.cfg") to exist.
>
> That is reasonable, to create a new entry one needs to copy the previous and replace the
> kernel.
>
> Would be nice if someone could confirm this though.

if [[ -z "${GRUB_CONF}" ]]; then
print_error 1 "Error! Grub2 configuration file does not exist, please
ensure grub2 is correctly setup first."
return 0
fi


^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: [gentoo-dev] grub-2 configuration
  2016-10-20 15:03                     ` Tom H
@ 2016-10-28 10:56                       ` Joakim Tjernlund
  2016-10-28 22:01                         ` Patrick McLean
  0 siblings, 1 reply; 26+ messages in thread
From: Joakim Tjernlund @ 2016-10-28 10:56 UTC (permalink / raw
  To: gentoo-dev@lists.gentoo.org

On Thu, 2016-10-20 at 11:03 -0400, Tom H wrote:
> On Wed, Oct 19, 2016 at 4:43 PM, Joakim Tjernlund
> <Joakim.Tjernlund@infinera.com> wrote:
> > 
> > On Wed, 2016-10-19 at 15:21 -0400, Tom H wrote:
> > > 
> > > 
> > > but it looks like, unlike for grub-legacy, you need a grub config file
> > > ("/boot/grub{,2}/grub.cfg") to exist.
> > 
> > That is reasonable, to create a new entry one needs to copy the previous and replace the
> > kernel.
> > 
> > Would be nice if someone could confirm this though.
> 
> if [[ -z "${GRUB_CONF}" ]]; then
> print_error 1 "Error! Grub2 configuration file does not exist, please
> ensure grub2 is correctly setup first."
> return 0
> fi


Tried to make grub2 and EFI work on a HP Skylake laptop but failed. This laptop PXE boots linux
during install in BIOS mode so no EFI vars etc. available when installing grub2.
Is this an impossible combo? Do I need to EFI boot in order to install grub2 efi?

 Jocke

^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: [gentoo-dev] grub-2 configuration
  2016-10-28 10:56                       ` Joakim Tjernlund
@ 2016-10-28 22:01                         ` Patrick McLean
  0 siblings, 0 replies; 26+ messages in thread
From: Patrick McLean @ 2016-10-28 22:01 UTC (permalink / raw
  To: Joakim Tjernlund; +Cc: gentoo-dev

On Fri, 28 Oct 2016 10:56:08 +0000
Joakim Tjernlund <Joakim.Tjernlund@infinera.com> wrote:

> On Thu, 2016-10-20 at 11:03 -0400, Tom H wrote:
> > On Wed, Oct 19, 2016 at 4:43 PM, Joakim Tjernlund
> > <Joakim.Tjernlund@infinera.com> wrote:  
> > > 
> > > On Wed, 2016-10-19 at 15:21 -0400, Tom H wrote:  
> > > > 
> > > > 
> > > > but it looks like, unlike for grub-legacy, you need a grub
> > > > config file ("/boot/grub{,2}/grub.cfg") to exist.  
> > > 
> > > That is reasonable, to create a new entry one needs to copy the
> > > previous and replace the kernel.
> > > 
> > > Would be nice if someone could confirm this though.  
> > 
> > if [[ -z "${GRUB_CONF}" ]]; then
> > print_error 1 "Error! Grub2 configuration file does not exist,
> > please ensure grub2 is correctly setup first."
> > return 0
> > fi  
> 
> 
> Tried to make grub2 and EFI work on a HP Skylake laptop but failed.
> This laptop PXE boots linux during install in BIOS mode so no EFI
> vars etc. available when installing grub2. Is this an impossible
> combo? Do I need to EFI boot in order to install grub2 efi?
> 
>  Jocke

You need to be booted in EFI mode to be able to access the EFI vars and
install grub in EFI mode. If you are booted in legacy mode, you have to
use grub's i386-pc mode.


^ permalink raw reply	[flat|nested] 26+ messages in thread

end of thread, other threads:[~2016-10-28 22:02 UTC | newest]

Thread overview: 26+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-10-05  3:34 [gentoo-dev] grub-2 configuration William Hubbs
2016-10-05  4:46 ` Kent Fredric
2016-10-05  5:09   ` Kent Fredric
2016-10-05 14:26     ` Mike Gilbert
2016-10-05 16:52       ` [gentoo-dev] " Martin Vaeth
2016-10-05 19:21         ` William Hubbs
2016-10-08 14:33       ` [gentoo-dev] " Tom H
2016-10-08 15:00         ` Mike Gilbert
2016-10-11 14:34           ` Tom H
2016-10-08 14:28 ` Tom H
2016-10-08 23:03   ` [gentoo-dev] " Duncan
2016-10-08 23:57   ` [gentoo-dev] " Ben Kohler
2016-10-09  2:45     ` M. J. Everitt
2016-10-09 16:05       ` William Hubbs
2016-10-10  2:03         ` [gentoo-dev] " Duncan
2016-10-11 14:42         ` [gentoo-dev] " Tom H
2016-10-11 14:54           ` M. J. Everitt
2016-10-18 16:45             ` Tom H
2016-10-18 17:20               ` Joakim Tjernlund
2016-10-19 19:21                 ` Tom H
2016-10-19 20:43                   ` Joakim Tjernlund
2016-10-20 15:03                     ` Tom H
2016-10-28 10:56                       ` Joakim Tjernlund
2016-10-28 22:01                         ` Patrick McLean
2016-10-19 21:35                 ` Robin H. Johnson
2016-10-12 14:40           ` William Hubbs

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox