Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.debian.user > #247393 > unrolled thread

Grub question

Started byRichard Owlett <rcowlett@cloud85.net>
First post2022-04-20 21:50 +0200
Last post2022-04-22 00:30 +0200
Articles 8 — 6 participants

Back to article view | Back to linux.debian.user


Contents

  Grub question Richard Owlett <rcowlett@cloud85.net> - 2022-04-20 21:50 +0200
    Re: Grub question "Andrew M.A. Cater" <amacater@einval.com> - 2022-04-20 22:20 +0200
      Re: Grub question David Wright <deblis@lionunicorn.co.uk> - 2022-04-21 00:50 +0200
        Re: Grub question Richard Owlett <rcowlett@cloud85.net> - 2022-04-21 12:50 +0200
          Re: Grub question Tixy <tixy@yxit.co.uk> - 2022-04-21 13:50 +0200
          Re: Grub question Brian <ad44@cityscape.co.uk> - 2022-04-21 17:20 +0200
          Re: Grub question David Wright <deblis@lionunicorn.co.uk> - 2022-04-21 19:30 +0200
            Re: Grub question Felix Miata <mrmazda@earthlink.net> - 2022-04-22 00:30 +0200

#247393 — Grub question

FromRichard Owlett <rcowlett@cloud85.net>
Date2022-04-20 21:50 +0200
SubjectGrub question
Message-ID<EeouR-a43U-1@gated-at.bofh.it>
I have a machine set aside to test several configurations of Debian 11.

Is there away to have the Grub Menu _automatically_ display the assigned 
partition name rather than than /dev/sdaN ?

[toc] | [next] | [standalone]


#247394

From"Andrew M.A. Cater" <amacater@einval.com>
Date2022-04-20 22:20 +0200
Message-ID<EeoXU-a4sO-7@gated-at.bofh.it>
In reply to#247393
On Wed, Apr 20, 2022 at 02:31:30PM -0500, Richard Owlett wrote:
> I have a machine set aside to test several configurations of Debian 11.
> 
> Is there away to have the Grub Menu _automatically_ display the assigned
> partition name rather than than /dev/sdaN ?
>

I wonder whether this changes if you use labels as references?

To be honest, I never notice - it's a menu which says Debian and a couple
of other options and I jut hit [Enter] almost automatically :)

All the very best, as ever,

Andy Cater 

[toc] | [prev] | [next] | [standalone]


#247400

FromDavid Wright <deblis@lionunicorn.co.uk>
Date2022-04-21 00:50 +0200
Message-ID<Eerj3-a5L4-3@gated-at.bofh.it>
In reply to#247394
On Wed 20 Apr 2022 at 20:09:54 (+0000), Andrew M.A. Cater wrote:
> On Wed, Apr 20, 2022 at 02:31:30PM -0500, Richard Owlett wrote:
> > I have a machine set aside to test several configurations of Debian 11.
> > 
> > Is there away to have the Grub Menu _automatically_ display the assigned
> > partition name rather than than /dev/sdaN ?
> 
> I wonder whether this changes if you use labels as references?

I'm not sure quite what you mean by "as references".

> To be honest, I never notice - it's a menu which says Debian and a couple
> of other options and I jut hit [Enter] almost automatically :)

If by "assigned partition name" the OP means either of LABEL or
PARTLABEL, then I think the answer is no. Grub itself, of course,
supports their use, but not the scripts that generate grub.cfg.

If you allow grub-mkconfig to use UUIDs (the default), then
it's relatively straightforward to script their conversion
to LABELS, using the information in /run/udev/data/b* to
build a conversion table. Just remember that you have to
pair each change with the option names, --fs-uuid → --label.

That probably falls outside the OP's definition of _automatically_
displaying them.

Cheers,
David.

[toc] | [prev] | [next] | [standalone]


#247412

