GNU bug report logs - #62140
enable LVM in Grub

Previous Next

Package: guix;

Reported by: Emmanuel Beffara <manu <at> beffara.org>

Date: Sun, 12 Mar 2023 07:17:02 UTC

Severity: normal

To reply to this bug, email your comments to 62140 AT debbugs.gnu.org.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-guix <at> gnu.org:
bug#62140; Package guix. (Sun, 12 Mar 2023 07:17:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Emmanuel Beffara <manu <at> beffara.org>:
New bug report received and forwarded. Copy sent to bug-guix <at> gnu.org. (Sun, 12 Mar 2023 07:17:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Emmanuel Beffara <manu <at> beffara.org>
To: bug-guix <at> gnu.org
Subject: enable LVM in Grub
Date: Sat, 11 Mar 2023 19:02:06 +0100
Hello Guix,

Unless I missed something in the configuration process, the `grub.cfg`
generated by `guix system reconfigure` does not enable LVM, even if the store
is in an LVM volume. The immediate consequence is that Grub cannot load its
data files nor boot the system. The fix is as simple as adding `insmod lvm` in
`grub.cfg` before any `search` command, which I do by hand on each
`reconfigure`, but obviously Guix itself should do that.

I looked at `grub.scm` to see where things happen, and I see no mention of LVM
in this file. This surprises me because I am probably not the only one using
it. Actually, I use LVM on LUKS for full-system encryption, but this is
probably not rare either.

-- 
Emmanuel




Information forwarded to bug-guix <at> gnu.org:
bug#62140; Package guix. (Mon, 13 Mar 2023 13:59:02 GMT) Full text and rfc822 format available.

Message #8 received at 62140 <at> debbugs.gnu.org (full text, mbox):

From: Michael Rohleder <mike <at> rohleder.de>
To: Emmanuel Beffara <manu <at> beffara.org>
Cc: 62140 <at> debbugs.gnu.org, 44877 <at> debbugs.gnu.org
Subject: Re: bug#62140: enable LVM in Grub
Date: Mon, 13 Mar 2023 14:56:15 +0100
[Message part 1 (text/plain, inline)]
Hello Emmanuel!

Thx for the report!

I think this is bug 44877, maybe we can/should merge it.
Here [1] is a patch (and testcase).


[1]  https://issues.guix.gnu.org/60442
-- 
Man braucht zwei Jahre, um sprechen zu lernen,
und fünfzig, um schweigen zu lernen.     E.Hemingway
[signature.asc (application/pgp-signature, inline)]

Information forwarded to bug-guix <at> gnu.org:
bug#62140; Package guix. (Tue, 14 Mar 2023 21:27:02 GMT) Full text and rfc822 format available.

Message #11 received at 62140 <at> debbugs.gnu.org (full text, mbox):

From: Emmanuel Beffara <manu <at> beffara.org>
To: Michael Rohleder <mike <at> rohleder.de>
Cc: 62140 <at> debbugs.gnu.org, 44877 <at> debbugs.gnu.org
Subject: Re: bug#62140: enable LVM in Grub
Date: Tue, 14 Mar 2023 22:26:28 +0100
De Michael Rohleder le 13/03/2023 à 14:56:
> Hello Emmanuel!
> 
> Thx for the report!
> 
> I think this is bug 44877, maybe we can/should merge it.
> Here [1] is a patch (and testcase).
> 
> 
> [1]  https://issues.guix.gnu.org/60442

Indeed, it seems to be the same issue.

However, the patch sets the value of `GRUB_PRELOAD_MODULES`, which afaik is
used by `grub-mkconfig` to produce `grub.cfg`, but there seems to be code in
`grub.scm` that also produces `grub.cfg`, and no call to `grub-mkconfig`
there. I'm not sure I understand how all this works anyway…

-- 
Emmanuel




Information forwarded to bug-guix <at> gnu.org:
bug#62140; Package guix. (Thu, 23 Mar 2023 12:49:02 GMT) Full text and rfc822 format available.

Message #14 received at 62140 <at> debbugs.gnu.org (full text, mbox):

From: Maxim Cournoyer <maxim.cournoyer <at> gmail.com>
To: Emmanuel Beffara <manu <at> beffara.org>
Cc: 62140 <at> debbugs.gnu.org, Michael Rohleder <mike <at> rohleder.de>,
 44877 <at> debbugs.gnu.org
Subject: Re: bug#62140: enable LVM in Grub
Date: Thu, 23 Mar 2023 08:48:46 -0400
Hi,

Emmanuel Beffara <manu <at> beffara.org> writes:

> De Michael Rohleder le 13/03/2023 à 14:56:
>> Hello Emmanuel!
>> 
>> Thx for the report!
>> 
>> I think this is bug 44877, maybe we can/should merge it.
>> Here [1] is a patch (and testcase).
>> 
>> 
>> [1]  https://issues.guix.gnu.org/60442
>
> Indeed, it seems to be the same issue.
>
> However, the patch sets the value of `GRUB_PRELOAD_MODULES`, which afaik is
> used by `grub-mkconfig` to produce `grub.cfg`, but there seems to be code in
> `grub.scm` that also produces `grub.cfg`, and no call to `grub-mkconfig`
> there. I'm not sure I understand how all this works anyway…

Guix indeed takes care to generate the grub.cfg itself, via the
make-grub-configuration procedure from (gnu bootloader grub), and
grub-mkconfig is *not* used.

grub-install is used though, so perhaps GRUB_PRELOAD_MODULES could be
honored by it (although it's not documented so I doubt it).  It seems to
me that since we produce grub.cfg ourselves if there's something to add
there for LVM support (which I'm not sure there is -- apparently it
already works for you ?), it should be explicitly coded in (gnu
bootloader grub).

info '(grub) Changes from GRUB Legacy' mentions that "* GRUB 2 can read
files directly from LVM and RAID devices.", so I would think there's
nothing special to do?

-- 
Thanks,
Maxim




Information forwarded to bug-guix <at> gnu.org:
bug#62140; Package guix. (Fri, 24 Mar 2023 08:24:02 GMT) Full text and rfc822 format available.

Message #17 received at 62140 <at> debbugs.gnu.org (full text, mbox):

From: Emmanuel Beffara <manu <at> beffara.org>
To: Maxim Cournoyer <maxim.cournoyer <at> gmail.com>
Cc: 62140 <at> debbugs.gnu.org, Michael Rohleder <mike <at> rohleder.de>,
 44877 <at> debbugs.gnu.org
Subject: Re: bug#62140: enable LVM in Grub
Date: Thu, 23 Mar 2023 15:58:19 +0100
Hello,

De Maxim Cournoyer le 23/03/2023 à 13:48:
> It seems to me that since we produce grub.cfg ourselves if there's something
> to add there for LVM support (which I'm not sure there is -- apparently it
> already works for you ?), it should be explicitly coded in (gnu bootloader
> grub).

It does not work for me, that is why I reported this! The system does not boot
unless I manually add `insmod lvm` in `grub.cfg` because Grub does not find
the partition that contains the store.

So I agree something has to be done there.

> info '(grub) Changes from GRUB Legacy' mentions that "* GRUB 2 can read
> files directly from LVM and RAID devices.", so I would think there's nothing
> special to do?

As I understand it, this just means that Grub 2 has a module for reading LVM
devices and a module for reading RAID devices. But it still has to load them
somehow (unless there is a way to include them statically so they are
available from the beginning).

-- 
Emmanuel




Information forwarded to bug-guix <at> gnu.org:
bug#62140; Package guix. (Fri, 24 Mar 2023 16:31:02 GMT) Full text and rfc822 format available.

Message #20 received at 62140 <at> debbugs.gnu.org (full text, mbox):

From: Maxim Cournoyer <maxim.cournoyer <at> gmail.com>
To: Emmanuel Beffara <manu <at> beffara.org>
Cc: 62140 <at> debbugs.gnu.org, Michael Rohleder <mike <at> rohleder.de>,
 44877 <at> debbugs.gnu.org
Subject: Re: bug#62140: enable LVM in Grub
Date: Fri, 24 Mar 2023 08:24:30 -0400
Hi,

Emmanuel Beffara <manu <at> beffara.org> writes:

> Hello,
>
> De Maxim Cournoyer le 23/03/2023 à 13:48:
>> It seems to me that since we produce grub.cfg ourselves if there's something
>> to add there for LVM support (which I'm not sure there is -- apparently it
>> already works for you ?), it should be explicitly coded in (gnu bootloader
>> grub).
>
> It does not work for me, that is why I reported this! The system does not boot
> unless I manually add `insmod lvm` in `grub.cfg` because Grub does not find
> the partition that contains the store.
>
> So I agree something has to be done there.

OK, thanks for explaining.  Could you please try
https://issues.guix.gnu.org/60442 (by applying the patch to a local guix
checkout, building it, then 'sudo -E ./pre-inst-env sudo guix system
reconfigure /path/to/your/config.scm)?  The test suite was broken it
seems (it passed without the fix), but perhaps the fix still does work?

-- 
Thanks,
Maxim




Information forwarded to bug-guix <at> gnu.org:
bug#62140; Package guix. (Tue, 28 Mar 2023 12:33:02 GMT) Full text and rfc822 format available.

Message #23 received at 62140 <at> debbugs.gnu.org (full text, mbox):

From: Emmanuel Beffara <manu <at> beffara.org>
To: Maxim Cournoyer <maxim.cournoyer <at> gmail.com>
Cc: 62140 <at> debbugs.gnu.org, Michael Rohleder <mike <at> rohleder.de>,
 44877 <at> debbugs.gnu.org
Subject: Re: bug#62140: enable LVM in Grub
Date: Tue, 28 Mar 2023 14:32:36 +0200
Hi,

De Maxim Cournoyer le 24/03/2023 à 13:24:
> OK, thanks for explaining.  Could you please try
> https://issues.guix.gnu.org/60442 (by applying the patch to a local guix
> checkout, building it, then 'sudo -E ./pre-inst-env sudo guix system
> reconfigure /path/to/your/config.scm)?  The test suite was broken it
> seems (it passed without the fix), but perhaps the fix still does work?

