Mailing List Archive

Exact setting in grub to default to a kernel by name?
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
Re: Exact setting in grub to default to a kernel by name? [ In reply to ]
>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
Re: Exact setting in grub to default to a kernel by name? [ In reply to ]
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.
Re: Exact setting in grub to default to a kernel by name? [ In reply to ]
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.
Re: Exact setting in grub to default to a kernel by name? [ In reply to ]
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
Re: Exact setting in grub to default to a kernel by name? [ In reply to ]
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
Re: Exact setting in grub to default to a kernel by name? [ In reply to ]
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.
Re: Exact setting in grub to default to a kernel by name? [ In reply to ]
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
Re: Exact setting in grub to default to a kernel by name? [ In reply to ]
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
Re: Exact setting in grub to default to a kernel by name? [ In reply to ]
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
Re: Re: Exact setting in grub to default to a kernel by name? [ In reply to ]
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
Re: Re: Exact setting in grub to default to a kernel by name? [ In reply to ]
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.
Re: Exact setting in grub to default to a kernel by name? [ In reply to ]
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.
Re: Re: Exact setting in grub to default to a kernel by name? [ In reply to ]
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
Re: Re: Exact setting in grub to default to a kernel by name? [ In reply to ]
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
Re: Exact setting in grub to default to a kernel by name? [ In reply to ]
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.
Re: Exact setting in grub to default to a kernel by name? [ In reply to ]
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
}
========================================================================
Re: Re: Exact setting in grub to default to a kernel by name? [ In reply to ]
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.
Re: Re: Exact setting in grub to default to a kernel by name? [ In reply to ]
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
Re: Re: Exact setting in grub to default to a kernel by name? [ In reply to ]
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.