From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp12.migadu.com ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms5.migadu.com with LMTPS id CBxbHAC0k2NJvwAAbAwnHQ (envelope-from ) for ; Fri, 09 Dec 2022 23:17:36 +0100 Received: from aspmx1.migadu.com ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp12.migadu.com with LMTPS id KV9SHAC0k2MVJwAAauVa8A (envelope-from ) for ; Fri, 09 Dec 2022 23:17:36 +0100 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id EF76D37815 for ; Fri, 9 Dec 2022 23:17:35 +0100 (CET) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1p3lg0-0000le-0i; Fri, 09 Dec 2022 17:17:04 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1p3lfy-0000jR-T3 for bug-guix@gnu.org; Fri, 09 Dec 2022 17:17:02 -0500 Received: from debbugs.gnu.org ([209.51.188.43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1p3lfy-0002tI-Ji for bug-guix@gnu.org; Fri, 09 Dec 2022 17:17:02 -0500 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1p3lfy-0006bT-Dn for bug-guix@gnu.org; Fri, 09 Dec 2022 17:17:02 -0500 X-Loop: help-debbugs@gnu.org Subject: bug#59823: [1.4.0rc1] Installer fails to identify installation device on Ventoy-made images Resent-From: Ludovic =?UTF-8?Q?Court=C3=A8s?= Original-Sender: "Debbugs-submit" Resent-CC: bug-guix@gnu.org Resent-Date: Fri, 09 Dec 2022 22:17:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 59823 X-GNU-PR-Package: guix X-GNU-PR-Keywords: To: Mathieu Othacehe Cc: 59823@debbugs.gnu.org, Josselin Poiret , So'n Typ im Internet Received: via spool by 59823-submit@debbugs.gnu.org id=B59823.167062417825341 (code B ref 59823); Fri, 09 Dec 2022 22:17:02 +0000 Received: (at 59823) by debbugs.gnu.org; 9 Dec 2022 22:16:18 +0000 Received: from localhost ([127.0.0.1]:38847 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1p3lfF-0006af-Rd for submit@debbugs.gnu.org; Fri, 09 Dec 2022 17:16:18 -0500 Received: from eggs.gnu.org ([209.51.188.92]:52910) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1p3lfD-0006aV-NP for 59823@debbugs.gnu.org; Fri, 09 Dec 2022 17:16:16 -0500 Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1p3lf8-0000Ia-9g; Fri, 09 Dec 2022 17:16:10 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-Version:In-Reply-To:Date:References:Subject:To: From; bh=9LJKEtqbYfx+A6m3GWU8KUjgxTjGuIDlHppBaFNb2SI=; b=rM0KpPvTCSPaLCoe2BFX HHSbjVq8fdBbUPLQaAZm3B52DpE7WIjUW72GMNNWvfNttz9547iqbDCKy/TWcpdhlgaBPCX+uuuoV T7F2K1eRwdjI06lZbI/9s8BNoP2pXlnuQvYjZq9XXQhgsJYz2HyH7a1b3NZ/rYaVKBfGn/L5GQtHK fqam8C2M8QE6tUP5IQUC6rdcaWPbZ0DxD0f6mrVYqpBZshBr5loCzPhPPc6LEDbBleVzoWCpkz3fD TJS4feZfnikIBXglkct/OKti/kXSAKTu6hMfMnxGkpsD0yY15p57JmUG0WFRTcQNdCLzmd1PWqGsA 0eBfwcthBtmqdQ==; Received: from 91-160-117-201.subs.proxad.net ([91.160.117.201] helo=ribbon) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1p3lf7-0000Ht-LX; Fri, 09 Dec 2022 17:16:09 -0500 From: Ludovic =?UTF-8?Q?Court=C3=A8s?= References: <87tu2a8drd.fsf@gnu.org> <87lenj8srr.fsf@gnu.org> <87y1rj6xb0.fsf@gnu.org> <877cz213mk.fsf_-_@gnu.org> Date: Fri, 09 Dec 2022 23:16:07 +0100 In-Reply-To: <877cz213mk.fsf_-_@gnu.org> (Mathieu Othacehe's message of "Thu, 08 Dec 2022 13:28:19 +0100") Message-ID: <87y1rg5il4.fsf@gnu.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.2 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-guix@gnu.org List-Id: Bug reports for GNU Guix List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-guix-bounces+larch=yhetil.org@gnu.org Sender: bug-guix-bounces+larch=yhetil.org@gnu.org X-Migadu-Country: US X-Migadu-Flow: FLOW_IN ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1670624256; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding:resent-cc: resent-from:resent-sender:resent-message-id:in-reply-to:in-reply-to: references:references:list-id:list-help:list-unsubscribe: list-subscribe:list-post:dkim-signature; bh=9LJKEtqbYfx+A6m3GWU8KUjgxTjGuIDlHppBaFNb2SI=; b=PIQhf+rDdCHRq5ER9Eql763HPw2MNXmlv66RDrhqntOwhz/f3Om8gOlp6ptaKLx9rKWpuV /zZKZ+SJPP+cjry8tPPtZYShtrdmStAit5LhGddaTJOUxXEkZTd4rCd96OZmPEKEMta0ca jnJd8oLIovp3mrUbrXg+TRieWB2BW8Cujix1qbYuyAwOj8cbQpZo8w6/PVs7arLnUMb9+8 R37JiPjp/O4XgAuz07x/tAjYiJzyQkaSuwFsA/ghfK89lMkL1QPscFEmdVYwi9u3MqwBho o/L+9pDRyEB7fZ3LutFRIiCdTKuZ7NqjksP8n5d5JeKn37WeYrU6KwYJeaCz2Q== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=gnu.org header.s=fencepost-gnu-org header.b=rM0KpPvT; spf=pass (aspmx1.migadu.com: domain of "bug-guix-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="bug-guix-bounces+larch=yhetil.org@gnu.org"; dmarc=pass (policy=none) header.from=gnu.org ARC-Seal: i=1; s=key1; d=yhetil.org; t=1670624256; a=rsa-sha256; cv=none; b=tQLImgS8nvERWjs/WzCxFZWcVox1sT9ZEpxVZeX8Mn9Sr03r4VBQTofZrnD0tyrOhsxJu7 L4vl6uEpoeaBD30dizP7JAsqBC1t8vzNf4ZR8j0zKbq2JDa4TJlFU3gS0KtRieXC/GbKK3 exCCP9ErFRd4LY47dH/JCsJTnqJLFZeCY60mj5cFI+hoUJGfVHY52X88EX86xCNb/PkPpV 3vFNWxaU4EVzihqFwRCudS7UvCaHcPSsg1xlkYT56XVdfgI+7IEsF88m1inFHjEFZnrwPa s3g5OK7b8oMjjg1HBrK34oKiJVCS2m44/uQRM3+4Zk+wQAEPR9ACWW9LYND0JQ== X-Migadu-Spam-Score: -4.65 X-Spam-Score: -4.65 X-Migadu-Queue-Id: EF76D37815 X-Migadu-Scanner: scn0.migadu.com Authentication-Results: aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=gnu.org header.s=fencepost-gnu-org header.b=rM0KpPvT; spf=pass (aspmx1.migadu.com: domain of "bug-guix-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="bug-guix-bounces+larch=yhetil.org@gnu.org"; dmarc=pass (policy=none) header.from=gnu.org X-TUID: ovvNNWBp/mrm Hi! Mathieu Othacehe skribis: >>>From 0afda5b3ed32e73bece9db96ab970d83f9f2e74b Mon Sep 17 00:00:00 2001 > From: Mathieu Othacehe > Date: Thu, 8 Dec 2022 13:24:02 +0100 > Subject: [PATCH 1/1] installer: Detect mapped installation devices. > > Fixes: > > * gnu/installer/parted.scm (mapped-device?, > mapped-device->parent-partition-path): New procedures. > (eligible-devices): Detect mapped installation devices using the new > procedures. Well done! > +(define (mapped-device->parent-partition-path device) > + "Return the parent partition path of the mapped DEVICE." Maybe =E2=80=98mapped-device-parent-partition=E2=80=99? (=E2=80=9CPath=E2= =80=9D being used for search paths, not for file names.) > + (let* ((command `("dmsetup" "deps" ,device "-o" "devname")) > + (parent #f) > + (handler > + (lambda (input) > + (let ((result > + (string-match "\\(([^\\)]+)\\)" > + (get-string-all input)))) > + (and result > + (set! parent > + (format #f "/dev/~a" > + (match:substring result 1)))))))) > + (run-external-command-with-handler handler command) > + parent)) The advantage of =E2=80=98run-external-command-with-handler=E2=80=99 is log= ging I guess, but that leads to an awkward style compared to using =E2=80=98open-input-pi= pe=E2=80=99, which I would favor. Then we want to parse a line that looks like this: --8<---------------cut here---------------start------------->8--- 1 dependencies : (sda2) --8<---------------cut here---------------end--------------->8--- I=E2=80=99m not super confident relying on this format. =E2=80=98dmsetup deps =E2=80=A6=E2=80=99 does this (here /dev/dm-0 is the s= ame as /dev/mapper/root): --8<---------------cut here---------------start------------->8--- ioctl(3, DM_VERSION, {version=3D[4, 0, 0], data_size=3D16384, flags=3DDM_EX= ISTS_FLAG} =3D> {version=3D[4, 47, 0], data_size=3D16384, flags=3DDM_EXISTS= _FLAG}) =3D 0 newfstatat(AT_FDCWD, "/dev/dm-0", {st_mode=3DS_IFBLK|0660, st_rdev=3Dmakede= v(0xfd, 0), ...}, 0) =3D 0 newfstatat(AT_FDCWD, "/dev/mapper/dm-0", 0x7ffe78f99020, 0) =3D -1 ENOENT (= No such file or directory) openat(AT_FDCWD, "/dev/mapper", O_RDONLY|O_NONBLOCK|O_CLOEXEC|O_DIRECTORY) = =3D 4 newfstatat(4, "", {st_mode=3DS_IFDIR|0755, st_size=3D80, ...}, AT_EMPTY_PAT= H) =3D 0 getdents64(4, 0x563c1d72f8b0 /* 4 entries */, 32768) =3D 104 newfstatat(AT_FDCWD, "/dev/mapper/root", {st_mode=3DS_IFBLK|0600, st_rdev= =3Dmakedev(0xfd, 0), ...}, 0) =3D 0 close(4) =3D 0 ioctl(3, DM_TABLE_DEPS, {version=3D[4, 0, 0], data_size=3D16384, data_start= =3D312, name=3D"root", flags=3DDM_EXISTS_FLAG} =3D> {version=3D[4, 47, 0], = data_size=3D328, data_start=3D312, dev=3Dmakedev(0xfd, 0), name=3D"root", u= uid=3D"CRYPT-LUKS1-xxxxxx-root", target_count=3D1, open_count=3D1, event_nr= =3D0, flags=3DDM_EXISTS_FLAG|DM_ACTIVE_PRESENT_FLAG, ...}) =3D 0 newfstatat(1, "", {st_mode=3DS_IFCHR|0622, st_rdev=3Dmakedev(0x88, 0), ...}= , AT_EMPTY_PATH) =3D 0 readlink("/sys/dev/block/8:2", "../../devices/pci0000:00/0000:00:17.0/ata3/= host2/target2:0:0/2:0:0:0/block/sda/sda2", 4095) =3D 83 write(1, "1 dependencies\t: (sda2)\n", 24) =3D 24 --8<---------------cut here---------------end--------------->8--- We could implement those ioctls, but not in the time frame we=E2=80=99re ta= lking about=E2=80=A6 The libdevmapper interface doesn=E2=80=99t look more pleasant than the raw ioctl. Anyway, all in all, calling out to dmsetup looks reasonable for now; I have a slight preference for using =E2=80=98open-pipe* OPEN_READ=E2=80=99, = but no big deal. Perhaps add a comment showing what the line we=E2=80=99re parsing sh= ould look like. > (define (eligible-devices) > "Return all the available devices except the install device and the de= vices > which are smaller than %MIN-DEVICE-SIZE." >=20=20 > (define the-installer-root-partition-path > - (installer-root-partition-path)) > + (let ((root-path > + (installer-root-partition-path))) Just =E2=80=98root=E2=80=99. :-) Thanks a lot for fixing this! You can push to =E2=80=98version-1.4.0=E2=80= =99. Hopefully I=E2=80=99ll prepare RC2 tomorrow evening. Ludo=E2=80=99.