All of lore.kernel.org
 help / color / mirror / Atom feed
From: Axel Kellermann <axel.kellermann@gmx.de>
To: The development of GNU GRUB <grub-devel@gnu.org>
Cc: Phillip Susi <psusi@cfl.rr.com>,
	Lennart Sorensen <lsorense@csclub.uwaterloo.ca>
Subject: Re: [PATCH] Skip partitions during OS probing
Date: Mon, 11 Jul 2011 22:21:02 +0200	[thread overview]
Message-ID: <4E1B5B2E.3060100@gmx.de> (raw)
In-Reply-To: <20110711182539.GO7143@caffeine.csclub.uwaterloo.ca>

[-- Attachment #1: Type: text/plain, Size: 1933 bytes --]

Turns out switching to UUIDs was very simple, grub already provides the
necessary utility function. :)

The new patch is attached.


Thanks,

Axel

On 07/11/2011 08:25 PM, Lennart Sorensen wrote:
> On Mon, Jul 11, 2011 at 05:55:53PM +0200, Axel Kellermann wrote:
>>> Partition numbers tend to get moved around quite frequently, so this
>>> would be a fragile configuration, and require manual entry.  It would be
>> Good point. I guess the proposed solution works well with internal HDDs,
>> as they tend to always get the same device names during system
>> initialization (at least I never observed different behaviour on my
>> machine), but could be fragile for external drives.
> 
> I have observed it on internal drives.  If you have two controllers with
> different drivers and disks on both then there is no predicting which
> driver will load and initiallize first in some cases.  Switching to UUIDs
> made the box much more reliable to boot (it was a 50/50 chance it would
> boot with the disks in the "right" order and work).
> 
>>> better to automatically notice that the partition is a Win7 system
>> I agree. But I guess on my machine it is not really grubs fault that the
>> Win7 system partition is marked as bootable. I only have one of those
>> Win7 licenses that come with recovery media, so I'm not able to do a
>> manual, clean install and it seems the recovery installation always
>> makes the system partition bootable. I'm probably not the only one
>> experiencing this kind of faulty setup...
>>
>>> partition, and ignore it.  If you must explicitly exclude manually
>>> chosen partitions, they should be specified by UUID.
>> I guess we could work with UUIDs instead of partition names, but it also
>> turns this little patch into something a bit more complicated. I'd be
>> happy to look into it, but we should first decide if we really cover a
>> use-case here or if the whole thing isn't worth the effort.

[-- Attachment #2: skip_partitions_uuid.patch --]
[-- Type: text/x-diff, Size: 1043 bytes --]

=== modified file 'util/grub-mkconfig.in'
--- old/util/grub-mkconfig.in	2011-07-07 21:52:58 +0000
+++ new/util/grub-mkconfig.in	2011-07-09 21:08:25 +0000
@@ -257,7 +257,8 @@
   GRUB_INIT_TUNE \
   GRUB_SAVEDEFAULT \
   GRUB_ENABLE_CRYPTODISK \
-  GRUB_BADRAM
+  GRUB_BADRAM \
+  GRUB_SKIP_PARTITIONS
 
 if test "x${grub_cfg}" != "x"; then
   rm -f ${grub_cfg}.new

=== modified file 'util/grub.d/30_os-prober.in'
--- old/util/grub.d/30_os-prober.in	2011-07-02 19:22:19 +0000
+++ new/util/grub.d/30_os-prober.in	2011-07-11 20:13:04 +0000
@@ -94,6 +94,12 @@
   LONGNAME="`echo ${OS} | cut -d ':' -f 2 | tr '^' ' '`"
   LABEL="`echo ${OS} | cut -d ':' -f 3 | tr '^' ' '`"
   BOOT="`echo ${OS} | cut -d ':' -f 4`"
+  UUID="`grub-probe --target=fs_uuid --device ${DEVICE}`"
+
+  if [ "x${GRUB_SKIP_PARTITIONS}" != "x" -a "x`echo ${GRUB_SKIP_PARTITIONS} | grep -i -e '\b'${UUID}'\b'`" != "x" ] ; then
+    echo "Skipped ${LONGNAME} on ${DEVICE} by user request." >&2
+    continue
+  fi
 
   if [ -z "${LONGNAME}" ] ; then
     LONGNAME="${LABEL}"


  reply	other threads:[~2011-07-11 20:21 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-07-09 21:43 [PATCH] Skip partitions during OS probing Axel Kellermann
2011-07-11 15:13 ` Phillip Susi
2011-07-11 15:55   ` Axel Kellermann
2011-07-11 18:25     ` Lennart Sorensen
2011-07-11 20:21       ` Axel Kellermann [this message]
2011-07-11 20:21     ` Phillip Susi
2011-07-18 18:06       ` Axel Kellermann

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=4E1B5B2E.3060100@gmx.de \
    --to=axel.kellermann@gmx.de \
    --cc=grub-devel@gnu.org \
    --cc=lsorense@csclub.uwaterloo.ca \
    --cc=psusi@cfl.rr.com \
    /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.