GNU bug report logs - #33517
Problem booting when using btrfs subvolume for /gnu/store

Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.

Package: guix; Reported by: Christopher Baines <mail@HIDDEN>; dated Mon, 26 Nov 2018 20:29:02 UTC; Maintainer for guix is bug-guix@HIDDEN.

Message received at 33517 <at> debbugs.gnu.org:


Received: (at 33517) by debbugs.gnu.org; 28 Nov 2018 13:21:57 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Wed Nov 28 08:21:57 2018
Received: from localhost ([127.0.0.1]:52941 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1gRzmv-0003yZ-0j
	for submit <at> debbugs.gnu.org; Wed, 28 Nov 2018 08:21:57 -0500
Received: from eggs.gnu.org ([208.118.235.92]:43351)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <ludo@HIDDEN>) id 1gRzms-0003yJ-Sj
 for 33517 <at> debbugs.gnu.org; Wed, 28 Nov 2018 08:21:55 -0500
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
 (envelope-from <ludo@HIDDEN>) id 1gRzmn-0004sU-4F
 for 33517 <at> debbugs.gnu.org; Wed, 28 Nov 2018 08:21:49 -0500
X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org
X-Spam-Level: 
X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=disabled
 version=3.3.2
Received: from fencepost.gnu.org ([2001:4830:134:3::e]:36292)
 by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from <ludo@HIDDEN>)
 id 1gRzmn-0004sN-1J; Wed, 28 Nov 2018 08:21:49 -0500
Received: from [2a01:e0a:1d:7270:af76:b9b:ca24:c465] (port=57368 helo=ribbon)
 by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256)
 (Exim 4.82) (envelope-from <ludo@HIDDEN>)
 id 1gRzmm-0000Mx-P4; Wed, 28 Nov 2018 08:21:48 -0500
From: ludo@HIDDEN (Ludovic =?utf-8?Q?Court=C3=A8s?=)
To: Christopher Baines <mail@HIDDEN>
Subject: Re: bug#33517: Problem booting when using btrfs subvolume for
 /gnu/store
References: <87mupva8j5.fsf@HIDDEN>
X-URL: http://www.fdn.fr/~lcourtes/
X-Revolutionary-Date: 8 Frimaire an 227 de la =?utf-8?Q?R=C3=A9volution?=
X-PGP-Key-ID: 0x090B11993D9AEBB5
X-PGP-Key: http://www.fdn.fr/~lcourtes/ludovic.asc
X-PGP-Fingerprint: 3CE4 6455 8A84 FDC6 9DB4  0CFB 090B 1199 3D9A EBB5
X-OS: x86_64-pc-linux-gnu
Date: Wed, 28 Nov 2018 14:21:47 +0100
In-Reply-To: <87mupva8j5.fsf@HIDDEN> (Christopher Baines's message of
 "Mon, 26 Nov 2018 20:27:58 +0000")
Message-ID: <87zhtt49sk.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.1 (gnu/linux)
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic]
X-Received-From: 2001:4830:134:3::e
X-Spam-Score: -5.0 (-----)
X-Debbugs-Envelope-To: 33517
Cc: 33517 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -6.0 (------)

Hello,

Christopher Baines <mail@HIDDEN> skribis:

