From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1MWulW-00011i-Hq for mharc-grub-devel@gnu.org; Fri, 31 Jul 2009 12:15:30 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1MWulU-00010p-P1 for grub-devel@gnu.org; Fri, 31 Jul 2009 12:15:28 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1MWulQ-0000xI-TC for grub-devel@gnu.org; Fri, 31 Jul 2009 12:15:28 -0400 Received: from [199.232.76.173] (port=47389 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MWulQ-0000x6-A8 for grub-devel@gnu.org; Fri, 31 Jul 2009 12:15:24 -0400 Received: from xvm-190-8.ghst.net ([217.70.190.8]:43806 helo=aybabtu.com) by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1MWulP-0000pA-Jm for grub-devel@gnu.org; Fri, 31 Jul 2009 12:15:23 -0400 Received: from [192.168.10.10] (helo=thorin) by aybabtu.com with esmtp (Exim 4.69) (envelope-from ) id 1MWulF-0000SW-AL for grub-devel@gnu.org; Fri, 31 Jul 2009 16:15:13 +0000 Received: from rmh by thorin with local (Exim 4.69) (envelope-from ) id 1MWulE-0003wS-PO for grub-devel@gnu.org; Fri, 31 Jul 2009 18:15:12 +0200 Date: Fri, 31 Jul 2009 18:15:12 +0200 From: Robert Millan To: The development of GRUB 2 Message-ID: <20090731161512.GH14675@thorin> References: <20090729183547.GP11691@riva.ucam.org> <1248901424.4253.2.camel@mj> <20090731103602.GQ11691@riva.ucam.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20090731103602.GQ11691@riva.ucam.org> Organization: free as in freedom X-Message-Flag: Worried about Outlook viruses? Switch to Thunderbird! www.mozilla.com/thunderbird X-Debbugs-No-Ack: true User-Agent: Mutt/1.5.18 (2008-05-17) X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6 (newer, 3) Subject: Re: grub-probe, but in reverse? X-BeenThere: grub-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: The development of GRUB 2 List-Id: The development of GRUB 2 List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 31 Jul 2009 16:15:29 -0000 On Fri, Jul 31, 2009 at 11:36:02AM +0100, Colin Watson wrote: > On Wed, Jul 29, 2009 at 05:03:44PM -0400, Pavel Roskin wrote: > > On Wed, 2009-07-29 at 19:35 +0100, Colin Watson wrote: > > > $ sudo grub-probe -d /dev/sda1 -t drive > > > (hd0,1) > > > > > > I have a reason to want to do the reverse of this: I have a > > > libparted-based program that ensures that at least one partition on a > > > disk is marked active (needed for some BIOSes), and would like to call > > > it on the disk selected for installation of GRUB in d-i. Of course > > > libparted is only going to understand OS device names. If possible I'd > > > rather avoid reading device.map by hand to figure out how to map (hd0,1) > > > back to /dev/sda1. Is there any way to do this with the code as it > > > stands, and if not would it make sense to make it possible to pass GRUB > > > device names to grub-probe? > > > > I think device.map is fundamentally unreliable and should be obsoleted. > > I don't know where you are getting the GRUB device names, but I suggest > > that you use UUID instead. > > They're entered by users choosing where to install GRUB, whom we can > hardly expect to enter UUIDs by hand. Perhaps we can figure out how to > give them a select list of available choices, which could then include > UUIDs behind the scenes ... Please don't use UUIDs for this. UUIDs identify a dataset (filesystem), not its container. It's feasible for someone to install GRUB to a partition that doesn't have any filesystem, for example. Colin, in your specific problem, I think the best solution is to avoid using GRUB drives entirely. When in userland, they're meant for GRUB internal consumption, and we don't make promises about them matching any given device later on (when we run on BIOS). Instead, just give a Linux device to grub-install. E.g.: $ grub-install /dev/sda1 Does this work for you? Alternatively, when using the Debian package you can just rely on its recently-added grub-pc/install_devices template. But I'm missing context to your problem so I'm not sure if this helps. -- Robert Millan The DRM opt-in fallacy: "Your data belongs to us. We will decide when (and how) you may access your data; but nobody's threatening your freedom: we still allow you to remove your data and not access it at all."