All of lore.kernel.org
 help / color / mirror / Atom feed
From: Oskari Pirhonen <xxc3ncoredxx@gmail.com>
To: darkpenguin <darkpenguin@posteo.de>
Cc: grub-devel@gnu.org
Subject: Re: [PATCH] Add support for specifying the boot device by label
Date: Sun, 10 Sep 2023 16:12:44 -0500	[thread overview]
Message-ID: <ZP4xTIANFcFcXWvP@dj3ntoo> (raw)
In-Reply-To: <28419e65-2e40-a4a4-b94f-aeacd62715c7@posteo.de>


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

On Sun, Sep 10, 2023 at 09:30:24 +0000, darkpenguin wrote:
> Specifying the boot device by its label rather than its UUID can be
> pretty useful in various situations (e.g. multiple test VMs).
> 
> This might have to be adapted a little to meet the coding standards I'm
> not familiar with. Please feel free to improve it in any way you want.
> 
> This patch works for me on an older version of grub2 (=2.06-13 in Debian
> Bookworm), but it's rather trivial, and only touches two parts that are
> otherwise untouched for ages.
> 
> - Specify "GRUB_DISABLE_LINUX_UUID=LABEL" in /etc/default/grub
> - It will attempt to use a label instead of UUID
> - If a device with the necessary label is not found in
> /dev/disk/by-label/ , it falls back to using UUID
> - If you just assigned new labels, run 'partprobe' to populate
> /dev/disk/by-label/ properly
> 
> The decision to reuse GRUB_DISABLE_LINUX_UUID was because:
> 1) This is more of an addition on top of UUID rather than "disabling"
> it, it still uses UUID internally, and it falls back to UUID
> 2) I could not come up with a better way to do it

I'm not a fan of overloading a "disable" var to mean "try something else
first". Something like GRUB_DISABLE_LINUX_LABEL with the appropriate
logic would make more sense IMO.

> 3) I could not figure out how to source other variables from
> /etc/defaults/grub and why not all of them are there. :)
> 

This looks to be in util/grub-mkconfig.in (lines 160-162 in git master
at the time of writing):

    if test -f ${sysconfdir}/default/grub ; then
      . ${sysconfdir}/default/grub
    fi

The vars then get exported further down (lines 213-258) before running
the various config snippets:

    # These are optional, user-defined variables.
    export GRUB_DEFAULT \
      GRUB_HIDDEN_TIMEOUT \
      GRUB_HIDDEN_TIMEOUT_QUIET \
      GRUB_TIMEOUT \
      GRUB_TIMEOUT_STYLE \
      GRUB_DEFAULT_BUTTON \
    # ... snip ...

Hope that helps.

- Oskari

[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]

[-- Attachment #2: Type: text/plain, Size: 141 bytes --]

_______________________________________________
Grub-devel mailing list
Grub-devel@gnu.org
https://lists.gnu.org/mailman/listinfo/grub-devel

  reply	other threads:[~2023-09-10 21:13 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-09-10  9:30 [PATCH] Add support for specifying the boot device by label darkpenguin
2023-09-10 21:12 ` Oskari Pirhonen [this message]
2023-09-11  6:48   ` darkpenguin
2023-09-12  2:54     ` Oskari Pirhonen
2023-09-12  7:42       ` darkpenguin
2023-09-12 13:02         ` Nicholas Vinson
2023-09-12 15:10           ` darkpenguin
2023-09-10 21:20 ` Vladimir 'phcoder' Serbinenko
2023-09-11  6:28   ` darkpenguin
2023-09-26  7:28   ` darkpenguin
2023-09-27  6:51     ` darkpenguin
2023-09-27 10:16       ` Daniel Kiper
2023-09-27 11:05         ` darkpenguin
2023-09-27 15:22       ` Vladimir 'phcoder' Serbinenko
2023-09-27 15:42         ` darkpenguin
2023-09-27 20:33           ` Vladimir 'phcoder' Serbinenko
2023-09-11 10:44 ` Olaf Hering
2023-09-11 11:15   ` darkpenguin
2023-09-12 12:10     ` Nicholas Vinson
2023-09-12 14:17       ` darkpenguin
2023-09-12 19:06     ` Vladimir 'phcoder' Serbinenko

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=ZP4xTIANFcFcXWvP@dj3ntoo \
    --to=xxc3ncoredxx@gmail.com \
    --cc=darkpenguin@posteo.de \
    --cc=grub-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.