public inbox for gentoo-user@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-user] Exact setting in grub to default to a kernel by name?
@ 2021-06-13  4:07 Walter Dnes
  2021-06-13  4:46 ` Hund
  2021-06-13  8:21 ` Neil Bothwick
  0 siblings, 2 replies; 21+ messages in thread
From: Walter Dnes @ 2021-06-13  4:07 UTC (permalink / raw
  To: Gentoo Users List

  I have multiple (would you believe 2?) kernels in /boot.

[x8940][waltdnes][~] ll /boot/vm*
-rwxr-xr-x 1 root root 7046848 Jun 12 23:46 /boot/vmlinuz-experimental
-rwxr-xr-x 1 root root 6986624 Jun 12 16:55 /boot/vmlinuz-production

  The grub kernel listing at bootup is

- production kernel
- production kernel recovery mode
- experimental kernel
- experimental kernel recovery mode

  The default is the first entry, i.e. "GRUB_DEFAULT=0" in
/etc/default/grub.  I prefer going with "experimental".  If I screw up
the config to the point where it can't boot, then I'll manually override
to "production".  The simple way of getting the third entry as default
is "GRUB_DEFAULT=2" (remember to count from zero).

  This works for now.  But what happens if/when I add more kernels for
whatever reason?  Let me rephrase the question more generally... given a
kernel "/boot/vmlinuz-fubar" how and where do I specify it by name as
the default boot kernel?

-- 
Walter Dnes <waltdnes@waltdnes.org>
I don't run "desktop environments"; I run useful applications


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

* Re: [gentoo-user] Exact setting in grub to default to a kernel by name?
  2021-06-13  4:07 [gentoo-user] Exact setting in grub to default to a kernel by name? Walter Dnes
@ 2021-06-13  4:46 ` Hund
  2021-06-13 13:33   ` Walter Dnes
  2021-06-13  8:21 ` Neil Bothwick
  1 sibling, 1 reply; 21+ messages in thread
From: Hund @ 2021-06-13  4:46 UTC (permalink / raw
  To: gentoo-user

>Let me rephrase the question more generally... given a
>kernel "/boot/vmlinuz-fubar" how and where do I specify it by name as
>the default boot kernel?

What about this?

https://www.stephenrlang.com/2017/06/setting-default-kernel-in-grub2/

--
Hund


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

* Re: [gentoo-user] Exact setting in grub to default to a kernel by name?
  2021-06-13  4:07 [gentoo-user] Exact setting in grub to default to a kernel by name? Walter Dnes
  2021-06-13  4:46 ` Hund
@ 2021-06-13  8:21 ` Neil Bothwick
  2021-06-13  8:26   ` Neil Bothwick
  1 sibling, 1 reply; 21+ messages in thread
From: Neil Bothwick @ 2021-06-13  8:21 UTC (permalink / raw
  To: gentoo-user

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

On Sun, 13 Jun 2021 00:07:27 -0400, Walter Dnes wrote:

>   I have multiple (would you believe 2?) kernels in /boot.
> 
> [x8940][waltdnes][~] ll /boot/vm*
> -rwxr-xr-x 1 root root 7046848 Jun 12 23:46 /boot/vmlinuz-experimental
> -rwxr-xr-x 1 root root 6986624 Jun 12 16:55 /boot/vmlinuz-production
> 
>   The grub kernel listing at bootup is
> 
> - production kernel
> - production kernel recovery mode
> - experimental kernel
> - experimental kernel recovery mode
> 
>   The default is the first entry, i.e. "GRUB_DEFAULT=0" in
> /etc/default/grub.  I prefer going with "experimental".  If I screw up
> the config to the point where it can't boot, then I'll manually override
> to "production".  The simple way of getting the third entry as default
> is "GRUB_DEFAULT=2" (remember to count from zero).
> 
>   This works for now.  But what happens if/when I add more kernels for
> whatever reason?  Let me rephrase the question more generally... given a
> kernel "/boot/vmlinuz-fubar" how and where do I specify it by name as
> the default boot kernel?
> 

The default setting takes either the number of title of a kernel, so
default="experimental kernel" should do it.


-- 
Neil Bothwick

A Smith & Wesson beats Four Aces everytime.

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

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

* Re: [gentoo-user] Exact setting in grub to default to a kernel by name?
  2021-06-13  8:21 ` Neil Bothwick
@ 2021-06-13  8:26   ` Neil Bothwick
  0 siblings, 0 replies; 21+ messages in thread
From: Neil Bothwick @ 2021-06-13  8:26 UTC (permalink / raw
  To: gentoo-user

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

On Sun, 13 Jun 2021 09:21:36 +0100, Neil Bothwick wrote:

> The default setting takes either the number of title of a kernel, so
> default="experimental kernel" should do it.

Forgot the obligatory RTFM reference :)

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


-- 
Neil Bothwick

After all is said and done let there not be more said than done.

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

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

* Re: [gentoo-user] Exact setting in grub to default to a kernel by name?
  2021-06-13  4:46 ` Hund
@ 2021-06-13 13:33   ` Walter Dnes
  2021-06-13 17:38     ` [gentoo-user] " Grant Edwards
  2021-06-13 18:05     ` [gentoo-user] " Neil Bothwick
  0 siblings, 2 replies; 21+ messages in thread
From: Walter Dnes @ 2021-06-13 13:33 UTC (permalink / raw
  To: gentoo-user

On Sun, Jun 13, 2021 at 06:46:15AM +0200, Hund wrote
> >Let me rephrase the question more generally... given a
> >kernel "/boot/vmlinuz-fubar" how and where do I specify it by name as
> >the default boot kernel?
> 
> What about this?
> 
> https://www.stephenrlang.com/2017/06/setting-default-kernel-in-grub2/

  Is /boot/grub/grub.cfg the file that actually controls bootup, and is
all 154 lines of verbosity really necessary?  For menu entries I see...

=====================================================================
menuentry 'Gentoo GNU/Linux, with Linux production' --class blah blah
blah {
blah blah blah
set root='hd0,gpt1'
linux   /vmlinuz-production root=/dev/sda2 ro  noexec=on net.ifnames=0 intel_pstate=disable ipv6.disable=1
}
menuentry 'Gentoo GNU/Linux, with Linux production (recovery mode)'
--class blah blah blah {
blah blah blah
set root='hd0,gpt1'
linux   /vmlinuz-production root=/dev/sda2 ro single
}
menuentry 'Gentoo GNU/Linux, with Linux experimental' --class blah blah
blah {
blah blah blah
set root='hd0,gpt1'
linux   /vmlinuz-experimental root=/dev/sda2 ro  noexec=on net.ifnames=0 intel_pstate=disable ipv6.disable=1
}
menuentry 'Gentoo GNU/Linux, with Linux experimental (recovery mode)'
--class blah blah blah {
blah blah blah
set root='hd0,gpt1'
linux   /vmlinuz-experimental root=/dev/sda2 ro single
}
=====================================================================

  I'd be tempted to do a manual gub.cfg if I had documentation.

-- 
Walter Dnes <waltdnes@waltdnes.org>
I don't run "desktop environments"; I run useful applications


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

* [gentoo-user] Re: Exact setting in grub to default to a kernel by name?
  2021-06-13 13:33   ` Walter Dnes
@ 2021-06-13 17:38     ` Grant Edwards
  2021-06-13 22:57       ` Walter Dnes
  2021-06-13 18:05     ` [gentoo-user] " Neil Bothwick
  1 sibling, 1 reply; 21+ messages in thread
From: Grant Edwards @ 2021-06-13 17:38 UTC (permalink / raw
  To: gentoo-user

On 2021-06-13, Walter Dnes <waltdnes@waltdnes.org> wrote:

>   I'd be tempted to do a manual gub.cfg if I had documentation.

I gave up on the grub2 auto-magical config system many years ago. My
grub.cfg is typically 10-20 lines long. The documentation is at

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

For manual confiuration: see section 6:

  https://www.gnu.org/software/grub/manual/grub/html_node/Configuration.html#Configuration




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

* Re: [gentoo-user] Exact setting in grub to default to a kernel by name?
  2021-06-13 13:33   ` Walter Dnes
  2021-06-13 17:38     ` [gentoo-user] " Grant Edwards
@ 2021-06-13 18:05     ` Neil Bothwick
  2021-06-13 18:45       ` Michael
  2021-06-13 20:09       ` Philip Webb
  1 sibling, 2 replies; 21+ messages in thread
From: Neil Bothwick @ 2021-06-13 18:05 UTC (permalink / raw
  To: gentoo-user

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

On Sun, 13 Jun 2021 09:33:57 -0400, Walter Dnes wrote:

> On Sun, Jun 13, 2021 at 06:46:15AM +0200, Hund wrote
> > >Let me rephrase the question more generally... given a
> > >kernel "/boot/vmlinuz-fubar" how and where do I specify it by name as
> > >the default boot kernel?  
> > 
> > What about this?
> > 
> > https://www.stephenrlang.com/2017/06/setting-default-kernel-in-grub2/
> >  
> 
>   Is /boot/grub/grub.cfg the file that actually controls bootup, and is
> all 154 lines of verbosity really necessary?  For menu entries I see...

Not necessary, but does no harm either. The first 90% of the file is
automated setup, which you can replace with hard coded entries or just
leave it to its own devices. The only part you need to think about is the
menuentry sections.

>   I'd be tempted to do a manual gub.cfg if I had documentation.

GRUB has extensive documentation. it's not the best written but every
configuration option is described.

Isn't this a new laptop? If so, why torment yourself with GRUB when you
have UEFI available to you? The only real justification for using GRUB in
such a situation is that you are completely familiar with it and don't
want to learn something else. But if you have to learn something, you may
as well learn the 2/3 line configs of systemd-boot.

Note that systemd-boot doesn't require systemd, it's just the gummiboot
boot manager that was merged into systemd taken out again. Or you could
use rEFInd if you prefer a prettier boot menu.



-- 
Neil Bothwick

Mouse: (n.) an input device used by management to force computer users to
       keep at least a part of their desks clean.

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

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

* Re: [gentoo-user] Exact setting in grub to default to a kernel by name?
  2021-06-13 18:05     ` [gentoo-user] " Neil Bothwick
@ 2021-06-13 18:45       ` Michael
  2021-06-13 20:09       ` Philip Webb
  1 sibling, 0 replies; 21+ messages in thread
From: Michael @ 2021-06-13 18:45 UTC (permalink / raw
  To: gentoo-user

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

On Sunday, 13 June 2021 19:05:29 BST Neil Bothwick wrote:
> On Sun, 13 Jun 2021 09:33:57 -0400, Walter Dnes wrote:
> > On Sun, Jun 13, 2021 at 06:46:15AM +0200, Hund wrote
> > 
> > > >Let me rephrase the question more generally... given a
> > > >kernel "/boot/vmlinuz-fubar" how and where do I specify it by name as
> > > >the default boot kernel?
> > > 
> > > What about this?
> > > 
> > > https://www.stephenrlang.com/2017/06/setting-default-kernel-in-grub2/
> > > 
> >   Is /boot/grub/grub.cfg the file that actually controls bootup, and is
> > 
> > all 154 lines of verbosity really necessary?  For menu entries I see...
> 
> Not necessary, but does no harm either. The first 90% of the file is
> automated setup, which you can replace with hard coded entries or just
> leave it to its own devices. The only part you need to think about is the
> menuentry sections.
> 
> >   I'd be tempted to do a manual gub.cfg if I had documentation.
> 
> GRUB has extensive documentation. it's not the best written but every
> configuration option is described.
> 
> Isn't this a new laptop? If so, why torment yourself with GRUB when you
> have UEFI available to you? The only real justification for using GRUB in
> such a situation is that you are completely familiar with it and don't
> want to learn something else. But if you have to learn something, you may
> as well learn the 2/3 line configs of systemd-boot.
> 
> Note that systemd-boot doesn't require systemd, it's just the gummiboot
> boot manager that was merged into systemd taken out again. Or you could
> use rEFInd if you prefer a prettier boot menu.

I do like rEFInd, feels AppleMac-like.  :-)

However, I have abandoned all boot managers these days on UEFI MoBos and just 
use the native UEFI firmware to boot with.[1]  It's simpler, lighter and 
faster.  However, I don't boot into different OS/kernels unless I have to and 
when I do I have to use the UEFI menu GUI to switch OS/kernels, so this won't 
suit all use cases.

This approach requires to enable the 'EFI boot stub' option in the kernel, so 
that the UEFI firmware can recognise and load the kernel directly as an EFI 
executable.[2]  Then it is a matter of using the efibootmgr on the CLI to set 
up my boot menu labels and OS/kernel order.[3] 

[1] https://wiki.gentoo.org/wiki/Handbook:AMD64/Installation/
Bootloader#Alternative_2:_efibootmgr
[2] https://wiki.gentoo.org/wiki/EFI_Stub
[3] https://wiki.gentoo.org/wiki/Efibootmgr

[-- Attachment #2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

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

* Re: [gentoo-user] Exact setting in grub to default to a kernel by name?
  2021-06-13 18:05     ` [gentoo-user] " Neil Bothwick
  2021-06-13 18:45       ` Michael
@ 2021-06-13 20:09       ` Philip Webb
  2021-06-13 20:58         ` Walter Dnes
  1 sibling, 1 reply; 21+ messages in thread
From: Philip Webb @ 2021-06-13 20:09 UTC (permalink / raw
  To: gentoo-user

210613 Neil Bothwick wrote:
> Isn't this a new laptop? If so, why torment yourself with GRUB when you
> have UEFI available to you? The only real justification for using GRUB in
> such a situation is that you are completely familiar with it and don't
> want to learn something else. But if you have to learn something, you may
> as well learn the 2/3 line configs of systemd-boot.
> Note that systemd-boot doesn't require systemd, it's just the gummiboot
> boot manager that was merged into systemd taken out again. Or you could
> use rEFInd if you prefer a prettier boot menu.

Or the OP could use Lilo, the simplest boot manager of all.

-- 
========================,,============================================
SUPPORT     ___________//___,   Philip Webb
ELECTRIC   /] [] [] [] [] []|   Cities Centre, University of Toronto
TRANSIT    `-O----------O---'   purslowatchassdotutorontodotca



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

* Re: [gentoo-user] Exact setting in grub to default to a kernel by name?
  2021-06-13 20:09       ` Philip Webb
@ 2021-06-13 20:58         ` Walter Dnes
  2021-06-14  8:25           ` Peter Humphrey
  0 siblings, 1 reply; 21+ messages in thread
From: Walter Dnes @ 2021-06-13 20:58 UTC (permalink / raw
  To: gentoo-user

On Sun, Jun 13, 2021 at 04:09:58PM -0400, Philip Webb wrote
> 
> Or the OP could use Lilo, the simplest boot manager of all.

  On a UEFI-only desktop PC?

-- 
Walter Dnes <waltdnes@waltdnes.org>
I don't run "desktop environments"; I run useful applications


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

* Re: [gentoo-user] Re: Exact setting in grub to default to a kernel by name?
  2021-06-13 17:38     ` [gentoo-user] " Grant Edwards
@ 2021-06-13 22:57       ` Walter Dnes
  2021-06-13 23:20         ` Neil Bothwick
  2021-06-14  1:00         ` Grant Edwards
  0 siblings, 2 replies; 21+ messages in thread
From: Walter Dnes @ 2021-06-13 22:57 UTC (permalink / raw
  To: gentoo-user

On Sun, Jun 13, 2021 at 05:38:53PM -0000, Grant Edwards wrote
> On 2021-06-13, Walter Dnes <waltdnes@waltdnes.org> wrote:
> 
> >   I'd be tempted to do a manual gub.cfg if I had documentation.
> 
> I gave up on the grub2 auto-magical config system many years ago. My
> grub.cfg is typically 10-20 lines long. The documentation is at
> 
>   https://www.gnu.org/software/grub/manual/grub/grub.html
> 
> For manual confiuration: see section 6:
> 
>   https://www.gnu.org/software/grub/manual/grub/html_node/Configuration.html#Configuration

  When experimenting with this, I'll backup grub.cfg.  If things go
awry, boot with the USB key I used for the install, and copy back the
old known working grub.cfg.  I've done a first crack at this.  I assume
that nothing in /etc/default/grub will have any effect.  Questions...

1) Is "insmod extfs3" necessary? I've built extfs3 into the kernels.
2) I assume that the the first "menuentry" will be the default boot?
3) Is the default timeout still 5 seconds?
3) I assume that 640x480 is supported on just about every monitor
out there.  I want as large text as possible.  My eyes are getting
old... just like me.  Any obvious errors in the following grub.cfg?

=====================================================================
menuentry 'Linux Experimental' --class gnu-linux {
        set gfxpayload=640x480
        insmod ext3fs
        set root='hd0,gpt1'
        linux   /vmlinuz-experimental root=/dev/sda2 ro  noexec=on net.ifnames=0 intel_pstate=disable ipv6.disable=1
}
menuentry 'Linux Experimental Recovery' --class gnu-linux {
        set gfxpayload=640x480
        insmod ext3fs
        set root='hd0,gpt1'
        linux   /vmlinuz-experimental root=/dev/sda2 ro
}
menuentry 'Linux Production' --class gnu-linux { 
        set gfxpayload=640x480
        insmod ext3fs
        set root='hd0,gpt1'
        linux   /vmlinuz-production root=/dev/sda2 ro  noexec=on net.ifnames=0 intel_pstate=disable ipv6.disable=1
}
menuentry 'Linux Production Recovery' --class gnu-linux { 
        set gfxpayload=640x480
        insmod ext3fs
        set root='hd0,gpt1'
        linux   /vmlinuz-production root=/dev/sda2 ro
}
=====================================================================

  Something that occured to me.  Can I move the duplicated lines to the
top of the file and take them out of the menuentries?  E.g.

=====================================================================
        set gfxpayload=640x480
        insmod ext3fs
        set root='hd0,gpt1'
menuentry 'Linux Experimental' --class gnu-linux {
        linux   /vmlinuz-experimental root=/dev/sda2 ro  noexec=on net.ifnames=0 intel_pstate=disable ipv6.disable=1
}
menuentry 'Linux Experimental Recovery' --class gnu-linux {
        linux   /vmlinuz-experimental root=/dev/sda2 ro
}
menuentry 'Linux Production' --class gnu-linux { 
        linux   /vmlinuz-production root=/dev/sda2 ro  noexec=on net.ifnames=0 intel_pstate=disable ipv6.disable=1
}
menuentry 'Linux Production Recovery' --class gnu-linux { 
        linux   /vmlinuz-production root=/dev/sda2 ro
}
=====================================================================

-- 
Walter Dnes <waltdnes@waltdnes.org>
I don't run "desktop environments"; I run useful applications


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

* Re: [gentoo-user] Re: Exact setting in grub to default to a kernel by name?
  2021-06-13 22:57       ` Walter Dnes
@ 2021-06-13 23:20         ` Neil Bothwick
  2021-06-14  2:34           ` Walter Dnes
  2021-06-14  1:00         ` Grant Edwards
  1 sibling, 1 reply; 21+ messages in thread
From: Neil Bothwick @ 2021-06-13 23:20 UTC (permalink / raw
  To: gentoo-user

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

On Sun, 13 Jun 2021 18:57:49 -0400, Walter Dnes wrote:

>   When experimenting with this, I'll backup grub.cfg.  If things go
> awry, boot with the USB key I used for the install, and copy back the
> old known working grub.cfg.  I've done a first crack at this.  I assume
> that nothing in /etc/default/grub will have any effect.  Questions...

/etc/default/grub is only used when you call grub-mkconfig.

> 1) Is "insmod extfs3" necessary? I've built extfs3 into the kernels.

If the kernel is on an ext3 filesystem, yes. This is GRUB's module, it
uses it to read an ext3 filesystem in order to load the kernel.

> 2) I assume that the the first "menuentry" will be the default boot?

Yes, you'll see default=0 in the first part of grub.cfg.

> 3) Is the default timeout still 5 seconds?

Not sure on that one, but look at grub.cfg.

> 3) I assume that 640x480 is supported on just about every monitor
> out there.  I want as large text as possible.  My eyes are getting
> old... just like me.

