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


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

Customizing Grub menus

Started byRichard Owlett <rowlett@cloud85.net>
First post2021-12-08 13:40 +0100
Last post2021-12-11 05:20 +0100
Articles 8 — 5 participants

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


Contents

  Customizing Grub menus Richard Owlett <rowlett@cloud85.net> - 2021-12-08 13:40 +0100
    Re: Customizing Grub menus Dan Ritter <dsr@randomstring.org> - 2021-12-08 15:50 +0100
      Re: Customizing Grub menus Richard Owlett <rowlett@cloud85.net> - 2021-12-08 16:40 +0100
        Re: Customizing Grub menus songbird <songbird@anthive.com> - 2021-12-08 18:20 +0100
          Re: Customizing Grub menus David Wright <deblis@lionunicorn.co.uk> - 2021-12-09 16:50 +0100
    Clarification Re: Customizing Grub menus Richard Owlett <rowlett@cloud85.net> - 2021-12-09 16:20 +0100
      Re: Clarification Re: Customizing Grub menus Brian <ad44@cityscape.co.uk> - 2021-12-10 11:50 +0100
      Re: Clarification Re: Customizing Grub menus David Wright <deblis@lionunicorn.co.uk> - 2021-12-11 05:20 +0100

#242769 — Customizing Grub menus

FromRichard Owlett <rowlett@cloud85.net>
Date2021-12-08 13:40 +0100
SubjectCustomizing Grub menus
Message-ID<Ds4oN-3Wk-5@gated-at.bofh.it>
I have a machine set aside for experimenting with different 
configurations of Debian. The default Grub2 menu will display OS(with 
version) and partition designation in /dev/sdXY format.

I give all partitions descriptive labels.
I want the Grub menu to display OS and the partition label.
I want it to update appropriately after using update-grub.

Is there an appropriate tool?
TIA

[toc] | [next] | [standalone]


#242775

FromDan Ritter <dsr@randomstring.org>
Date2021-12-08 15:50 +0100
Message-ID<Ds6qC-55t-17@gated-at.bofh.it>
In reply to#242769
Richard Owlett wrote: 
> I have a machine set aside for experimenting with different configurations
> of Debian. The default Grub2 menu will display OS(with version) and
> partition designation in /dev/sdXY format.
> 
> I give all partitions descriptive labels.
> I want the Grub menu to display OS and the partition label.
> I want it to update appropriately after using update-grub.
> 
> Is there an appropriate tool?

You want to read
https://www.gnu.org/software/grub/manual/grub/grub.html#Shell_002dlike-scripting

and make changes to files in /etc/grub.d/ which will then be
applied via update-grub

-dsr-

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


#242778

FromRichard Owlett <rowlett@cloud85.net>
Date2021-12-08 16:40 +0100
Message-ID<Ds7d0-5Ar-3@gated-at.bofh.it>
In reply to#242775
*note* No need for CC:  I'm subscribed

On 12/08/2021 08:29 AM, Dan Ritter wrote:
> Richard Owlett wrote:
>> I have a machine set aside for experimenting with different configurations
>> of Debian. The default Grub2 menu will display OS(with version) and
>> partition designation in /dev/sdXY format.
>>
>> I give all partitions descriptive labels.
>> I want the Grub menu to display OS and the partition label.
>> I want it to update appropriately after using update-grub.
>>
>> Is there an appropriate tool?
> 
> You want to read
> https://www.gnu.org/software/grub/manual/grub/grub.html#Shell_002dlike-scripting
> 
> and make changes to files in /etc/grub.d/ which will then be
> applied via update-grub
> 
> -dsr-
> 
> 

I see no reference for Grub being able to read a partition's label only 
its UUID.

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


#242780

Fromsongbird <songbird@anthive.com>
Date2021-12-08 18:20 +0100
Message-ID<Ds8LM-6AY-7@gated-at.bofh.it>
In reply to#242778
Richard Owlett wrote:
...
> I see no reference for Grub being able to read a partition's label only 
> its UUID.

  i don't use UUIDs (LABELS only) so i do this in /etc/default/grub:

=====
# Uncomment if you don't want GRUB to pass "root=UUID=xxx" parameter to Linux
GRUB_DISABLE_LINUX_UUID=true
=====

  HTH


  songbird

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


#242810

FromDavid Wright <deblis@lionunicorn.co.uk>
Date2021-12-09 16:50 +0100
Message-ID<DstQd-2He-5@gated-at.bofh.it>
In reply to#242780
On Wed 08 Dec 2021 at 12:16:49 (-0500), songbird wrote:
> Richard Owlett wrote:
> ...
> > I see no reference for Grub being able to read a partition's label only 
> > its UUID.
> 
>   i don't use UUIDs (LABELS only) so i do this in /etc/default/grub:
> 
> =====
> # Uncomment if you don't want GRUB to pass "root=UUID=xxx" parameter to Linux
> GRUB_DISABLE_LINUX_UUID=true
> =====
> 
>   HTH

The effect on my system's grub.cfg is to turn all the lines that
looked like:

 linux /boot/vmlinuz-4.19.0-18-amd64 root=UUID=fedcbaff-1234-5678-ab90-ffee88771234 ro quiet

into:

 linux /boot/vmlinuz-4.19.0-18-amd64 root=/dev/sda4 ro quiet

and I don't see how that helps your using LABELs. (The last thing
I want is the kernel's "randomly" chosen device names.)

Or does this mean that the functionality for handling LABELs has been
added to the scripts in /etc/grub.d/, in which case I would be
questioning why it wasn't activated with:

  GRUB_ENABLE_LINUX_LABEL=true

rather than:

  GRUB_DISABLE_LINUX_UUID=true