> I'm loosing track of this issue a bit, as I've been dealing with it for
> a while. I have a machine that I've setup where /gnu/store is a btrfs
> subvolume. I do this so that I can make flexible use of the space on
> that btrfs filesystem.
>
> Unfortunately, the grub configuration generated for this doesn't seem to
> account for this, and so it requires some tweaking to get it to boot.
>
> A long while back, I discovered I could make the following change, then
> the generated grub configuration would be fine.
>
>
> ---
>  gnu/bootloader/grub.scm | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/gnu/bootloader/grub.scm b/gnu/bootloader/grub.scm
> index 06856dd58c..c3ddc3e128 100644
> --- a/gnu/bootloader/grub.scm
> +++ b/gnu/bootloader/grub.scm
> @@ -320,8 +320,8 @@ entries corresponding to old generations of the syste=
m."
>        ;; Use the right file names for KERNEL and INITRD in case
>        ;; DEVICE-MOUNT-POINT is not "/", meaning that the store is on a
>        ;; separate partition.
> -      (let ((kernel  (strip-mount-point device-mount-point kernel))
> -            (initrd  (strip-mount-point device-mount-point initrd)))
> +      (let ((kernel kernel)
> +            (initrd initrd))
>          #~(format port "menuentry ~s {
>    ~a
>    linux ~a ~a
> --
> 2.19.2
>
>
>
> Unfortunately, it's not a proper solution, as it obviously breaks when
> you actually want to strip the mount point off so that grub can find the
> right files.

Is there a way =E2=80=98strip-mount-point=E2=80=99 or some higher-level cod=
e could
determine whether we actually need to strip the mount point?

Thanks,
Ludo=E2=80=99.




Information forwarded to bug-guix@HIDDEN:
bug#33517; Package guix. Full text available.

Message received at submit <at> debbugs.gnu.org:


Received: (at submit) by debbugs.gnu.org; 26 Nov 2018 20:28:30 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Mon Nov 26 15:28:30 2018
Received: from localhost ([127.0.0.1]:50174 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1gRNUb-0002t6-SU
	for submit <at> debbugs.gnu.org; Mon, 26 Nov 2018 15:28:30 -0500
Received: from eggs.gnu.org ([208.118.235.92]:51152)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <mail@HIDDEN>) id 1gRNUa-0002su-3J
 for submit <at> debbugs.gnu.org; Mon, 26 Nov 2018 15:28:28 -0500
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
 (envelope-from <mail@HIDDEN>) id 1gRNUT-0002pL-Ku
 for submit <at> debbugs.gnu.org; Mon, 26 Nov 2018 15:28:22 -0500
X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org
X-Spam-Level: 
X-Spam-Status: No, score=0.8 required=5.0 tests=BAYES_50 autolearn=disabled
 version=3.3.2
Received: from lists.gnu.org ([2001:4830:134:3::11]:56489)
 by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32)
 (Exim 4.71) (envelope-from <mail@HIDDEN>) id 1gRNUT-0002pH-Go
 for submit <at> debbugs.gnu.org; Mon, 26 Nov 2018 15:28:21 -0500
Received: from eggs.gnu.org ([2001:4830:134:3::10]:60739)
 by lists.gnu.org with esmtp (Exim 4.71)
 (envelope-from <mail@HIDDEN>) id 1gRNUR-0005lE-TM
 for bug-guix@HIDDEN; Mon, 26 Nov 2018 15:28:21 -0500
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
 (envelope-from <mail@HIDDEN>) id 1gRNUO-0002nM-Lf
 for bug-guix@HIDDEN; Mon, 26 Nov 2018 15:28:19 -0500
Received: from mira.cbaines.net ([2a01:7e00::f03c:91ff:fe69:8da9]:37630)
 by eggs.gnu.org with esmtp (Exim 4.71)
 (envelope-from <mail@HIDDEN>) id 1gRNUH-0002lh-Ha
 for bug-guix@HIDDEN; Mon, 26 Nov 2018 15:28:12 -0500
Received: by mira.cbaines.net (Postfix, from userid 113)
 id 00F53167E5; Mon, 26 Nov 2018 20:28:01 +0000 (GMT)
Received: from localhost (cpc102582-walt20-2-0-cust14.13-2.cable.virginm.net
 [86.27.34.15])
 by mira.cbaines.net (Postfix) with ESMTPSA id 767C516724
 for <bug-guix@HIDDEN>; Mon, 26 Nov 2018 20:28:01 +0000 (GMT)
Received: from capella (localhost [127.0.0.1])
 by localhost (OpenSMTPD) with ESMTP id 09138ff3
 for <bug-guix@HIDDEN>; Mon, 26 Nov 2018 20:28:01 +0000 (UTC)
User-agent: mu4e 1.0; emacs 26.1
From: Christopher Baines <mail@HIDDEN>
To: bug-guix@HIDDEN
Subject: Problem booting when using btrfs subvolume for /gnu/store
Date: Mon, 26 Nov 2018 20:27:58 +0000
Message-ID: <87mupva8j5.fsf@HIDDEN>
MIME-Version: 1.0
Content-Type: multipart/signed; boundary="==-=-=";
 micalg=pgp-sha512; protocol="application/pgp-signature"
X-detected-operating-system: by eggs.gnu.org: Genre and OS details not
 recognized.
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x
X-Received-From: 2001:4830:134:3::11
X-Spam-Score: -4.0 (----)
X-Debbugs-Envelope-To: submit
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -5.0 (-----)

--==-=-=
Content-Type: multipart/mixed; boundary="=-=-="

--=-=-=
Content-Type: text/plain

I'm loosing track of this issue a bit, as I've been dealing with it for
a while. I have a machine that I've setup where /gnu/store is a btrfs
subvolume. I do this so that I can make flexible use of the space on
that btrfs filesystem.

Unfortunately, the grub configuration generated for this doesn't seem to
account for this, and so it requires some tweaking to get it to boot.

A long while back, I discovered I could make the following change, then
the generated grub configuration would be fine.


--=-=-=
Content-Type: text/x-patch
Content-Disposition: inline


---
 gnu/bootloader/grub.scm | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/gnu/bootloader/grub.scm b/gnu/bootloader/grub.scm
index 06856dd58c..c3ddc3e128 100644
--- a/gnu/bootloader/grub.scm
+++ b/gnu/bootloader/grub.scm
@@ -320,8 +320,8 @@ entries corresponding to old generations of the system."
       ;; Use the right file names for KERNEL and INITRD in case
       ;; DEVICE-MOUNT-POINT is not "/", meaning that the store is on a
       ;; separate partition.
-      (let ((kernel  (strip-mount-point device-mount-point kernel))
-            (initrd  (strip-mount-point device-mount-point initrd)))
+      (let ((kernel kernel)
+            (initrd initrd))
         #~(format port "menuentry ~s {
   ~a
   linux ~a ~a
--
2.19.2

--=-=-=
Content-Type: text/plain



Unfortunately, it's not a proper solution, as it obviously breaks when
you actually want to strip the mount point off so that grub can find the
right files.

I'm creating a bug for this, as I think it would be good to track the
issue. I've also written a system test that I believe reproduced the
issue.


--=-=-=
Content-Type: text/x-patch
Content-Disposition: inline;
 filename=0001-WIP-Btrfs-store-subvolume-test.patch
Content-Transfer-Encoding: quoted-printable

From=207eee5685f95d0b6baeb97f5fdd947fe5223a61c9 Mon Sep 17 00:00:00 2001
From: Christopher Baines <mail@HIDDEN>
Date: Fri, 26 Oct 2018 18:48:32 +0100
Subject: [PATCH] WIP Btrfs store subvolume test

=2D--
 gnu/tests/install.scm | 91 ++++++++++++++++++++++++++++++++++++++++++-
 1 file changed, 90 insertions(+), 1 deletion(-)

diff --git a/gnu/tests/install.scm b/gnu/tests/install.scm
index 4764ffffde..cfa071187c 100644
=2D-- a/gnu/tests/install.scm
+++ b/gnu/tests/install.scm
@@ -43,7 +43,8 @@
             %test-separate-home-os
             %test-raid-root-os
             %test-encrypted-os
=2D            %test-btrfs-root-os))
+            %test-btrfs-root-os
+            %test-btrfs-root-with-store-subvolume-os))
=20
 ;;; Commentary:
 ;;;
