From mboxrd@z Thu Jan 1 00:00:00 1970 From: Subject: Re: Can (grub-configuration (device $DEV)) accept UUIDs? Date: Mon, 6 Mar 2017 11:10:22 -0800 Message-ID: <20170306111022.54755a03@khaalida> References: <20170226015415.0d14f076@khaalida> <87varmped2.fsf@gnu.org> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:49876) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cky1k-0003XK-Rp for guix-devel@gnu.org; Mon, 06 Mar 2017 14:10:37 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cky1j-00085A-Os for guix-devel@gnu.org; Mon, 06 Mar 2017 14:10:36 -0500 In-Reply-To: <87varmped2.fsf@gnu.org> List-Id: "Development of GNU Guix and the GNU System distribution." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-devel-bounces+gcggd-guix-devel=m.gmane.org@gnu.org Sender: "Guix-devel" To: Ludovic =?UTF-8?B?Q291cnTDqHM=?= Cc: guix-devel@gnu.org On Mon, 06 Mar 2017 17:19:21 +0100 ludo@gnu.org (Ludovic Court=C3=A8s) wrote: > Unfortunately it can=E2=80=99t, because there are no UUIDs (that I know o= f) to > identify drives. >=20 > However, as the manual vaguely suggests (too vaguely I admit), you can > use a GRUB device identifier such as =E2=80=9C(hd0)=E2=80=9D. This is st= able across > reboot, AIUI. I=E2=80=99ve never tried it but if you can confirm that it > works this way, we could/should update the documentation to propose > that. How about a (maybe better) option; if (grub-configuration ...) is passed something like (uuid "$UUID"), instead of simply passing this directly to grub-install (or whatever is used), guix /could/ take the UUID, check what drive the UUID points to, then pass the related arguement to GRUB. It would be a reasonably fix for what I'd assume is a bug/missing feature in GRUB. In my quick searching, apparently blkid can accept '-t', which lets you search for a drive by label, uuid, or (the manpage doesn't state this) uuid_sub. I don't know Guile nor Guix so I can't submit a patch, but what I think /should/ work is, if grub-configuration is called with a UUID, the UUID is passed to blkid[0] (probably checking both UUID[1] and UUID_SUB[2]), and the output checked for a valid drive (in the form, I'd expect, of /dev/sda or similar), cleaned up, then that is passed to grub-configuration. Someone with better knowledge of Guile, Guix, and Linux can probably expand on this (or figure out how it might be broken), but it should be a start for adding this feature. [0]. According to blkid, it's simply an interface to libblkid, so maybe a FFI call (or several) would be better here than just calling the CLI program? [1]. RAID members will share a UUID, so simply relying on that isn't practical. [2]. UUID_SUB is the actual UUID of the underlying drive (apparently), and should probably be used when someone it trying to install GRUB, otherwise you could end up with multiple RAID members as output, and then I can only see things becoming hard[3]. [3]. Like trying to decide which drive the sysadmin meant, or if they meant all of them, or if they passed the wrong UUID(_SUB) in the system config...