Cheers,
David.

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


#242806 — Clarification Re: Customizing Grub menus

FromRichard Owlett <rowlett@cloud85.net>
Date2021-12-09 16:20 +0100
SubjectClarification Re: Customizing Grub menus
Message-ID<Dstnb-2xN-5@gated-at.bofh.it>
In reply to#242769
On 12/08/2021 06:33 AM, Richard Owlett wrote:
> I have a machine set aside for experimenting with different 
> configurations of Debian. The default Grub2 menu will display OS(with 
> version) and partition designation in /dev/sdXY format.
> 
> I give all partitions descriptive labels.
> I want the Grub menu to display OS and the partition label.
> I want it to update appropriately after using update-grub.
> 
> Is there an appropriate tool?
> TIA
>

Received answers did not seem to answer my question.
That suggests a unclear question ;}

On my test system partition labels are:
   /dev/sda7	full-10
   /dev/sda9	minimal-11

Default Grub menu after install of buster reads:
   Debian GNU/Linux 10 (buster) (on /dev/sda7)

I wish it to read:
   Debian GNU/Linux 10 (buster) (full-10)

After installing bullseye and running update-grub without any manual 
intervention, I wish appropriate lines to read:
   Debian GNU/Linux 10 (buster) (full-10)
   Debian GNU/Linux 10 (bullseye) (minimal-11)

Possible?
If so, how?
TIA

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


#242890 — Re: Clarification Re: Customizing Grub menus

FromBrian <ad44@cityscape.co.uk>
Date2021-12-10 11:50 +0100
SubjectRe: Clarification Re: Customizing Grub menus
Message-ID<DsLDs-5kE-13@gated-at.bofh.it>
In reply to#242806
On Thu 09 Dec 2021 at 09:09:42 -0600, Richard Owlett wrote:

> On 12/08/2021 06:33 AM, Richard Owlett wrote:
> > I have a machine set aside for experimenting with different
> > configurations of Debian. The default Grub2 menu will display OS(with
> > version) and partition designation in /dev/sdXY format.
> > 
> > I give all partitions descriptive labels.
> > I want the Grub menu to display OS and the partition label.
> > I want it to update appropriately after using update-grub.
> > 
> > Is there an appropriate tool?
> > TIA
> > 
> 
> Received answers did not seem to answer my question.
> That suggests a unclear question ;}
> 
> On my test system partition labels are:
>   /dev/sda7	full-10
>   /dev/sda9	minimal-11
> 
> Default Grub menu after install of buster reads:
>   Debian GNU/Linux 10 (buster) (on /dev/sda7)
> 
> I wish it to read:
>   Debian GNU/Linux 10 (buster) (full-10)
> 
> After installing bullseye and running update-grub without any manual
> intervention, I wish appropriate lines to read:
>   Debian GNU/Linux 10 (buster) (full-10)
>   Debian GNU/Linux 10 (bullseye) (minimal-11)
> 
> Possible?
> If so, how?

Devise a script to replace "root=..." in grub.cfg. Run the script from
/usr/sbin/update-grub.

-- 
Brian.

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


#242942 — Re: Clarification Re: Customizing Grub menus

FromDavid Wright <deblis@lionunicorn.co.uk>
Date2021-12-11 05:20 +0100
SubjectRe: Clarification Re: Customizing Grub menus
Message-ID<Dt21A-75n-7@gated-at.bofh.it>
In reply to#242806
On Thu 09 Dec 2021 at 09:09:42 (-0600), Richard Owlett wrote:
> On 12/08/2021 06:33 AM, Richard Owlett wrote:
> > I have a machine set aside for experimenting with different
> > configurations of Debian. The default Grub2 menu will display
> > OS(with version) and partition designation in /dev/sdXY format.
> > 
> > I give all partitions descriptive labels.
> > I want the Grub menu to display OS and the partition label.
> > I want it to update appropriately after using update-grub.
> > 
> > Is there an appropriate tool?
> > TIA
> > 
> 
> Received answers did not seem to answer my question.
> That suggests a unclear question ;}
> 
> On my test system partition labels are:
>   /dev/sda7	full-10
>   /dev/sda9	minimal-11
> 
> Default Grub menu after install of buster reads:
>   Debian GNU/Linux 10 (buster) (on /dev/sda7)

I would recommend you use UUID rather than kernel names.
You get the syntactic sugar (like --fs-uuid, which you
replace with --label), and you don't have to change
anything if you fit an SSD in place of spinning rust.

> I wish it to read:
>   Debian GNU/Linux 10 (buster) (full-10)
> 
> After installing bullseye and running update-grub without any manual
> intervention, I wish appropriate lines to read:
>   Debian GNU/Linux 10 (buster) (full-10)
>   Debian GNU/Linux 10 (bullseye) (minimal-11)
> 
> Possible?

Yes, though you have a little scripting to do.

> If so, how?

First, you run lsblk -o UUID,LABEL (or lsblk -lo NAME,LABEL
if you insist), extracting the values to make a lookup
table UUID/NAME → LABEL.

Then you read the grub.cfg that's just been generated and,
for each menuentry, pick up the UUID from $menuentry_id_option
at the end of the line, and insert the corresponding LABEL
before the second quote at the beginning of the line.

While you're about it, you could modify the root=UUID=…
values, and also the --fs-uuid --set=root …, if you like.
You could also do some tidying up, as the file is stuffed
with code that you probably don't use or need.

How to avoid manual intervention: either you drop your
script into /etc/grub.d/ with a higher number than the
rest, or you insert the update-grub command at the beginning
of your script. (The latter is closer to my own method.)

Cheers,
David.

[toc] | [prev] | [standalone]


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


csiph-web