I did as you suggested, and unfortunately the patch has no observable effect
on my system.

I can't say it comes as a surprise. Indeed, what the patch does is set the
environment variable `GRUB_PRELOAD_MODULES` before calling `grub-install`,
which is expected to have no effect: this variable is used by `grub-mkconfig`
to generate a `grub.cfg`, but the code in Guix assembles a Grub configuration
file itself and never calls `grub-mkconfig`. The same applies to the variable
`GRUB_ENABLE_CRYPTODISK`, by the way. Maybe the way `grub.cfg` is produced has
changed at some point in history ?

The only hypothesis I can make is that it would influence `grub-install` by
preloading the given modules in the installed image, but that is not the case.
According to Grub's documentation, passing `--modules=...` to `grub-install`
would have this effect, but I'm not sure it is the right approach.

-- 
Emmanuel




Information forwarded to bug-guix <at> gnu.org:
bug#62140; Package guix. (Tue, 28 Mar 2023 14:11:02 GMT) Full text and rfc822 format available.

Message #26 received at 62140 <at> debbugs.gnu.org (full text, mbox):

From: Maxim Cournoyer <maxim.cournoyer <at> gmail.com>
To: Emmanuel Beffara <manu <at> beffara.org>
Cc: 62140 <at> debbugs.gnu.org, Michael Rohleder <mike <at> rohleder.de>,
 44877 <at> debbugs.gnu.org