FromRichard Owlett <rcowlett@cloud85.net>
Date2022-04-21 12:50 +0200
Message-ID<EeCxP-acLW-5@gated-at.bofh.it>
In reply to#247400
On 04/20/2022 05:44 PM, David Wright wrote:
> On Wed 20 Apr 2022 at 20:09:54 (+0000), Andrew M.A. Cater wrote:
>> On Wed, Apr 20, 2022 at 02:31:30PM -0500, Richard Owlett wrote:
>>> I have a machine set aside to test several configurations of Debian 11.
>>>
>>> Is there away to have the Grub Menu _automatically_ display the assigned
>>> partition name rather than than /dev/sdaN ?
>>
>> I wonder whether this changes if you use labels as references?
> 
> I'm not sure quite what you mean by "as references".
> 
>> To be honest, I never notice - it's a menu which says Debian and a couple
>> of other options and I jut hit [Enter] almost automatically :)
> 
> If by "assigned partition name" the OP means either of LABEL or
> PARTLABEL, then I think the answer is no.

When creating a partition with Gparted the is a box titled "Label:".
I was referring to the content placed there.

> Grub itself, of course,
> supports their use, but not the scripts that generate grub.cfg.

IIRC several years ago I was told I could manually edit to display as 
desired. It would be overwritten the next time update-grub was run.

> 
> If you allow grub-mkconfig to use UUIDs (the default), then
> it's relatively straightforward to script their conversion
> to LABELS, using the information in /run/udev/data/b* to
> build a conversion table. Just remember that you have to
> pair each change with the option names, --fs-uuid → --label.
> 
> That probably falls outside the OP's definition of _automatically_
> displaying them.

It's outside of my ideal dream. My desired result should be achievable 
with a batch file calling update-grub and then using a routine to do the 
process in the paragraph above. 'Bout time I brushed up on batch file 
prep ;}

Recommended reading that I wouldn't immediately find with DuckDuckGo?
Thanks.

> 
> Cheers,
> David.
> 
> 
> 

[toc] | [prev] | [next] | [standalone]


#247414

FromTixy <tixy@yxit.co.uk>
Date2022-04-21 13:50 +0200
Message-ID<EeDtU-adjF-1@gated-at.bofh.it>
In reply to#247412
On Thu, 2022-04-21 at 05:30 -0500, Richard Owlett wrote:
> On 04/20/2022 05:44 PM, David Wright wrote:
> > On Wed 20 Apr 2022 at 20:09:54 (+0000), Andrew M.A. Cater wrote:
> > > On Wed, Apr 20, 2022 at 02:31:30PM -0500, Richard Owlett wrote:
> > > > I have a machine set aside to test several configurations of Debian 11.
> > > > 
> > > > Is there away to have the Grub Menu _automatically_ display the assigned
> > > > partition name rather than than /dev/sdaN ?
> > > 
> > > I wonder whether this changes if you use labels as references?
> > 
> > I'm not sure quite what you mean by "as references".
> > 
> > > To be honest, I never notice - it's a menu which says Debian and a couple
> > > of other options and I jut hit [Enter] almost automatically :)
> > 
> > If by "assigned partition name" the OP means either of LABEL or
> > PARTLABEL, then I think the answer is no.
> 
> When creating a partition with Gparted the is a box titled "Label:".
> I was referring to the content placed there.

To help people who don't use gparted: that looks like it's the label
for the filesystem to be created in the partition, because there is a
separate box for 'Partition name'.

-- 
Tixy

[toc] | [prev] | [next] | [standalone]


#247424

FromBrian <ad44@cityscape.co.uk>
Date2022-04-21 17:20 +0200
Message-ID<EeGL8-afmx-27@gated-at.bofh.it>
In reply to#247412
On Thu 21 Apr 2022 at 05:30:31 -0500, Richard Owlett wrote:

