Package: guix-patches;
Reported by: Michael Rohleder <mike <at> rohleder.de>
Date: Sat, 31 Dec 2022 01:28:02 UTC
Severity: normal
Tags: patch
Done: Josselin Poiret <dev <at> jpoiret.xyz>
Bug is archived. No further changes may be made.
To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 60442 in the body.
You can then email your comments to 60442 AT debbugs.gnu.org in the normal way.
Toggle the display of automated, internal messages from the tracker.
View this report as an mbox folder, status mbox, maintainer mbox
guix-patches <at> gnu.org
:bug#60442
; Package guix-patches
.
(Sat, 31 Dec 2022 01:28:02 GMT) Full text and rfc822 format available.Michael Rohleder <mike <at> rohleder.de>
:guix-patches <at> gnu.org
.
(Sat, 31 Dec 2022 01:28:02 GMT) Full text and rfc822 format available.Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):
From: Michael Rohleder <mike <at> rohleder.de> To: guix-patches <at> gnu.org Cc: Michael Rohleder <mike <at> rohleder.de> Subject: [PATCH] bootloader: grub: Add support for root on lvm. Date: Sat, 31 Dec 2022 02:25:11 +0100
This fixes <https://issues.guix.gnu.org/44877>. * gnu/bootloader/grub.scm (install-grub) (install-grub-efi) (install-grub-efi-removable) (install-grub-efi32): Add setting GRUB_PRELOAD_MODULES to lvm. * gnu/tests/install.scm (test-lvm-root-os): New variable. --- gnu/bootloader/grub.scm | 9 +++++ gnu/tests/install.scm | 81 ++++++++++++++++++++++++++++++++++++++++- 2 files changed, 89 insertions(+), 1 deletion(-) diff --git a/gnu/bootloader/grub.scm b/gnu/bootloader/grub.scm index ecd44e7f3c..1e2d142452 100644 --- a/gnu/bootloader/grub.scm +++ b/gnu/bootloader/grub.scm @@ -9,6 +9,7 @@ ;;; Copyright © 2020 Stefan <stefan-guix <at> vodafonemail.de> ;;; Copyright © 2022 Karl Hallsby <karl <at> hallsby.com> ;;; Copyright © 2022 Denis 'GNUtoo' Carikli <GNUtoo <at> cyberdimension.org> +;;; Copyright © 2022 Michael Rohleder <mike <at> rohleder.de> ;;; ;;; This file is part of GNU Guix. ;;; @@ -557,6 +558,8 @@ (define install-grub ;; Tell 'grub-install' that there might be a LUKS-encrypted ;; /boot or root partition. (setenv "GRUB_ENABLE_CRYPTODISK" "y") + ;; Let us boot from lvm + (setenv "GRUB_PRELOAD_MODULES" "lvm") ;; Hide potentially confusing messages from the user, such as ;; "Installing for i386-pc platform." @@ -629,6 +632,8 @@ (define install-grub-efi ;; Tell 'grub-install' that there might be a LUKS-encrypted /boot or ;; root partition. (setenv "GRUB_ENABLE_CRYPTODISK" "y") + ;; Let us boot from lvm + (setenv "GRUB_PRELOAD_MODULES" "lvm") (invoke/quiet grub-install "--boot-directory" install-dir "--bootloader-id=Guix" "--efi-directory" target-esp))))) @@ -652,6 +657,8 @@ (define install-grub-efi-removable ;; Tell 'grub-install' that there might be a LUKS-encrypted /boot or ;; root partition. (setenv "GRUB_ENABLE_CRYPTODISK" "y") + ;; Let us boot from lvm + (setenv "GRUB_PRELOAD_MODULES" "lvm") (invoke/quiet grub-install "--boot-directory" install-dir "--removable" ;; "--no-nvram" @@ -675,6 +682,8 @@ (define install-grub-efi32 ;; Tell 'grub-install' that there might be a LUKS-encrypted /boot or ;; root partition. (setenv "GRUB_ENABLE_CRYPTODISK" "y") + ;; Let us boot from lvm + (setenv "GRUB_PRELOAD_MODULES" "lvm") (invoke/quiet grub-install "--boot-directory" install-dir "--bootloader-id=Guix" (cond ((target-x86?) "--target=i386-efi") diff --git a/gnu/tests/install.scm b/gnu/tests/install.scm index 4e0e274e66..f9d34c1e28 100644 --- a/gnu/tests/install.scm +++ b/gnu/tests/install.scm @@ -5,6 +5,7 @@ ;;; Copyright © 2020 Danny Milosavljevic <dannym <at> scratchpost.org> ;;; Copyright © 2020 Jan (janneke) Nieuwenhuizen <janneke <at> gnu.org> ;;; Copyright © 2020, 2021, 2022 Maxim Cournoyer <maxim.cournoyer <at> gmail.com> +;;; Copyright © 2022 Michael Rohleder <mike <at> rohleder.de> ;;; ;;; This file is part of GNU Guix. ;;; @@ -76,6 +77,7 @@ (define-module (gnu tests install) %test-jfs-root-os %test-f2fs-root-os %test-xfs-root-os + %test-lvm-root-os %test-lvm-separate-home-os %test-gui-installed-os @@ -831,7 +833,6 @@ (define %test-encrypted-root-os ;;; Separate /home on LVM ;;; -;; Since LVM support in guix currently doesn't allow root-on-LVM we use /home on LVM (define-os-with-source (%lvm-separate-home-os %lvm-separate-home-os-source) (use-modules (gnu) (gnu tests)) @@ -913,6 +914,84 @@ (define %test-lvm-separate-home-os `(,@command) "lvm-separate-home-os"))))) + +;;; +;;; LVM root device. +;;; + +(define-os-with-source (%lvm-root-os %lvm-root-os-source) + (use-modules (gnu) (gnu tests)) + + (operating-system + (host-name "root-os-on-lvm") + (timezone "Europe/Paris") + (locale "en_US.utf8") + + (bootloader (bootloader-configuration + (bootloader grub-bootloader) + (targets (list "/dev/vdb")))) + (kernel-arguments '("console=ttyS0")) + + (mapped-devices (list (mapped-device + (source "vg0") + (target "vg0-root") + (type lvm-device-mapping)))) + (file-systems (cons* (file-system + (device "/dev/mapper/vg0-root") + (mount-point "/") + (type "ext4") + (dependencies mapped-devices)) + %base-file-systems)) + (users %base-user-accounts) + (services (cons (service marionette-service-type + (marionette-configuration + (imported-modules '((gnu services herd) + (guix combinators))))) + %base-services)))) + +(define %lvm-root-os-installation-script + "\ +. /etc/profile +set -e -x +guix --version + +export GUIX_BUILD_OPTIONS=--no-grafts +parted --script /dev/vdb mklabel gpt \\ + mkpart primary ext2 1M 3M \\ + mkpart primary 3M 1.7G \\ + set 1 boot on \\ + set 1 bios_grub on +pvcreate /dev/vdb2 +vgcreate vg0 /dev/vdb2 +lvcreate -l 100%FREE -n root vg0 +vgchange -ay +mkfs.ext4 -L root-fs /dev/mapper/vg0-root +mount /dev/mapper/vg0-root /mnt +herd start cow-store /mnt +mkdir /mnt/etc +cp /etc/target-config.scm /mnt/etc/config.scm +guix system init /mnt/etc/config.scm /mnt --no-substitutes +sync +reboot\n") + +(define %test-lvm-root-os + (system-test + (name "lvm-root-os") + (description + "Test functionality of an OS installed with a LVM / partition") + (value + (mlet* %store-monad ((image (run-install %lvm-root-os + %lvm-root-os-source + #:script + %lvm-root-os-installation-script + #:packages (list lvm2-static))) + (command (qemu-command* image + #:memory-size 512))) + (run-basic-test %lvm-root-os + `(,@command) "lvm-root-os"))))) + + + ;;; ;;; LUKS-encrypted /home, unencrypted root. ;;; -- 2.38.1
guix-patches <at> gnu.org
:bug#60442
; Package guix-patches
.
(Tue, 21 Mar 2023 17:40:02 GMT) Full text and rfc822 format available.Message #8 received at 60442 <at> debbugs.gnu.org (full text, mbox):
From: Maxim Cournoyer <maxim.cournoyer <at> gmail.com> To: Michael Rohleder <mike <at> rohleder.de> Cc: 60442 <at> debbugs.gnu.org Subject: Re: bug#60442: [PATCH] bootloader: grub: Add support for root on lvm. Date: Tue, 21 Mar 2023 13:39:38 -0400
Hi Michael, Michael Rohleder <mike <at> rohleder.de> writes: > This fixes <https://issues.guix.gnu.org/44877>. > > * gnu/bootloader/grub.scm (install-grub) > (install-grub-efi) > (install-grub-efi-removable) > (install-grub-efi32): Add setting GRUB_PRELOAD_MODULES to lvm. > * gnu/tests/install.scm (test-lvm-root-os): New variable. > --- > gnu/bootloader/grub.scm | 9 +++++ > gnu/tests/install.scm | 81 ++++++++++++++++++++++++++++++++++++++++- > 2 files changed, 89 insertions(+), 1 deletion(-) > > diff --git a/gnu/bootloader/grub.scm b/gnu/bootloader/grub.scm > index ecd44e7f3c..1e2d142452 100644 > --- a/gnu/bootloader/grub.scm > +++ b/gnu/bootloader/grub.scm > @@ -9,6 +9,7 @@ > ;;; Copyright © 2020 Stefan <stefan-guix <at> vodafonemail.de> > ;;; Copyright © 2022 Karl Hallsby <karl <at> hallsby.com> > ;;; Copyright © 2022 Denis 'GNUtoo' Carikli <GNUtoo <at> cyberdimension.org> > +;;; Copyright © 2022 Michael Rohleder <mike <at> rohleder.de> > ;;; > ;;; This file is part of GNU Guix. > ;;; > @@ -557,6 +558,8 @@ (define install-grub > ;; Tell 'grub-install' that there might be a LUKS-encrypted > ;; /boot or root partition. > (setenv "GRUB_ENABLE_CRYPTODISK" "y") > + ;; Let us boot from lvm > + (setenv "GRUB_PRELOAD_MODULES" "lvm") > > ;; Hide potentially confusing messages from the user, such as > ;; "Installing for i386-pc platform." > @@ -629,6 +632,8 @@ (define install-grub-efi > ;; Tell 'grub-install' that there might be a LUKS-encrypted /boot or > ;; root partition. > (setenv "GRUB_ENABLE_CRYPTODISK" "y") > + ;; Let us boot from lvm > + (setenv "GRUB_PRELOAD_MODULES" "lvm") > (invoke/quiet grub-install "--boot-directory" install-dir > "--bootloader-id=Guix" > "--efi-directory" target-esp))))) > @@ -652,6 +657,8 @@ (define install-grub-efi-removable > ;; Tell 'grub-install' that there might be a LUKS-encrypted /boot or > ;; root partition. > (setenv "GRUB_ENABLE_CRYPTODISK" "y") > + ;; Let us boot from lvm > + (setenv "GRUB_PRELOAD_MODULES" "lvm") > (invoke/quiet grub-install "--boot-directory" install-dir > "--removable" > ;; "--no-nvram" > @@ -675,6 +682,8 @@ (define install-grub-efi32 > ;; Tell 'grub-install' that there might be a LUKS-encrypted /boot or > ;; root partition. > (setenv "GRUB_ENABLE_CRYPTODISK" "y") > + ;; Let us boot from lvm > + (setenv "GRUB_PRELOAD_MODULES" "lvm") > (invoke/quiet grub-install "--boot-directory" install-dir > "--bootloader-id=Guix" > (cond ((target-x86?) "--target=i386-efi") > diff --git a/gnu/tests/install.scm b/gnu/tests/install.scm > index 4e0e274e66..f9d34c1e28 100644 > --- a/gnu/tests/install.scm > +++ b/gnu/tests/install.scm > @@ -5,6 +5,7 @@ > ;;; Copyright © 2020 Danny Milosavljevic <dannym <at> scratchpost.org> > ;;; Copyright © 2020 Jan (janneke) Nieuwenhuizen <janneke <at> gnu.org> > ;;; Copyright © 2020, 2021, 2022 Maxim Cournoyer <maxim.cournoyer <at> gmail.com> > +;;; Copyright © 2022 Michael Rohleder <mike <at> rohleder.de> > ;;; > ;;; This file is part of GNU Guix. > ;;; > @@ -76,6 +77,7 @@ (define-module (gnu tests install) > %test-jfs-root-os > %test-f2fs-root-os > %test-xfs-root-os > + %test-lvm-root-os > %test-lvm-separate-home-os > > %test-gui-installed-os > @@ -831,7 +833,6 @@ (define %test-encrypted-root-os > ;;; Separate /home on LVM > ;;; > > -;; Since LVM support in guix currently doesn't allow root-on-LVM we use /home on LVM > (define-os-with-source (%lvm-separate-home-os %lvm-separate-home-os-source) > (use-modules (gnu) (gnu tests)) > > @@ -913,6 +914,84 @@ (define %test-lvm-separate-home-os > `(,@command) "lvm-separate-home-os"))))) > > > + > +;;; > +;;; LVM root device. > +;;; > + > +(define-os-with-source (%lvm-root-os %lvm-root-os-source) > + (use-modules (gnu) (gnu tests)) > + > + (operating-system > + (host-name "root-os-on-lvm") > + (timezone "Europe/Paris") > + (locale "en_US.utf8") > + > + (bootloader (bootloader-configuration > + (bootloader grub-bootloader) > + (targets (list "/dev/vdb")))) > + (kernel-arguments '("console=ttyS0")) > + > + (mapped-devices (list (mapped-device > + (source "vg0") > + (target "vg0-root") > + (type lvm-device-mapping)))) > + (file-systems (cons* (file-system > + (device "/dev/mapper/vg0-root") > + (mount-point "/") > + (type "ext4") > + (dependencies mapped-devices)) > + %base-file-systems)) > + (users %base-user-accounts) > + (services (cons (service marionette-service-type > + (marionette-configuration > + (imported-modules '((gnu services herd) > + (guix combinators))))) > + %base-services)))) > + > +(define %lvm-root-os-installation-script > + "\ > +. /etc/profile > +set -e -x > +guix --version > + > +export GUIX_BUILD_OPTIONS=--no-grafts > +parted --script /dev/vdb mklabel gpt \\ > + mkpart primary ext2 1M 3M \\ > + mkpart primary 3M 1.7G \\ > + set 1 boot on \\ > + set 1 bios_grub on > +pvcreate /dev/vdb2 > +vgcreate vg0 /dev/vdb2 > +lvcreate -l 100%FREE -n root vg0 > +vgchange -ay > +mkfs.ext4 -L root-fs /dev/mapper/vg0-root > +mount /dev/mapper/vg0-root /mnt > +herd start cow-store /mnt > +mkdir /mnt/etc > +cp /etc/target-config.scm /mnt/etc/config.scm > +guix system init /mnt/etc/config.scm /mnt --no-substitutes > +sync > +reboot\n") > + > +(define %test-lvm-root-os > + (system-test > + (name "lvm-root-os") > + (description > + "Test functionality of an OS installed with a LVM / partition") > + (value > + (mlet* %store-monad ((image (run-install %lvm-root-os > + %lvm-root-os-source > + #:script > + %lvm-root-os-installation-script > + #:packages (list lvm2-static))) > + (command (qemu-command* image > + #:memory-size 512))) > + (run-basic-test %lvm-root-os > + `(,@command) "lvm-root-os"))))) > + > + > + Thanks for this patch. I've applied the change locally, and wanted to see the test fail first, so I've reverted the following: --8<---------------cut here---------------start------------->8--- Unstaged changes (1) modified gnu/bootloader/grub.scm @@ -632,8 +632,6 @@ (define install-grub-efi ;; Tell 'grub-install' that there might be a LUKS-encrypted /boot or ;; root partition. (setenv "GRUB_ENABLE_CRYPTODISK" "y") - ;; Let us boot from lvm - (setenv "GRUB_PRELOAD_MODULES" "lvm") (invoke/quiet grub-install "--boot-directory" install-dir "--bootloader-id=Guix" "--efi-directory" target-esp))))) @@ -657,8 +655,6 @@ (define install-grub-efi-removable ;; Tell 'grub-install' that there might be a LUKS-encrypted /boot or ;; root partition. (setenv "GRUB_ENABLE_CRYPTODISK" "y") - ;; Let us boot from lvm - (setenv "GRUB_PRELOAD_MODULES" "lvm") (invoke/quiet grub-install "--boot-directory" install-dir "--removable" ;; "--no-nvram" @@ -682,8 +678,6 @@ (define install-grub-efi32 ;; Tell 'grub-install' that there might be a LUKS-encrypted /boot or ;; root partition. (setenv "GRUB_ENABLE_CRYPTODISK" "y") - ;; Let us boot from lvm - (setenv "GRUB_PRELOAD_MODULES" "lvm") (invoke/quiet grub-install "--boot-directory" install-dir "--bootloader-id=Guix" (cond ((target-x86?) "--target=i386-efi") --8<---------------cut here---------------end--------------->8--- And to my surprise 'make check-system TESTS=lvm-root-os' passed: --8<---------------cut here---------------start------------->8--- %%%% Starting test basic (Writing full log to "/gnu/store/m3rifzddpnc4x47r7nhfjkms97nzrc69-lvm-root-os/b) marionette is ready PASS: uname PASS: shepherd socket ready PASS: stdin is /dev/null PASS: shell and user commands PASS: special files PASS: accounts ;;; (services (guix-daemon syslogd mcron console-font-tty3 file-system-/dev/shm console-font-tty5 file-sy) PASS: shepherd services PASS: libc honors /etc/localtime PASS: /var/log/messages is not world-readable PASS: homes PASS: skeletons in home directories PASS: permissions on /root PASS: ownership and permissions of /var/empty PASS: no extra home directories PASS: login on tty1 PASS: getlogin on tty1 PASS: utmpx entry PASS: wtmp entry PASS: host name resolution PASS: nscd configuration action PASS: nscd invalidate action SKIP: nscd invalidate action, wrong table PASS: host not found PASS: locale PASS: /run/current-system is a GC root PASS: /var/guix/gcroots/profiles is a valid symlink PASS: guix-daemon set-http-proxy action PASS: guix-daemon set-http-proxy action, clear PASS: screendump PASS: screen text # of expected passes 29 # of skipped tests 1 Some deprecated features have been used. Set the environment variable GUILE_WARN_DEPRECATED to "detailed" and rerun the program to get more information. Set it to "no" to suppress this message. successfully built /gnu/store/69naxa7pcjlkn25xz033964z3vgp5c9d-lvm-root-os.drv /gnu/store/m3rifzddpnc4x47r7nhfjkms97nzrc69-lvm-root-os --8<---------------cut here---------------end--------------->8--- Are you sure this change is really needed? Otherwise why would the test pass even without the change? -- Thanks, Maxim
guix-patches <at> gnu.org
:bug#60442
; Package guix-patches
.
(Thu, 23 Mar 2023 03:20:01 GMT) Full text and rfc822 format available.Message #11 received at 60442 <at> debbugs.gnu.org (full text, mbox):
From: Michael Rohleder <mike <at> rohleder.de> To: Maxim Cournoyer <maxim.cournoyer <at> gmail.com> Cc: 60442 <at> debbugs.gnu.org Subject: Re: bug#60442: [PATCH] bootloader: grub: Add support for root on lvm. Date: Thu, 23 Mar 2023 04:17:14 +0100
[Message part 1 (text/plain, inline)]
Hi Maxim, Maxim Cournoyer <maxim.cournoyer <at> gmail.com> writes: > Are you sure this change is really needed? Otherwise why would the test > pass even without the change? No, after reading #62140, I'm not sure. That means the test is also wrong, which I don't understand. -- All generalizations are bad.
[signature.asc (application/pgp-signature, inline)]
Josselin Poiret <dev <at> jpoiret.xyz>
:Michael Rohleder <mike <at> rohleder.de>
:Message #16 received at 60442-done <at> debbugs.gnu.org (full text, mbox):
From: Josselin Poiret <dev <at> jpoiret.xyz> To: Michael Rohleder <mike <at> rohleder.de>, Maxim Cournoyer <maxim.cournoyer <at> gmail.com> Cc: 60442-done <at> debbugs.gnu.org Subject: Re: [bug#60442] [PATCH] bootloader: grub: Add support for root on lvm. Date: Wed, 17 May 2023 22:42:33 +0200
[Message part 1 (text/plain, inline)]
Hi, Michael Rohleder <mike <at> rohleder.de> writes: > No, after reading #62140, I'm not sure. > That means the test is also wrong, which I don't understand. I don't have an LVM system to test on, but I'm pretty sure we just need to add the corresponding insmod when an LVM mapping is used. In the meantime, closing this bug, please refer to #62140 for more discussion. Best, -- Josselin Poiret
[signature.asc (application/pgp-signature, inline)]
Debbugs Internal Request <help-debbugs <at> gnu.org>
to internal_control <at> debbugs.gnu.org
.
(Thu, 15 Jun 2023 11:24:08 GMT) Full text and rfc822 format available.
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.