From debbugs-submit-bounces@debbugs.gnu.org Tue Mar 22 17:10:31 2022 Received: (at submit) by debbugs.gnu.org; 22 Mar 2022 21:10:31 +0000 Received: from localhost ([127.0.0.1]:42006 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nWllv-00030A-A5 for submit@debbugs.gnu.org; Tue, 22 Mar 2022 17:10:31 -0400 Received: from lists.gnu.org ([209.51.188.17]:44682) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nWllt-000300-KK for submit@debbugs.gnu.org; Tue, 22 Mar 2022 17:10:30 -0400 Received: from eggs.gnu.org ([209.51.188.92]:36866) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nWllt-0002OJ-Fc for bug-guix@gnu.org; Tue, 22 Mar 2022 17:10:29 -0400 Received: from [2607:f8b0:4864:20::729] (port=39544 helo=mail-qk1-x729.google.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nWllr-0006rB-SA for bug-guix@gnu.org; Tue, 22 Mar 2022 17:10:29 -0400 Received: by mail-qk1-x729.google.com with SMTP id b67so14983866qkc.6 for ; Tue, 22 Mar 2022 14:10:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:subject:date:message-id:mime-version; bh=Gue3o+QUNdG5z0HMB9RDQUR11MWqmegEO/YM1tf6Ry8=; b=Wc7G5FemM9ZHnami83+ZhZNBW+b5Yvxw9pL+a9v3jqmUq1cjFBESmw7dy3+7/130jO SwhMHpBGHecjC6dbzGmQkA1ho8wBrIRIQDujjstdDJ2CXOT2XoSfztzUG3MjunZT34C+ 9LzG0pIQO9wsFqNnGIMD4pimxQ/4cAAfIVsilS204J7yGtSz841ieLFg9JfSyGJYqk36 YerfQv7/DsjFKposSOxOOXffWBXmk5KnEtQEn6/W6lza0KgzdEP201UAi/5Ir1SntVYQ kugoBbgq36YnmcXufeRbhR7lrnQhHy4j3Hx/lhimqCE90mXslBw9qYxYTv/pfaAOf4eI 4hUw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:subject:date:message-id:mime-version; bh=Gue3o+QUNdG5z0HMB9RDQUR11MWqmegEO/YM1tf6Ry8=; b=a+QhUrQ95ZfKS9rHqXvvARyoL/fUWKxASg8Mj9fhZZTN15XXVUS70vXkfy8I14XyqV V6Bo+Ot8K1NQyRjW2WOJi4pSEsLn9OgrLyv2usM5tzKrWxUpx4ovb4oUdfPXoUg1pa7e Z6ttSyQ7rClTfOf2pLfp0Zh1/uKJ6UwTttF7fWqYN6jo46RqHeVZorsFBD92ajTUzkw5 N2sK1m25F4BkfT99YBccuCU5Xndmy+rFBVpBg2Y75oL7jIUti/QY7dtOQ5BfL9q4VtYW Fb4MByI2RguuNn6+HNynfvwc1+/q7iNfbz12PI8ZDRaoohImIy1sbNNpYP8MI6G9l/yD EBNQ== X-Gm-Message-State: AOAM533LbqEn32cYzCkicYxABzdLU7subj1Pwrq5NAc9NQUxIs+ugWRx OezD1DoOzQ8w6oDERennwJydgTr/sHY= X-Google-Smtp-Source: ABdhPJy9Lf64spdn3YctSKhoS+p0k3HimQdTFfUtliK1ObDQk+/E8CUlZq2FqmE5uifyVepMF0QLRw== X-Received: by 2002:a05:620a:2848:b0:67d:35de:bb5b with SMTP id h8-20020a05620a284800b0067d35debb5bmr16497170qkp.499.1647983426452; Tue, 22 Mar 2022 14:10:26 -0700 (PDT) Received: from hurd (dsl-10-129-199.b2b2c.ca. [72.10.129.199]) by smtp.gmail.com with ESMTPSA id w1-20020ac857c1000000b002e1e899badesm14628592qta.72.2022.03.22.14.10.25 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 22 Mar 2022 14:10:25 -0700 (PDT) From: Maxim Cournoyer To: bug-guix Subject: STORE-DIRECTORY-PREFIX is global, per generation, to all bootloader menu entries Date: Tue, 22 Mar 2022 17:10:25 -0400 Message-ID: <87v8w51yny.fsf@gmail.com> MIME-Version: 1.0 Content-Type: text/plain X-Host-Lookup-Failed: Reverse DNS lookup failed for 2607:f8b0:4864:20::729 (failed) Received-SPF: pass client-ip=2607:f8b0:4864:20::729; envelope-from=maxim.cournoyer@gmail.com; helo=mail-qk1-x729.google.com X-Spam_score_int: -6 X-Spam_score: -0.7 X-Spam_bar: / X-Spam_report: (-0.7 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, PDS_HP_HELO_NORDNS=0.659, RCVD_IN_DNSWL_NONE=-0.0001, RDNS_NONE=0.793, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=no autolearn_force=no X-Spam_action: no action X-Spam-Score: 1.0 (+) X-Debbugs-Envelope-To: submit X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -2.3 (--) Hello Guix, Recently I noticed after reconfiguring with the following operating system definition: --8<---------------cut here---------------start------------->8--- (use-modules (gnu bootloader) (gnu bootloader grub) (gnu packages linux) (gnu system file-systems) (guix gexp) (sysadmin build-machines)) ;;; XXX: Copied from berlin-nodes.scm. (define %authorized-guix-keys ;; List of authorized 'guix archive' keys. (list (local-file "keys/guix/berlin.guixsd.org-export.pub"))) (define %btrfs-raid-uuid "64a837b7-b9dc-4b64-ba95-712ba4032c71") (define %common-btrfs-options '(("compress-force" . "zstd") ("space_cache" . "v2") "degraded")) ;;; Top-level Btrfs subvolume. (define %btrfs-pool (file-system (device (uuid %btrfs-raid-uuid)) (mount-point "/mnt/btrfs-pool") (create-mount-point? #t) (type "btrfs") (options (alist->file-system-options (cons '("subvolid" . "5") %common-btrfs-options))))) (define (btrfs-subvolume-mount name mount-point) "Return a file system to mount the Btrfs subvolume NAME at MOUNT-POINT." (file-system (device (uuid %btrfs-raid-uuid)) (mount-point mount-point) (create-mount-point? #t) (type "btrfs") (options (alist->file-system-options (cons (cons "subvol" name) %common-btrfs-options))))) (define node-129-os (let ((base-os (berlin-new-build-machine-os 129 #:authorized-guix-keys %authorized-guix-keys))) (operating-system (inherit base-os) (bootloader (bootloader-configuration (inherit (operating-system-bootloader base-os)) (bootloader grub-bootloader) (targets (list "/dev/sdb" "/dev/sdc" "/dev/sdd")) (menu-entries (list (menu-entry (label "Previous system -- 5.15.19 (#91, 2022-02-18 22:25)") (linux "/gnu/store/8w9v4dka10cv0r5fyw9f0pc14fszbl03-linux-libre-5.15.19/bzImage") (linux-arguments '("--root=my-root" "--system=/var/guix/profiles/system-92-link" "--load=/var/guix/profiles/system-92-link/boot" "console=tty0" "console=ttyS0,57600n8")) (initrd "/gnu/store/in2bcjh03kyv793v8bd3fizswyx1q0rq-raw-initrd/initrd.cpio.gz")))))) (file-systems (cons* (btrfs-subvolume-mount "@root" "/") (btrfs-subvolume-mount "@etc" "/etc") (btrfs-subvolume-mount "@home" "/home") (btrfs-subvolume-mount "@cache" "/var/cache") (btrfs-subvolume-mount "@log" "/var/log") (btrfs-subvolume-mount "@secrets" "/secrets") (btrfs-subvolume-mount "@srv" "/srv") %btrfs-pool %base-file-systems)) (packages (cons btrfs-progs (operating-system-packages base-os))) ;; FIXME: fix swap field. ))) node-129-os --8<---------------cut here---------------end--------------->8--- That the custom menu-entry object specified in the bootloader configuration would also result in a grub.cfg entry where the linux and initrd items would be prefixed with '/@root/' (the store directory prefix), which is not desired (this entry corresponds to another, previous system generation that didn't even use Btrfs). The problem is that the store-directory-prefix is globally applied to all menu entries corresponding to a specific generation (e.g., via the boot-parameters file); it seems like it should rather be preserved per menu-entry. Thanks, Maxim From debbugs-submit-bounces@debbugs.gnu.org Thu Feb 09 15:05:20 2023 Received: (at 54528) by debbugs.gnu.org; 9 Feb 2023 20:05:20 +0000 Received: from localhost ([127.0.0.1]:33826 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pQDAW-0006Mi-9L for submit@debbugs.gnu.org; Thu, 09 Feb 2023 15:05:20 -0500 Received: from mout.web.de ([212.227.15.3]:57797) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pQDAU-0006MQ-7G for 54528@debbugs.gnu.org; Thu, 09 Feb 2023 15:05:18 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=web.de; s=s29768273; t=1675973112; bh=8eK+OQsynl2bmEtK64a6xyJUgvgeiHcVBAnl5Fc2Czk=; h=X-UI-Sender-Class:Date:From:To:Subject; b=Z04Il//3jazoANwf+NmvK2uEbyAyw17/XGKM0GUMSr6AoOeCyf0oLmYc6xdajAWTm vAs090hbG9dV7oQZKbGmnFAuctsoau0+XBJHdWakhCNpXDklS8yaULx6uJfFv00UOs D75bYjmwQAlVA903dfdoI0Fw2u5obAmSeZpaLwPNlfHtWoGALG0HQYlAZCeeizgEtT moO38xo+hjzN+HKiVFHc2VvH2+jxj+GwaOrkP2nLbIutIwwNODI67cGWjs1c0SNkYQ 66tSARpD52eeg43pS+5LcQC0zoa5Uci7ePNHlLbsyYY4NIW7ChYMZbqHKwSlFX6kc9 MqNe01eTaImJA== X-UI-Sender-Class: 814a7b36-bfc1-4dae-8640-3722d8ec6cd6 Received: from localhost ([188.98.113.37]) by smtp.web.de (mrweb006 [213.165.67.108]) with ESMTPSA (Nemesis) id 1N1d7s-1oSvT60fPs-0122fD for <54528@debbugs.gnu.org>; Thu, 09 Feb 2023 21:05:12 +0100 Date: Thu, 9 Feb 2023 21:05:09 +0100 From: Stefan Karrmann To: 54528@debbugs.gnu.org Subject: [PATCH] fix store-prefix for menu-entries Message-ID: MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="2WUJwI1uGCBXFW+S" Content-Disposition: inline X-Provags-ID: V03:K1:RwP7qUwyZdgsbuPKohz31QJRoeL1EtxO4sCnf2Rf4NQp4RtSCJa DCATOLok/6Oia8tLrHWvQD9OwjK5bUxRJx8j9Ju7UsyAf4RWJCI0txOQRJrFbjbbcyB0Hml WdIk/t9PniWRlVlR01IWtg7mUqhy2/cXwmmywjJjpeXiX2JjbmUSFCnb/pkc56R+Q5JkNex GwMYpAvtuhG+qJqn6E8oQ== X-Spam-Flag: NO UI-OutboundReport: notjunk:1;M01:P0:ahlxntbRn5M=;u9fcQ7lc2rRI7MoFm8lleDNlJ4G YyrIli7dem1KL4/aLOrjyvmUKwddJGERw2Eg49nmyh21LMPidMQ+wIS5ViSsDdyRIfNaAcuF4 Mm2/bQ5PZQ49mCnC/Dgtquy5Sh8b0dRSo0+QAcq3RgtDIEzZcj64jqC6CKsVNPPWAZc80P9wc /AJlcOlNMDAmDJFKyJfPr6Hppn5y1oawA5GnW0aa2bPuCZO60X/+7igcNtZe9s3iWOkReTZd0 r5GRFrIQphS2R+JTsdcaBA3wJphNpzDnSbnsx6eZ1bReIXf3jFwNL1vexf9AXc/7xXFlEBLBd DFLvoN3qh26mWl0CRaqeuK4l8+wsY7YxqnYtJKJTv9q9501FryetZ8yL0sxHSTLQkwyYB3yaL 7ubLtrAEWyan5ThOe75tvDQtjZuGUqkxirEnR+Gp3SSBBDUeDHy2sulFrpQXIEiy8HaHfxfnP +26GsosjlEJTiEBreDCLLDuh5LCtP22m2hTct5oWRE5vdP01dVG1kExQUMeh4KOcWQ/3yNRcX PJ1zLWjcumrV/HfIthHFyZ2O1eCRYdAkaTuHycOtaN2SWqt1opjW+rnKVs+4Jkz8RLaOPOIH8 rZ2Xhtw1jH6Y1AtNUL193TaAcWUBZriuCVDRZIrOBxyHZ3SnJpyTL1V69ZEc/1jaOOElN+4s9 7E4T87bTALZW17Cmc7QNZQGd157yuYKOWszgmQKpdppZ3STDo3/EIWRWXFIStbaRS6VQAAQ7x yVjo3V5Dy4jbTQRm0RIhqmsEPpEYNJQ7dJfluM7G1DJbgjzW2R53A0LGX6VqApvGSeBSlKRGP ZOj1J6VgHWlQdX0h5WYmiVdGVwnEC+GWpBJAXITSZfPXdhBtRC0PYH+k76OFACPby5QPxNp+S K1GBa9Txn3O4tShTBBmruJjvii1S5r+fVGMekyT85/4VR/B/vJvD/0G+7zdI5BglYxbcaICy3 /X3B2A== X-Spam-Score: -0.7 (/) X-Debbugs-Envelope-To: 54528 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.7 (-) --2WUJwI1uGCBXFW+S Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Dear Maxim Cournoyer, here is a patch, that fixes the global store-prefix for grub menu-entries on commit 58a95d599ee5d0dc6419d038b7317e1b77b11519 git apply fix-store-prefix-for-menu-entry.patch Kind regards, =2D- Dr. Stefan Karrmann --2WUJwI1uGCBXFW+S Content-Type: text/x-diff; charset=us-ascii Content-Description: fix-store-prefix-for-menu-entry.patch Content-Disposition: attachment; filename="fix-btrfs-subvol-prefix-in-menu-entry.patch" diff --git a/gnu/bootloader/grub.scm b/gnu/bootloader/grub.scm index ecd44e7f3c..048b9ff8fd 100644 --- a/gnu/bootloader/grub.scm +++ b/gnu/bootloader/grub.scm @@ -378,22 +378,25 @@ (define (menu-entry->gexp entry) (device-mount-point (menu-entry-device-mount-point entry)) (multiboot-kernel (menu-entry-multiboot-kernel entry)) (chain-loader (menu-entry-chain-loader entry))) + ;; Here DEVICE is the store and DEVICE-MOUNT-POINT is its mount point. + ;; Use the right file names for LINUX and INITRD in case + ;; DEVICE-MOUNT-POINT is not "/", meaning that the store is on a + ;; separate partition. Then we don't use STORE-DIRECTORY-PREFIX. + ;; When STORE-DIRECTORY-PREFIX is defined, prepend it the linux and + ;; initrd paths, to allow booting from a Btrfs subvolume. + (define (normalize-or-grub path) + "Normalize PATH if and only if DEVICE-MOUNT-POINT is \"/\"." + (if (and (string? device-mount-point) + (string= "/" device-mount-point)) + (normalize-file path + device-mount-point + store-directory-prefix) + path)) (cond (linux (let ((arguments (menu-entry-linux-arguments entry)) - (linux (normalize-file linux - device-mount-point - store-directory-prefix)) - (initrd (normalize-file (menu-entry-initrd entry) - device-mount-point - store-directory-prefix))) - ;; Here DEVICE is the store and DEVICE-MOUNT-POINT is its mount point. - ;; Use the right file names for LINUX and INITRD in case - ;; DEVICE-MOUNT-POINT is not "/", meaning that the store is on a - ;; separate partition. - - ;; When STORE-DIRECTORY-PREFIX is defined, prepend it the linux and - ;; initrd paths, to allow booting from a Btrfs subvolume. + (linux (normalize-or-grub linux)) + (initrd (normalize-or-grub (menu-entry-initrd entry)))) #~(format port "menuentry ~s { ~a linux ~a ~a --2WUJwI1uGCBXFW+S--