> On 04/20/2022 05:44 PM, David Wright wrote:
> > On Wed 20 Apr 2022 at 20:09:54 (+0000), Andrew M.A. Cater wrote:
> > > On Wed, Apr 20, 2022 at 02:31:30PM -0500, Richard Owlett wrote:
> > > > I have a machine set aside to test several configurations of Debian 11.
> > > > 
> > > > Is there away to have the Grub Menu _automatically_ display the assigned
> > > > partition name rather than than /dev/sdaN ?
> > > 
> > > I wonder whether this changes if you use labels as references?
> > 
> > I'm not sure quite what you mean by "as references".
> > 
> > > To be honest, I never notice - it's a menu which says Debian and a couple
> > > of other options and I jut hit [Enter] almost automatically :)
> > 
> > If by "assigned partition name" the OP means either of LABEL or
> > PARTLABEL, then I think the answer is no.
> 
> When creating a partition with Gparted the is a box titled "Label:".
> I was referring to the content placed there.
> 
> > Grub itself, of course,
> > supports their use, but not the scripts that generate grub.cfg.
> 
> IIRC several years ago I was told I could manually edit to display as
> desired. It would be overwritten the next time update-grub was run.
> 
> > 
> > If you allow grub-mkconfig to use UUIDs (the default), then
> > it's relatively straightforward to script their conversion
> > to LABELS, using the information in /run/udev/data/b* to
> > build a conversion table. Just remember that you have to
> > pair each change with the option names, --fs-uuid → --label.
> > 
> > That probably falls outside the OP's definition of _automatically_
> > displaying them.
> 
> It's outside of my ideal dream. My desired result should be achievable with
> a batch file calling update-grub and then using a routine to do the process
> in the paragraph above. 'Bout time I brushed up on batch file prep ;}

I take it you want to replace (on /dev/sda5) with something like
(on LABEL). How about this?

e2label <device> will enable matching /dev/sda5 and other devices
with a LABEL. Then a script to seach and replace (on /dev/sdaN)
with the corresponding LABEL.

The script could be run from update-grub and update-grub diverted.
This looks like automatic to me.

-- 
Brian.

[toc] | [prev] | [next] | [standalone]


#247432

FromDavid Wright <deblis@lionunicorn.co.uk>
Date2022-04-21 19:30 +0200
Message-ID<EeIMV-agw0-9@gated-at.bofh.it>
In reply to#247412
On Thu 21 Apr 2022 at 05:30:31 (-0500), Richard Owlett wrote:
> On 04/20/2022 05:44 PM, David Wright wrote:
> > On Wed 20 Apr 2022 at 20:09:54 (+0000), Andrew M.A. Cater wrote:
> > > On Wed, Apr 20, 2022 at 02:31:30PM -0500, Richard Owlett wrote:
> > > > I have a machine set aside to test several configurations of Debian 11.
> > > > 
> > > > Is there away to have the Grub Menu _automatically_ display the assigned
> > > > partition name rather than than /dev/sdaN ?
> > > 
> > > I wonder whether this changes if you use labels as references?
> > 
> > I'm not sure quite what you mean by "as references".
> > 
> > > To be honest, I never notice - it's a menu which says Debian and a couple
> > > of other options and I jut hit [Enter] almost automatically :)
> > 
> > If by "assigned partition name" the OP means either of LABEL or
> > PARTLABEL, then I think the answer is no.
> 
> When creating a partition with Gparted the is a box titled "Label:".
> I was referring to the content placed there.

There are lots of partitioners, but only one set of useful names,
those matched by * in /dev/disk/by-*. I let the Grub scripts play
with the UUIDs, and switch over to LABELs when it's done.

> > Grub itself, of course,
> > supports their use, but not the scripts that generate grub.cfg.
> 
> IIRC several years ago I was told I could manually edit to display as
> desired. It would be overwritten the next time update-grub was run.

That's right. So you can change what Grub eventually does when booting
at several levels:

. Press E at the blue screen, and do what you like as it only lasts
  one boot. But remember what it was you did, in case it works.

. Edit grub.cfg, and take some care, but if you screw up, you can
  boot from another entry, and grub-mkconfig will generate a fresh
  copy.

. Edit /etc/default/grub, and take more care as screw-ups are
  more persistent.

. Roll your own.

(I think all that was more for the benefit of mick crane, BTW.)

For using LABELs, the second approach is easiest, as long as you
script it. Kernel and Grub upgrades will create a fresh grub.cfg
which will require rerunning your script.