Subject: Re: bug#62140: enable LVM in Grub
Date: Tue, 28 Mar 2023 10:10:37 -0400
Hi,

Emmanuel Beffara <manu <at> beffara.org> writes:

> Hi,
>
> De Maxim Cournoyer le 24/03/2023 à 13:24:
>> OK, thanks for explaining.  Could you please try
>> https://issues.guix.gnu.org/60442 (by applying the patch to a local guix
>> checkout, building it, then 'sudo -E ./pre-inst-env sudo guix system
>> reconfigure /path/to/your/config.scm)?  The test suite was broken it
>> seems (it passed without the fix), but perhaps the fix still does work?
>
> I did as you suggested, and unfortunately the patch has no observable effect
> on my system.

Thanks for testing it!

> I can't say it comes as a surprise. Indeed, what the patch does is set the
> environment variable `GRUB_PRELOAD_MODULES` before calling `grub-install`,
> which is expected to have no effect: this variable is used by `grub-mkconfig`
> to generate a `grub.cfg`, but the code in Guix assembles a Grub configuration
> file itself and never calls `grub-mkconfig`. The same applies to the variable
> `GRUB_ENABLE_CRYPTODISK`, by the way. Maybe the way `grub.cfg` is produced has
> changed at some point in history ?

I'm not sure, but I agree it's confusing to have extraneous setenv
there if they serve no purpose (and my understanding is the same as
yours: I don't see how that'd work).

> The only hypothesis I can make is that it would influence `grub-install` by
> preloading the given modules in the installed image, but that is not the case.
> According to Grub's documentation, passing `--modules=...` to `grub-install`
> would have this effect, but I'm not sure it is the right approach.

Since we already generate a custom grub.cfg, the right approach is
probably to add any needed directive directly to it.

-- 
Thanks,
Maxim




Information forwarded to bug-guix <at> gnu.org:
bug#62140; Package guix. (Tue, 23 Jan 2024 21:11:02 GMT) Full text and rfc822 format available.

Message #29 received at 62140 <at> debbugs.gnu.org (full text, mbox):

From: Erik Eduardo <erikeah <at> protonmail.com>
To: 62140 <at> debbugs.gnu.org
Subject: enable LVM in Grub
Date: Tue, 23 Jan 2024 16:36:45 +0000
[Message part 1 (text/plain, inline)]
I could correctly implement lvm as root (I think), however there is any intention on support this on guix? Let me know and I will try to send a patch.
[Message part 2 (text/html, inline)]

This bug report was last modified 1 year and 151 days ago.

Previous Next


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