My eyes are better than they were 40 years ago but don't ask about my
hearing, or if you must, do it loudly...


-- 
Neil Bothwick

Documentation: (n.) a novel sold with software, designed to entertain the
               operator during episodes of bugs or glitches.

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

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

* [gentoo-user] Re: Exact setting in grub to default to a kernel by name?
  2021-06-13 22:57       ` Walter Dnes
  2021-06-13 23:20         ` Neil Bothwick
@ 2021-06-14  1:00         ` Grant Edwards
  2021-06-14  6:44           ` Walter Dnes
  1 sibling, 1 reply; 21+ messages in thread
From: Grant Edwards @ 2021-06-14  1:00 UTC (permalink / raw
  To: gentoo-user

On 2021-06-13, Walter Dnes <waltdnes@waltdnes.org> wrote:
> On Sun, Jun 13, 2021 at 05:38:53PM -0000, Grant Edwards wrote
>> On 2021-06-13, Walter Dnes <waltdnes@waltdnes.org> wrote:
>> 
>> >   I'd be tempted to do a manual gub.cfg if I had documentation.
>> 
>> I gave up on the grub2 auto-magical config system many years ago. My
>> grub.cfg is typically 10-20 lines long. The documentation is at
>> 
>>   https://www.gnu.org/software/grub/manual/grub/grub.html
>> 
>> For manual confiuration: see section 6:
>> 
>>   https://www.gnu.org/software/grub/manual/grub/html_node/Configuration.html#Configuration
>
>   When experimenting with this, I'll backup grub.cfg.  If things go
> awry, boot with the USB key I used for the install, and copy back the
> old known working grub.cfg.  I've done a first crack at this.  I assume
> that nothing in /etc/default/grub will have any effect.  Questions...
>
> 1) Is "insmod extfs3" necessary? I've built extfs3 into the kernels.