> > If you allow grub-mkconfig to use UUIDs (the default), then
> > it's relatively straightforward to script their conversion
> > to LABELS, using the information in /run/udev/data/b* to
> > build a conversion table. Just remember that you have to
> > pair each change with the option names, --fs-uuid → --label.
> > 
> > That probably falls outside the OP's definition of _automatically_
> > displaying them.
> 
> It's outside of my ideal dream. My desired result should be achievable
> with a batch file calling update-grub and then using a routine to do
> the process in the paragraph above. 'Bout time I brushed up on batch
> file prep ;}

That's right. My script copies grub.cfg → grub.cfg-uuids and
grub.cfg-edited → grub.cfg-old, then processes grub.cfg →
grub.cfg-edited as described, and copies that back to grub.cfg.

> Recommended reading that I wouldn't immediately find with DuckDuckGo?

That depends on the language you choose for your script. I used shell,
so Greg's pages are invaluable for, eg, bash arrays. You used to
express a preference for TCL at one time.

Cheers,
David.

[toc] | [prev] | [next] | [standalone]


#247442

FromFelix Miata <mrmazda@earthlink.net>
Date2022-04-22 00:30 +0200
Message-ID<EeNtf-ajeU-1@gated-at.bofh.it>
In reply to#247432
David Wright composed on 2022-04-21 12:28 (UTC-0500):

> On Thu 21 Apr 2022 at 05:30:31 (-0500), Richard Owlett wrote:

>> When creating a partition with Gparted the is a box titled "Label:".
>> I was referring to the content placed there.
 
> There are lots of partitioners, but only one set of useful names,
> those matched by * in /dev/disk/by-*. I let the Grub scripts play
> with the UUIDs, and switch over to LABELs when it's done.
 
>> > Grub itself, of course,
>> > supports their use, but not the scripts that generate grub.cfg.
 
>> IIRC several years ago I was told I could manually edit to display as
>> desired. It would be overwritten the next time update-grub was run.
 
> That's right. So you can change what Grub eventually does when booting
> at several levels:
 
> . Press E at the blue screen, and do what you like as it only lasts
>   one boot. But remember what it was you did, in case it works.
 
> . Edit grub.cfg, and take some care, but if you screw up, you can
>   boot from another entry, and grub-mkconfig will generate a fresh
>   copy.
 
> . Edit /etc/default/grub, and take more care as screw-ups are
>   more persistent.
 
> . Roll your own.
 
Roll your own includes using /boot/grub/custom.cfg composed and maintained
exclusively by the sysadmin. This file is never written by the installation
itself. It needs changing only when:

1-Distro is added or removed.
2-Admin wants Distro name in Grub menu to be changed.
3-An applicable volume LABEL is changed.

/boot/grub/custom.cfg is routinely incorporated by Grub into the tail of
/boot/grub/grub.cfg via /etc/grub.d/40_custom and/or 41_custom. If 40_custom and
41_custom are copied by the admin to 06_custom and 07_custom, then Grub
incorporates the content of /boot/grub/custom.cfg before the automatically
generated /boot/grub/grub.cfg entries, putting the custom entries conveniently at
the top of each boot menu.

My current custom.cfg is using 7 lines per menuitem, compared to a more typical
autogenerated entry of about 17 lines. Example:

menuentry "Debian 11 Bullseye on Partition 14" {
	load_video
	set gfxpayload=keep
	search --no-floppy --set=root --hint-baremetal=ahci0,gpt14 --label exampleLabel
	linux	/vmlinuz root=LABEL=exampleLabel noresume mitigations=auto consoleblank=0 
	initrd	/initrd.img
}

Note lack of kernel and initrd versioning. Symlinks to current and previous
kernels and initrds are automatically generated in / on Debian installations.
Thus there's no need for custom.cfg change when kernels are installed or
removed or initrds rebuilt.
-- 
Evolution as taught in public schools is, like religion,
	based on faith, not based on science.

 Team OS/2 ** Reg. Linux User #211409 ** a11y rocks!

Felix Miata

[toc] | [prev] | [standalone]


Back to top | Article view | linux.debian.user


csiph-web