Received: from list by lists.gnu.org with archive (Exim 4.90_1) id 1mPAWP-00089W-QD for mharc-grub-devel@gnu.org; Sat, 11 Sep 2021 17:26:49 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:36620) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mPAWO-00089N-2q for grub-devel@gnu.org; Sat, 11 Sep 2021 17:26:48 -0400 Received: from pricom.com.au ([14.202.193.218]:37335) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mPAWK-0007NV-NQ for grub-devel@gnu.org; Sat, 11 Sep 2021 17:26:47 -0400 DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d=pricom.com.au; s=phr1; h=MIME-Version:Content-Type: Content-Transfer-Encoding:Date:From:To:Cc:Subject:Reply-To: In-Reply-To:References:User-Agent:Message-ID; bh=6PgqxAgCIwJNmis 0H5o846cQlwY=; b=GQwGJbIn/7EsiePKHGBvRI6spN58ry9ny/G+e09L1Vo4ULa BqbTlPyuTPbyjcWLiK2kGJ7YWI0+311DT/Xy4yzRctT0y6Uvuu1r6px0MZCLQGza AG71g0lSIg9DWp4A9FlsO7nt+vcKH2LmCAvb/Noua7KlfKhIqPUzuRZMDkUo= Received: (indimail-mta 10205 invoked from 127.0.0.1 by host pricom.com.au by uid 555); Sun, 12 Sep 2021 07:26:22 +1000 DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d=pricom.com.au; s=phr1; x=1632000382; h=MIME-Version: Content-Type:Content-Transfer-Encoding:Date:From:To:Cc:Subject: Reply-To:In-Reply-To:References:User-Agent:Message-ID; bh=6PgqxA gCIwJNmis0H5o846cQlwY=; b=RBIAy38x/+je7SutFRwxny8MOG2qTVTVAwaRd1 jgwTmckEjOK5wd9cAf1W+KYU9LUNe8rQ0yM9N3IwFHrNubw395rSlmhGWsJ+prCD j7umBWbmGWC/xUT9KLWBv8IKsldZfg/1MnDNqYiG4tNyV0ZhCufCyl5XChG/8bM/ Rd6+c= Received: from localhost (HELO pricom.com.au) (phr@::ffff:127.0.0.1) by 0 with ESMTPA; Sun, 12 Sep 2021 07:26:22 +1000 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Date: Sun, 12 Sep 2021 07:26:11 +1000 From: Philip Rhoades To: The development of GNU GRUB Cc: Chris Vogel Subject: Re: feature request + patch: GRUB_CMDLINE_LINUX_RECOVERY Reply-To: phil@pricom.com.au In-Reply-To: <74262b12-87e5-db01-4a82-59f16a3bc197@z9.de> References: <74262b12-87e5-db01-4a82-59f16a3bc197@z9.de> User-Agent: Roundcube Webmail/1.4-rc1 Message-ID: X-Sender: phil@pricom.com.au Received-SPF: pass client-ip=14.202.193.218; envelope-from=phil@pricom.com.au; helo=pricom.com.au X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action 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: Sat, 11 Sep 2021 21:26:48 -0000 +1 On 2021-09-12 03:23, Chris Vogel wrote: > Hi, > > I'd like to propose a patch to add a configuration parameter called > GRUB_CMDLINE_LINUX_RECOVERY. > > All credits for the initial idea and first implementation (as far as I > know) go to Kyle Rankin at Purism. I used his improvement without > being aware that it is not a standard feature inluded in original > grub. His implementation can be found here > https://source.puri.sm/pureos/packages/smartcard-key-luks. > > There are situations when it would be helpfull to be able to set > command line options to use only when generating a recovery entry for > grub.cfg, e.g. > > - when using systemd starting a debug shell using "systemd.debug-shell" > - when using luks disk encryption as shown in the work of Kyle > > The inclusion of GRUB_CMDLINE_LINUX_RECOVERY as in the patch below > shouldn't change the behaviour of grub at all if not used in a > configuration. Users not setting the variable shouldn't see any > difference. > > Chris > > > diff --git a/docs/grub.texi b/docs/grub.texi > index f8b4b3b21..8b5482ee1 100644 > --- a/docs/grub.texi > +++ b/docs/grub.texi > @@ -1411,6 +1411,14 @@ entry for recovery mode. This option lists > command-line arguments to add > only to the default menu entry, after those listed in > @samp{GRUB_CMDLINE_LINUX}. > > +@item GRUB_CMDLINE_LINUX_RECOVERY > +Unless @samp{GRUB_DISABLE_RECOVERY} is set to @samp{true}, two menu > +entries will be generated for each Linux kernel: one default entry and > one > +entry for recovery mode. > +This option lists command-line arguments to add only to the recovery > menu > +entry, before those listed in @samp{GRUB_CMDLINE_LINUX}. > +The default is @samp{single}. > + > @item GRUB_CMDLINE_NETBSD > @itemx GRUB_CMDLINE_NETBSD_DEFAULT > As @samp{GRUB_CMDLINE_LINUX} and @samp{GRUB_CMDLINE_LINUX_DEFAULT}, > but for > diff --git a/util/grub-mkconfig.in b/util/grub-mkconfig.in > index f8cbb8d7a..c3ea7612e 100644 > --- a/util/grub-mkconfig.in > +++ b/util/grub-mkconfig.in > @@ -225,6 +225,7 @@ export GRUB_DEFAULT \ > GRUB_DISTRIBUTOR \ > GRUB_CMDLINE_LINUX \ > GRUB_CMDLINE_LINUX_DEFAULT \ > + GRUB_CMDLINE_LINUX_RECOVERY \ > GRUB_CMDLINE_XEN \ > GRUB_CMDLINE_XEN_DEFAULT \ > GRUB_CMDLINE_LINUX_XEN_REPLACE \ > diff --git a/util/grub.d/10_linux.in b/util/grub.d/10_linux.in > index e8b01c0d0..af51ae2f7 100644 > --- a/util/grub.d/10_linux.in > +++ b/util/grub.d/10_linux.in > @@ -43,6 +43,10 @@ case ${GRUB_DEVICE} in > ;; > esac > > +if [ "x${GRUB_CMDLINE_LINUX_RECOVERY}" = "x" ] ; then > + GRUB_CMDLINE_LINUX_RECOVERY='single' > +fi > + > # Default to disabling partition uuid support to maintian > compatibility with > # older kernels. > GRUB_DISABLE_LINUX_PARTUUID=${GRUB_DISABLE_LINUX_PARTUUID-true} > @@ -287,7 +291,7 @@ while [ "x$list" != "x" ] ; do > "${GRUB_CMDLINE_LINUX} ${GRUB_CMDLINE_LINUX_DEFAULT}" > if [ "x${GRUB_DISABLE_RECOVERY}" != "xtrue" ]; then > linux_entry "${OS}" "${version}" recovery \ > - "single ${GRUB_CMDLINE_LINUX}" > + "${GRUB_CMDLINE_LINUX_RECOVERY} ${GRUB_CMDLINE_LINUX}" > fi > > list=`echo $list | tr ' ' '\n' | fgrep -vx "$linux" | tr '\n' ' '` > diff --git a/util/grub.d/20_linux_xen.in b/util/grub.d/20_linux_xen.in > index 3b1f47049..992363c3e 100644 > --- a/util/grub.d/20_linux_xen.in > +++ b/util/grub.d/20_linux_xen.in > @@ -43,6 +43,10 @@ case ${GRUB_DEVICE} in > ;; > esac > > +if [ "x${GRUB_CMDLINE_LINUX_RECOVERY}" = "x" ] ; then > + GRUB_CMDLINE_LINUX_RECOVERY='single' > +fi > + > # Default to disabling partition uuid support to maintian > compatibility with > # older kernels. > GRUB_DISABLE_LINUX_PARTUUID=${GRUB_DISABLE_LINUX_PARTUUID-true} > @@ -343,7 +347,7 @@ while [ "x${xen_list}" != "x" ] ; do > "${GRUB_CMDLINE_LINUX} ${GRUB_CMDLINE_LINUX_DEFAULT}" > "${GRUB_CMDLINE_XEN} ${GRUB_CMDLINE_XEN_DEFAULT}" > if [ "x${GRUB_DISABLE_RECOVERY}" != "xtrue" ]; then > linux_entry "${OS}" "${version}" "${xen_version}" recovery \ > - "single ${GRUB_CMDLINE_LINUX}" "${GRUB_CMDLINE_XEN}" > + "${GRUB_CMDLINE_LINUX_RECOVERY} ${GRUB_CMDLINE_LINUX}" > "${GRUB_CMDLINE_XEN}" > fi > > list=`echo $list | tr ' ' '\n' | fgrep -vx "$linux" | tr '\n' ' '` > > _______________________________________________ > Grub-devel mailing list > Grub-devel@gnu.org > https://lists.gnu.org/mailman/listinfo/grub-devel -- Philip Rhoades PO Box 896 Cowra NSW 2794 Australia E-mail: phil@pricom.com.au