I've never used it it, and my boot partitions are always ext3/4 

> 2) I assume that the the first "menuentry" will be the default boot?

Unless you set the `default` variable to something other than 0

> 3) Is the default timeout still 5 seconds?

Dunny, I always set 'timeout=10'

> 3) I assume that 640x480 is supported on just about every monitor
>    out there.  I want as large text as possible.  My eyes are
>    getting old... just like me.  Any obvious errors in the following
>    grub.cfg?



>
>=====================================================================
> menuentry 'Linux Experimental' --class gnu-linux {
>         set gfxpayload=640x480
>         insmod ext3fs
>         set root='hd0,gpt1'
>         linux   /vmlinuz-experimental root=/dev/sda2 ro  noexec=on net.ifnames=0 intel_pstate=disable ipv6.disable=1
> }

I don't know if you really need the gfxpayload or the insmod lines, I don't
recall ever needing those to boot kernels from ext3/4 partitions.

All my grub.cfg files looks like this:

========================================================================
timeout=10
root=hd0,1
default=0

menuentry 'vmlinuz-5.10.27-gentoo' {
  linux /boot/vmlinuz-5.10.27-gentoo root=/dev/sda1
  }
 
menuentry 'vmlinuz-5.4.97-gentoo' {
  linux /boot/vmlinuz-5.4.97-gentoo root=/dev/sda1
  }
