From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from list by lists.gnu.org with archive (Exim 4.71) id 1QgMyl-0000uP-Sq for mharc-grub-devel@gnu.org; Mon, 11 Jul 2011 16:21:20 -0400 Received: from eggs.gnu.org ([140.186.70.92]:40803) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QgMyf-0000tK-Lk for grub-devel@gnu.org; Mon, 11 Jul 2011 16:21:17 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1QgMya-0003vz-DV for grub-devel@gnu.org; Mon, 11 Jul 2011 16:21:12 -0400 Received: from mailout-de.gmx.net ([213.165.64.22]:36316) by eggs.gnu.org with smtp (Exim 4.71) (envelope-from ) id 1QgMyZ-0003vY-D6 for grub-devel@gnu.org; Mon, 11 Jul 2011 16:21:08 -0400 Received: (qmail invoked by alias); 11 Jul 2011 20:21:04 -0000 Received: from p54952B47.dip.t-dialin.net (EHLO [192.168.1.20]) [84.149.43.71] by mail.gmx.net (mp026) with SMTP; 11 Jul 2011 22:21:04 +0200 X-Authenticated: #1002206 X-Provags-ID: V01U2FsdGVkX1/CPeloz+DCfVvmP3ujGPZWPGLpKq2CWuXREk9YG+ U9EzQxCLgioCrM Message-ID: <4E1B5B2E.3060100@gmx.de> Date: Mon, 11 Jul 2011 22:21:02 +0200 From: Axel Kellermann User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.17) Gecko/20110516 Thunderbird/3.1.10 MIME-Version: 1.0 To: The development of GNU GRUB Subject: Re: [PATCH] Skip partitions during OS probing References: <4E18CB86.8040806@gmx.de> <4E1B1333.6050505@cfl.rr.com> <4E1B1D09.9030703@gmx.de> <20110711182539.GO7143@caffeine.csclub.uwaterloo.ca> In-Reply-To: <20110711182539.GO7143@caffeine.csclub.uwaterloo.ca> X-Enigmail-Version: 1.1.2 Content-Type: multipart/mixed; boundary="------------060300050706020301030300" X-Y-GMX-Trusted: 0 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 213.165.64.22 Cc: Phillip Susi , Lennart Sorensen X-BeenThere: grub-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list Reply-To: The development of GNU GRUB List-Id: The development of GNU GRUB List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 11 Jul 2011 20:21:18 -0000 This is a multi-part message in MIME format. --------------060300050706020301030300 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit 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. --------------060300050706020301030300 Content-Type: text/x-diff; name="skip_partitions_uuid.patch" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="skip_partitions_uuid.patch" === 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}" --------------060300050706020301030300--