Received: from list by lists.gnu.org with archive (Exim 4.90_1) id 1iFqtL-0006W1-5I for mharc-grub-devel@gnu.org; Wed, 02 Oct 2019 22:30:55 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:39729) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iFqtH-0006Vi-Pd for grub-devel@gnu.org; Wed, 02 Oct 2019 22:30:53 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iFqtF-0006XS-Ow for grub-devel@gnu.org; Wed, 02 Oct 2019 22:30:51 -0400 Received: from mail-qt1-x844.google.com ([2607:f8b0:4864:20::844]:36890) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1iFqtF-0006X3-IX for grub-devel@gnu.org; Wed, 02 Oct 2019 22:30:49 -0400 Received: by mail-qt1-x844.google.com with SMTP id l3so1513439qtr.4 for ; Wed, 02 Oct 2019 19:30:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=i6DLNNAFwlllkuRhrOZtMIKwFj2McCIFShDYt1jYwXU=; b=RJFJoSSt7llpZ0FqJd5qL2OPomxR0n/PEudZQfqxM2QxjpQx8zc7Yy8cuGhM5MxyjR f0jinkiziB0podnAr9GnM7u5xH089peBKRyUpdKP3ez5+OO8C+pzZqSfX1RPPaTj6mgZ pq1HVDXmN8d/WncvgGMCNkVVKskFhzBHhQT6fN/Pk94qP6I8NrfqEADezeKdoRgCebgJ QLGaaLkf7xJyLgel9t81yWu5yIQNiyPQCLOttaSdJ2r0bzKq4HLfo0Ku2VevvI2AoZDN 2flpMtbNstQiPN+RmmJTZfKlJ/o2TgMFXeg6DTyR312OysoRXt/SaErGsWPyWD5pYVY4 0dlw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=i6DLNNAFwlllkuRhrOZtMIKwFj2McCIFShDYt1jYwXU=; b=FCTqh75/N3mtgbnT9/HbazfnjIKetNsL1zB+HdqkocPl8uf4uWiMtWi2vaUT0odE3/ 5Mj0cZfIxbTRUJlsWHZ2uUnGdff6OJAzHkY6kU41YTa3VzrLoUgIOIlANkUOhM4Nx1xh Xngny0GKeGqSxJ+661chL2iQ2bPHEdtEneVr5rswVcSVCpcakihKhkD0DKQO5jiuBAsP P1JuDyi6PCO9cbyREzDCCcBzAfN+bN3KjeFFrunpdp3q4ZGpI0BMj9jwE3JYCuqgVcwX i0M9l3bA+3Wd3NVNIqxhRayrOybOKt02JW/Hk+m7k2JE/8OEEgMZiYPc8lHWaVvzbBFR s4kQ== X-Gm-Message-State: APjAAAU23volVGlVZcEUetXPYjfWRc6VwZboVEir2kIjx+ExPi15ahFR j0PEhjphcHowYqjGrlNXRy0= X-Google-Smtp-Source: APXvYqwpdcrEwgqVlFwhn2Qe5oz0HzlVc8o0STdiQpgGpFk2FyZ9s3HuLRA+faiBbIuTSqWqOgbD5g== X-Received: by 2002:ac8:554a:: with SMTP id o10mr8066999qtr.0.1570069847587; Wed, 02 Oct 2019 19:30:47 -0700 (PDT) Received: from ?IPv6:2606:a000:111d:3fe:6cd4:66eb:afaa:1c9c? (cpe-2606-A000-111D-3FE-6CD4-66EB-AFAA-1C9C.dyn6.twc.com. [2606:a000:111d:3fe:6cd4:66eb:afaa:1c9c]) by smtp.gmail.com with ESMTPSA id c185sm543916qkf.122.2019.10.02.19.30.46 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 02 Oct 2019 19:30:46 -0700 (PDT) Subject: Re: [PATCH v2] Add GRUB_DISABLE_UUID To: Daniel Kiper , Javier Martinez Canillas Cc: grub-devel@gnu.org, Peter Jones , Vladimir Serbinenko References: <20190930145912.20375-1-javierm@redhat.com> <20191002120955.5qkvrjqsnpmmwcyy@tomti.i.net-space.pl> From: Nicholas Vinson Message-ID: <85453966-4f9d-39c0-ccb7-310dfd23d537@gmail.com> Date: Wed, 2 Oct 2019 22:29:41 -0400 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.8.0 MIME-Version: 1.0 In-Reply-To: <20191002120955.5qkvrjqsnpmmwcyy@tomti.i.net-space.pl> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:4864:20::844 X-BeenThere: grub-devel@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: The development of GNU GRUB List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 03 Oct 2019 02:30:53 -0000 On 10/2/19 08:09, Daniel Kiper wrote: > Adding Nicholas... > > On Mon, Sep 30, 2019 at 04:59:12PM +0200, Javier Martinez Canillas wrote: >> From: Peter Jones >> >> The grub-mkconfig and 10_linux scripts by default attempt to use a UUID to >> set the root kernel command line parameter and the $root GRUB environment >> variable. >> >> The former can be disabled by setting the GRUB_DISABLE_LINUX_UUID variable >> to "true", but there is currently no way to disable the latter. >> >> The generated grub config uses the search command with the --fs-uuid option >> to find the device that has to be set as $root, i.e: >> >> search --no-floppy --fs-uuid --set=root ... >> >> This is usually more reliable but in some cases it may not be appropriate, >> so this patch introduces a new GRUB_DISABLE_UUID variable that can be used >> to disable searching for the $root device by filesystem UUID. >> >> When disabled, the $root device will be set to the value specified in the >> device.map as found by the grub-probe --target=compatibility_hint option. >> >> When setting GRUB_DISABLE_UUID=true, the GRUB_DISABLE_LINUX_UUID and >> GRUB_DISABLE_LINUX_PARTUUID variables will also be set to "true" unless >> these have been explicitly set to "false". >> >> That way, the GRUB_DISABLE_UUID variable can be used to force using the >> device names for both GRUB and Linux. >> >> Signed-off-by: Peter Jones >> Signed-off-by: Javier Martinez Canillas > > In general "Reviewed-by: Daniel Kiper " but I would > like to hear Nicholas opinions here too > > Daniel > >> --- >> >> Changes since v1 (suggested by Daniel Kiper): >> >> - Explain better in the commit message why the GRUB_DISABLE_UUID variable >> is needed and the difference with the existing GRUB_DISABLE_LINUX_UUID/ >> GRUB_DISABLE_LINUX_PARTUUID variables. >> - Remove logic that disabled setting the root cmdline param to either the >> filesystem UUID or partition UUID and instead use the existing variables >> to disable this. >> >> docs/grub.texi | 9 +++++++++ >> util/grub-mkconfig.in | 10 ++++++++++ >> util/grub-mkconfig_lib.in | 4 ++-- >> 3 files changed, 21 insertions(+), 2 deletions(-) >> >> diff --git a/docs/grub.texi b/docs/grub.texi >> index 5ac61c09d1b..2fe0e1b83bb 100644 >> --- a/docs/grub.texi >> +++ b/docs/grub.texi >> @@ -1441,6 +1441,15 @@ enable the use of partition UUIDs, set this option to @samp{false}. >> If this option is set to @samp{true}, disable the generation of recovery >> mode menu entries. >> >> +@item GRUB_DISABLE_UUID >> +Normally, @command{grub-mkconfig} will generate menu entries that use >> +universally-unique identifiers (UUIDs) to identify various filesystems to >> +search for files. This is usually more reliable, but in some cases it may >> +not be appropriate. To disable this use of UUIDs, set this option to >> +@samp{true}. Setting this option to @samp{true}, will also set the options >> +@samp{GRUB_DISABLE_LINUX_UUID} and @samp{GRUB_DISABLE_LINUX_PARTUUID} to >> +@samp{true}, unless they have been explicilty set to @samp{false}. >> + >> @item GRUB_VIDEO_BACKEND >> If graphical video support is required, either because the @samp{gfxterm} >> graphical terminal is in use or because @samp{GRUB_GFXPAYLOAD_LINUX} is set, >> diff --git a/util/grub-mkconfig.in b/util/grub-mkconfig.in >> index a6ce375ed18..2537dbca2f9 100644 >> --- a/util/grub-mkconfig.in >> +++ b/util/grub-mkconfig.in >> @@ -158,6 +158,15 @@ if test -f ${sysconfdir}/default/grub ; then >> . ${sysconfdir}/default/grub >> fi >> >> +if [ "x${GRUB_DISABLE_UUID}" = "xtrue" ]; then >> + if [ "x${GRUB_DISABLE_LINUX_UUID}" != "xfalse" ]; then >> + GRUB_DISABLE_LINUX_UUID="true" >> + fi >> + if [ "x${GRUB_DISABLE_LINUX_PARTUUID}" != "xfalse" ]; then >> + GRUB_DISABLE_LINUX_PARTUUID="true" >> + fi >> +fi I don't think this logic is exactly consistent with 51be3372ec8ba07ef68a409956ea0eefa89fe7c5. That commit assumes any value other than 'true' is false. It also sets the default values for GRUB_DISABLE_LINUX_PARTUUID in 10_linux.in and 20_linux_xen.in. Both minor issues, but I do wonder if they should be addressed. Thanks, Nicholas Vinson >> + >> # XXX: should this be deprecated at some point? >> if [ "x${GRUB_TERMINAL}" != "x" ] ; then >> GRUB_TERMINAL_INPUT="${GRUB_TERMINAL}" >> @@ -227,6 +236,7 @@ export GRUB_DEFAULT \ >> GRUB_DISABLE_LINUX_UUID \ >> GRUB_DISABLE_LINUX_PARTUUID \ >> GRUB_DISABLE_RECOVERY \ >> + GRUB_DISABLE_UUID \ >> GRUB_VIDEO_BACKEND \ >> GRUB_GFXMODE \ >> GRUB_BACKGROUND \ >> diff --git a/util/grub-mkconfig_lib.in b/util/grub-mkconfig_lib.in >> index 0f801cab3e4..3e12b2c0e6a 100644 >> --- a/util/grub-mkconfig_lib.in >> +++ b/util/grub-mkconfig_lib.in >> @@ -156,7 +156,7 @@ prepare_grub_to_access_device () >> if [ "x$fs_hint" != x ]; then >> echo "set root='$fs_hint'" >> fi >> - if fs_uuid="`"${grub_probe}" --device $@ --target=fs_uuid 2> /dev/null`" ; then >> + if [ "x${GRUB_DISABLE_UUID}" != "xtrue" ] && fs_uuid="`"${grub_probe}" --device $@ --target=fs_uuid 2> /dev/null`" ; then >> hints="`"${grub_probe}" --device $@ --target=hints_string 2> /dev/null`" || hints= >> echo "if [ x\$feature_platform_search_hint = xy ]; then" >> echo " search --no-floppy --fs-uuid --set=root ${hints} ${fs_uuid}" >> @@ -173,7 +173,7 @@ grub_get_device_id () >> IFS=' >> ' >> device="$1" >> - if fs_uuid="`"${grub_probe}" --device ${device} --target=fs_uuid 2> /dev/null`" ; then >> + if [ "x${GRUB_DISABLE_UUID}" != "xtrue" ] && fs_uuid="`"${grub_probe}" --device ${device} --target=fs_uuid 2> /dev/null`" ; then >> echo "$fs_uuid"; >> else >> echo $device |sed 's, ,_,g' >> -- >> 2.21.0