========================================================================

> Something that occured to me.  Can I move the duplicated lines to the
> top of the file and take them out of the menuentries?  E.g.

Yes.




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

* Re: [gentoo-user] Re: Exact setting in grub to default to a kernel by name?
  2021-06-13 23:20         ` Neil Bothwick
@ 2021-06-14  2:34           ` Walter Dnes
  2021-06-14 11:47             ` Neil Bothwick
  0 siblings, 1 reply; 21+ messages in thread
From: Walter Dnes @ 2021-06-14  2:34 UTC (permalink / raw
  To: gentoo-user

On Mon, Jun 14, 2021 at 12:20:44AM +0100, Neil Bothwick wrote
> On Sun, 13 Jun 2021 18:57:49 -0400, Walter Dnes wrote:
> 
> /etc/default/grub is only used when you call grub-mkconfig.
> 
> > 1) Is "insmod extfs3" necessary? I've built extfs3 into the kernels.
> 
> If the kernel is on an ext3 filesystem, yes. This is GRUB's module, it
> uses it to read an ext3 filesystem in order to load the kernel.

  Some confusion here.  "fdisk -l" on my new machine gives...

Device          Start        End    Sectors   Size Type
/dev/sda1        2048     526335     524288   256M EFI System
/dev/sda2      526336 1886416303 1885889968 899.3G Linux filesystem
/dev/sda3  1886418352 1953523119   67104768    32G Linux filesystem

  The EFI Systen partition is fat32.  The web examples I read show
"insmod <filesystem>" matching the filesystem of the linux system being
booted.  But all entries in grub.cfg on my new machine are "insmod fat".
I wonder if the web documentation was referring to BIOS-booting machines.
grub.cfg would be sitting on an xfs or extfs3 or whatever file system,
and would need to read it off that filesystem.

  I have a UEFI system which demands a fat32 boot partition.  Since grub
and the kernels are sitting on a fat32 partition, my machine needs
"insmod fat".

  Things that make you go hmmmm...
* you need to put "insmod fat" in grub.cfg to tell grub that the kernels
  are sitting on a fat32 partition
* but grub has to first read grub.cfg on the fat32 partition before it
  knows that it must read a fat32 partition

  I wonder if this is due to the verbose automagic configuration.  I
also noticed that all menuentries on my machine contain "insmod gzio
and "insmod part_gpt", so I'm including them here.  Here is my proposed
grub.cfg.  If anybody sees any problems, please let me know.  Otherwise,
I'll try the following tomorrow on the new machine...

========================================================================

        set timeout_style=menu
        set timeout=15
        insmod vga
        set gfxpayload=640x480
        insmod gzio
        insmod part_gpt
        insmod fat
        set root='hd0,gpt1'
menuentry 'Linux Experimental' --class gnu-linux {
        linux   /vmlinuz-experimental root=/dev/sda2 ro  noexec=on net.ifnames=0 intel_pstate=disable ipv6.disable=1
}
menuentry 'Linux Experimental Recovery' --class gnu-linux {
        linux   /vmlinuz-experimental root=/dev/sda2 ro
}
menuentry 'Linux Production' --class gnu-linux {
        linux   /vmlinuz-production root=/dev/sda2 ro  noexec=on net.ifnames=0 intel_pstate=disable ipv6.disable=1
}
menuentry 'Linux Production Recovery' --class gnu-linux {
        linux   /vmlinuz-production root=/dev/sda2 ro
}


-- 
Walter Dnes <waltdnes@waltdnes.org>
I don't run "desktop environments"; I run useful applications


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

* Re: [gentoo-user] Re: Exact setting in grub to default to a kernel by name?
  2021-06-14  1:00         ` Grant Edwards