@@ -826,4 +827,92 @@ build (current-guix) and then store a couple of full s=
ystem images.")
                          (command (qemu-command/writable-image image)))
       (run-basic-test %btrfs-root-os command "btrfs-root-os")))))
=20
+
+;;;
+;;; Btrfs root file system with store subvolume.
+;;;
+
+(define-os-with-source (%btrfs-root-with-store-subvolume-os
+                        %btrfs-root-with-store-subvolume-os-source)
+  ;; The OS we want to install.
+  (use-modules (gnu) (gnu tests) (srfi srfi-1))
+
+  (operating-system
+    (host-name "liberigilo")
+    (timezone "Europe/Paris")
+    (locale "en_US.UTF-8")
+
+    (bootloader (bootloader-configuration
+                 (bootloader grub-bootloader)
+                 (target "/dev/vdb")))
+    (kernel-arguments '("console=3DttyS0"))
+    (file-systems (cons* (file-system
+                           (device (file-system-label "my-root"))
+                           (mount-point "/")
+                           (type "btrfs"))
+                         (file-system
+                           (device (file-system-label "my-root"))
+                           (mount-point "/gnu/store")
+                           (type "btrfs")
+                           (options "subvol=3D/gnu/store"))
+                         %base-file-systems))
+    (users (cons (user-account
+                  (name "charlie")
+                  (group "users")
+                  (home-directory "/home/charlie")
+                  (supplementary-groups '("wheel" "audio" "video")))
+                 %base-user-accounts))
+    (services (cons (service marionette-service-type
+                             (marionette-configuration
+                              (imported-modules '((gnu services herd)
+                                                  (guix combinators)))))
+                    %base-services))))
+
+(define %btrfs-root-with-store-subvolume-installation-script
+  ;; Shell script of a simple installation.
+  "\
+. /etc/profile
+set -e -x
+guix --version
+
+export GUIX_BUILD_OPTIONS=3D--no-grafts
+ls -l /run/current-system/gc-roots
+parted --script /dev/vdb mklabel gpt \\
+  mkpart primary ext2 1M 3M \\
+  mkpart primary ext2 3M 2G \\
+  set 1 boot on \\
+  set 1 bios_grub on
+mkfs.btrfs -L my-root /dev/vdb2
+mount /dev/vdb2 /mnt
+btrfs subvolume create /mnt/home
+mkdir /mnt/gnu
+btrfs subvolume create /mnt/gnu/store
+herd start cow-store /mnt
+mkdir /mnt/etc
+cp /etc/target-config.scm /mnt/etc/config.scm
+guix system build /mnt/etc/config.scm
+guix system init /mnt/etc/config.scm /mnt --no-substitutes
+sync
+reboot\n")
+
+(define %test-btrfs-root-with-store-subvolume-os
+  (system-test
+   (name "btrfs-root-with-store-subvolume-os")
+   (description
+    "Test basic functionality of an OS installed like one would do by hand.
+This test is expensive in terms of CPU and storage usage since we need to
+build (current-guix) and then store a couple of full system images.")
+   (value
+    (mlet* %store-monad
+        ((image   (run-install
+                   %btrfs-root-with-store-subvolume-os
+                   %btrfs-root-with-store-subvolume-os-source
+                   #:script
+                   %btrfs-root-with-store-subvolume-installation-script))
+
+         (command (qemu-command/writable-image image)))
+      (run-basic-test %btrfs-root-with-store-subvolume-os
+                      command
+                      "btrfs-root-with-store-subvolume-os")))))
+
 ;;; install.scm ends here
=2D-=20
2.19.2


--=-=-=
Content-Type: text/plain


It would be good if a way could be found to make this "just work". I
just don't know whether the best way to do that is tweaking the way Guix
generates the grub configuration to be aware of the odd mounting, or
somehow making grub find things in the subvolume, or something else.

Thanks,

Chris

--=-=-=--

--==-=-=
Content-Type: application/pgp-signature; name="signature.asc"

-----BEGIN PGP SIGNATURE-----

iQKTBAEBCgB9FiEEPonu50WOcg2XVOCyXiijOwuE9XcFAlv8V05fFIAAAAAALgAo
aXNzdWVyLWZwckBub3RhdGlvbnMub3BlbnBncC5maWZ0aGhvcnNlbWFuLm5ldDNF
ODlFRUU3NDU4RTcyMEQ5NzU0RTBCMjVFMjhBMzNCMEI4NEY1NzcACgkQXiijOwuE
9Xdlog//WFBd/LdzhI11lOnfHmS4uVxoAGC5MzZJ6nvThjzrZLxmPVbezYTOnU27
1ye73COsNLFD9I+YO30PcTxXz5fJbe0oOELrHIbb/dfk4tJ3vpR6M3kiWu6DRs2e
Nr4+g6KS65oPAgyTp2O3t3NPAWC0pLlSx644ABu1IoGr7/EgsPuZ4F536nNw51zO
WXvgGFgRtKsYjTR6AWS3AJF1zxcVW2H6Kr5U6cSSUXjZ5CspgKi9QbAH5ftew/Rc
15wxdrrO8z5F+wR5LVnoTDL5r/0LmHHlNoqvIz4cA/R33SpJkSWiscXGg9gwzfQJ
FDMGv/szhIYBXgknAvZSvJJl1NtA+UrmjG4dYXmPPabljyR1giJJhmh4VD6uuspA
LXpzTQi9jH6+Mc2FGxFcQ+WdRFuAq9tc9awv2NJKXIufQnOLTLgNbJspP1/jcGEU
PfCjC4iCQcYvAJha1jkxfV9U4uVO7wNLZtM1UtXV4Gy47uFH+R2BruTTFqsNB5Tm
q6aUkCRtF/hYZiL/bs5IvK9V43vodpKM8Hf7jxyMmipb+dXaNsCAZgxKzBFmVb8b
U7oYe40Md0cd3SrlZVju0B61KZPe3i0DW9qh0TVODscKUVd3GCGAOOyNXk3rlyZb
KqNX05l3HFAR1QsSZkLYdkz5vrCuLkqjKKjxVB7ZwI7Xz4Wdt7g=
=wgZK
-----END PGP SIGNATURE-----
--==-=-=--




Acknowledgement sent to Christopher Baines <mail@HIDDEN>:
New bug report received and forwarded. Copy sent to bug-guix@HIDDEN. Full text available.
Report forwarded to bug-guix@HIDDEN:
bug#33517; Package guix. Full text available.
Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.
Last modified: Wed, 28 Nov 2018 13:30:02 UTC

GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997 nCipher Corporation Ltd, 1994-97 Ian Jackson.