@ 2021-06-14  6:44           ` Walter Dnes
  2021-06-14  8:38             ` Grant Edwards
  0 siblings, 1 reply; 21+ messages in thread
From: Walter Dnes @ 2021-06-14  6:44 UTC (permalink / raw
  To: gentoo-user

On Mon, Jun 14, 2021 at 01:00:38AM -0000, Grant Edwards wrote

> All my grub.cfg files looks like this:
> 
> ========================================================================
> timeout=10
> root=hd0,1
> default=0
> 
> menuentry 'vmlinuz-5.10.27-gentoo' {
>   linux /boot/vmlinuz-5.10.27-gentoo root=/dev/sda1
>   }
>  
> menuentry 'vmlinuz-5.4.97-gentoo' {
>   linux /boot/vmlinuz-5.4.97-gentoo root=/dev/sda1
>   }
> ========================================================================

  Thanks.  It's nice to have a working example.  Are you booting via
BIOS?  I'm on a UEFI-only machine, and the generated grub.cfg has...

set root='hd0,gpt1' (EFI fat partition sda1 where to look for kernels)

linux   /vmlinuz-production root=/dev/sda2 (ext3fs on sda2)

-- 
Walter Dnes <waltdnes@waltdnes.org>
I don't run "desktop environments"; I run useful applications


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

* Re: [gentoo-user] Exact setting in grub to default to a kernel by name?
  2021-06-13 20:58         ` Walter Dnes
@ 2021-06-14  8:25           ` Peter Humphrey
  0 siblings, 0 replies; 21+ messages in thread
From: Peter Humphrey @ 2021-06-14  8:25 UTC (permalink / raw
  To: gentoo-user

On Sunday, 13 June 2021 21:58:05 BST Walter Dnes wrote:
> On Sun, Jun 13, 2021 at 04:09:58PM -0400, Philip Webb wrote
> 
> > Or the OP could use Lilo, the simplest boot manager of all.
> 
>   On a UEFI-only desktop PC?

No. There is sys-boot/elilo, which ought to do, but I haven't tried it.

-- 
Regards,
Peter.





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

* [gentoo-user] Re: Exact setting in grub to default to a kernel by name?
  2021-06-14  6:44           ` Walter Dnes
@ 2021-06-14  8:38             ` Grant Edwards
  2021-06-14 20:25               ` Walter Dnes
  0 siblings, 1 reply; 21+ messages in thread
From: Grant Edwards @ 2021-06-14  8:38 UTC (permalink / raw
  To: gentoo-user

On 2021-06-14, Walter Dnes <waltdnes@waltdnes.org> wrote:

> On Mon, Jun 14, 2021 at 01:00:38AM -0000, Grant Edwards wrote

>> All my grub.cfg files looks like this:
>> 
>> ========================================================================
>> timeout=10
>> root=hd0,1
>> default=0
>> 
>> menuentry 'vmlinuz-5.10.27-gentoo' {
>>   linux /boot/vmlinuz-5.10.27-gentoo root=/dev/sda1
>>   }
>>  
>> menuentry 'vmlinuz-5.4.97-gentoo' {
>>   linux /boot/vmlinuz-5.4.97-gentoo root=/dev/sda1
>>   }
>> ========================================================================
>
>   Thanks.  It's nice to have a working example.  Are you booting via
> BIOS?  I'm on a UEFI-only machine, and the generated grub.cfg has...

The example above is BIOS boot with a GPT labelled root disk.

Now that you've reminded me, I do have one UEFI system, and it does
contain a few extra global lines. It's also GPT labelled, and still
contains the original Lenovo Win10 installation -- I shrunk the Win10
partition and added two new partitions (Linux root, Linux
swap). Below is the grub.cfg for that machine:

IIRC, it worked fine without any of the gfx/font/video stuff, but like
you I wanted a nice big font.

Note that on this machine I just tell grub to search for the
filesystem with the label "root" instead of specifying it manually --
though it is still specified manually for the kernel argument. I don't
remember why I did that...


========================================================================
timeout=5

loadfont "DejavuSansMono24"
set gfxmode=auto
set gfxpayload=keep
insmod all_video
insmod gfxterm
terminal_output gfxterm

search --set=root --label rootfs

sleep 2

menuentry vmlinuz-5.10.27-gentoo {
  linux /boot/vmlinuz-5.10.27-gentoo root=/dev/nvme0n1p5
}

menuentry 'vmlinuz-5.4.97-gentoo' {
  linux /boot/vmlinuz-5.4.97-gentoo root=/dev/nvme0n1p5
}

menuentry 'vmlinuz-4.19.175-gentoo' {
  linux /boot/vmlinuz-4.19.175-gentoo root=/dev/nvme0n1p5
}
========================================================================





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

* Re: [gentoo-user] Re: Exact setting in grub to default to a kernel by name?
  2021-06-14  2:34           ` Walter Dnes
@ 2021-06-14 11:47             ` Neil Bothwick
  0 siblings, 0 replies; 21+ messages in thread
From: Neil Bothwick @ 2021-06-14 11:47 UTC (permalink / raw
  To: gentoo-user

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

On Sun, 13 Jun 2021 22:34:30 -0400, Walter Dnes wrote:

> > > 1) Is "insmod extfs3" necessary? I've built extfs3 into the
> > > kernels.  
> > 
> > If the kernel is on an ext3 filesystem, yes. This is GRUB's module, it
> > uses it to read an ext3 filesystem in order to load the kernel.  
> 
>   Some confusion here.  "fdisk -l" on my new machine gives...
> 
> Device          Start        End    Sectors   Size Type
> /dev/sda1        2048     526335     524288   256M EFI System
> /dev/sda2      526336 1886416303 1885889968 899.3G Linux filesystem
> /dev/sda3  1886418352 1953523119   67104768    32G Linux filesystem
> 
>   The EFI Systen partition is fat32.  The web examples I read show
> "insmod <filesystem>" matching the filesystem of the linux system being
> booted.  But all entries in grub.cfg on my new machine are "insmod fat".
> I wonder if the web documentation was referring to BIOS-booting
> machines. grub.cfg would be sitting on an xfs or extfs3 or whatever
> file system, and would need to read it off that filesystem.

If /boot is on the ESP, i.e. FAT, you won't need the ext3 module. I
suspect part of the auto-configuration setup is "load everything we
might need". It's not really an issue since the memory used by the
modules should be freed when GRUB exits.

The bloatedness is a combination of the must run everywhere defaults and
using a full bootloader when you only need a minimal boot manager. These
days, I only use GRUB on BIOS systems.


-- 
Neil Bothwick

No, you *can't* call 999 now. I'm downloading my mail.

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

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

* Re: [gentoo-user] Re: Exact setting in grub to default to a kernel by name?
  2021-06-14  8:38             ` Grant Edwards
@ 2021-06-14 20:25               ` Walter Dnes
  2021-06-15 13:56                 ` Neil Bothwick
  0 siblings, 1 reply; 21+ messages in thread
From: Walter Dnes @ 2021-06-14 20:25 UTC (permalink / raw
  To: gentoo-user

On Mon, Jun 14, 2021 at 08:38:50AM -0000, Grant Edwards wrote

> Note that on this machine I just tell grub to search for the
> filesystem with the label "root" instead of specifying it manually --
> though it is still specified manually for the kernel argument. I don't
> remember why I did that...

  Because specifying it manually doesn't work... ask me how I found out.
Partial success... the following gives me a working text mode menu just
like the standard grub.cfg.

========================================================================
        set timeout=15
        insmod vga
        set gfxmode=640x480
        set gfxpayload=640x480
        insmod gfxterm
        terminal_output gfxterm
        search --set=root --label rootfs
menuentry 'Linux Experimental' {
        linux   /vmlinuz-experimental root=/dev/sda2 ro  noexec=on net.ifnames=0 intel_pstate=disable ipv6.disable=1
}
menuentry 'Linux Experimental Recovery' {
        linux   /vmlinuz-experimental root=/dev/sda2 ro
}
menuentry 'Linux Production' {
        linux   /vmlinuz-production root=/dev/sda2 ro  noexec=on net.ifnames=0 intel_pstate=disable ipv6.disable=1
}
menuentry 'Linux Production Recovery' {
        linux   /vmlinuz-production root=/dev/sda2 ro
}
========================================================================

  Unfortunately, just like the standard grub.cfg, it's a tiny-looking
text font on my 1920x1080 monitor that I have to squint at.  Next
step...  what do I do to get a functioning GUI?

-- 
Walter Dnes <waltdnes@waltdnes.org>
I don't run "desktop environments"; I run useful applications


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

* Re: [gentoo-user] Re: Exact setting in grub to default to a kernel by name?
  2021-06-14 20:25               ` Walter Dnes
@ 2021-06-15 13:56                 ` Neil Bothwick
  2021-06-16  0:51                   ` [gentoo-user] [SOLVED} " Walter Dnes
  0 siblings, 1 reply; 21+ messages in thread
From: Neil Bothwick @ 2021-06-15 13:56 UTC (permalink / raw
  To: gentoo-user

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

On Mon, 14 Jun 2021 16:25:00 -0400, Walter Dnes wrote:

>   Unfortunately, just like the standard grub.cfg, it's a tiny-looking
> text font on my 1920x1080 monitor that I have to squint at.  Next
> step...  what do I do to get a functioning GUI?

Set up a theme, you can use one of the supplied examples as a base, with
a larger font.

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


-- 
Neil Bothwick

Bus: (n.) a connector you plug money into, something like a slot machine.

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

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

* [gentoo-user] [SOLVED} Exact setting in grub to default to a kernel by name?
  2021-06-15 13:56                 ` Neil Bothwick
@ 2021-06-16  0:51                   ` Walter Dnes
  0 siblings, 0 replies; 21+ messages in thread
From: Walter Dnes @ 2021-06-16  0:51 UTC (permalink / raw
  To: gentoo-user

On Tue, Jun 15, 2021 at 02:56:48PM +0100, Neil Bothwick wrote
> On Mon, 14 Jun 2021 16:25:00 -0400, Walter Dnes wrote:
> 
> >   Unfortunately, just like the standard grub.cfg, it's a tiny-looking
> > text font on my 1920x1080 monitor that I have to squint at.  Next
> > step...  what do I do to get a functioning GUI?
> 
> Set up a theme, you can use one of the supplied examples as a base, with
> a larger font.
> 
> https://www.gnu.org/software/grub/manual/grub/grub.html#Fonts

  After more reboots than I want to remember, I'm finally where I want
to be.  Thanks for everybody's help.  I found a thread on Stackexchange
https://unix.stackexchange.com/questions/31672/can-grub-font-size-be-customised
which supplied the final piece of the puzzle.  That thread was started
9 years, 4 months ago.  grub1 is now a distant memory, so change all
mentions of "grub2" to plain "grub".  As per the Stackexchange thread,
there's a grub-mkfont command that can translate ttf files to pf2 files
readable by grub.  ***AND YOU CAN RESIZE THE FONT WHILE YOURE AT IT***.
So I ran grub-mkfont, with "-s 64" which means 64 pixels high...

grub-mkfont -s 64 -o /boot/grub/fonts/HonkingBigFont.pf2 /usr/share/fonts/dejavu/DejaVuSansMono-Bold.ttf

  My grub.cfg follows.  Yours would obviously differ in details.

====================================================================
search --set=root --label rootfs
sleep 2

set timeout=15
set gfxmode=640x480
set gfxpayload=keep
loadfont /boot/grub/fonts/HonkingBigFont.pf2
insmod all_video
insmod gfxterm
terminal_output gfxterm

menuentry 'Linux Experimental' {
        linux   /vmlinuz-experimental root=/dev/sda2 ro  noexec=on net.ifnames=0
 intel_pstate=disable ipv6.disable=1
}
menuentry 'Linux Experimental Recovery' {
        linux   /vmlinuz-experimental root=/dev/sda2 ro
}
menuentry 'Linux Production' {
        linux   /vmlinuz-production root=/dev/sda2 ro  noexec=on net.ifnames=0 i
ntel_pstate=disable ipv6.disable=1
}
menuentry 'Linux Production Recovery' {
        linux   /vmlinuz-production root=/dev/sda2 ro
}
====================================================================

  The menu output is Y-U-U-U-U-U-GE, which makes it nice and readable on
my 1920x1080 monitor.  There's a cosmetic problem in that this font
doesn't have "line-drawing characters"...

1) The box around the menu is composed of garbage characters.
2) The bit about using up-arrow and down-arrow keys to select also shows
   the same garbage characters.

  grub-mkfont man page says "Convert common font file formats into PF2",
so I may look at other character sets that have line-drawing characters.

-- 
Walter Dnes <waltdnes@waltdnes.org>
I don't run "desktop environments"; I run useful applications


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

end of thread, other threads:[~2021-06-16  0:51 UTC | newest]

Thread overview: 21+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-06-13  4:07 [gentoo-user] Exact setting in grub to default to a kernel by name? Walter Dnes
2021-06-13  4:46 ` Hund
2021-06-13 13:33   ` Walter Dnes
2021-06-13 17:38     ` [gentoo-user] " Grant Edwards
2021-06-13 22:57       ` Walter Dnes
2021-06-13 23:20         ` Neil Bothwick
2021-06-14  2:34           ` Walter Dnes
2021-06-14 11:47             ` Neil Bothwick
2021-06-14  1:00         ` Grant Edwards
2021-06-14  6:44           ` Walter Dnes
2021-06-14  8:38             ` Grant Edwards
2021-06-14 20:25               ` Walter Dnes
2021-06-15 13:56                 ` Neil Bothwick
2021-06-16  0:51                   ` [gentoo-user] [SOLVED} " Walter Dnes
2021-06-13 18:05     ` [gentoo-user] " Neil Bothwick
2021-06-13 18:45       ` Michael
2021-06-13 20:09       ` Philip Webb
2021-06-13 20:58         ` Walter Dnes
2021-06-14  8:25           ` Peter Humphrey
2021-06-13  8:21 ` Neil Bothwick
2021-06-13  8:26   ` Neil Bothwick

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