Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 718910 - sys-fs/lvm2 - change "device-mapper-only" to "lvm"
Summary: sys-fs/lvm2 - change "device-mapper-only" to "lvm"
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Gentoo's Team for Core System packages
URL:
Whiteboard:
Keywords: PullRequest
Depends on:
Blocks:
 
Reported: 2020-04-22 16:48 UTC by jan vereecke
Modified: 2023-10-05 19:22 UTC (History)
5 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description jan vereecke 2020-04-22 16:48:36 UTC
I am trying to create a system without lvm, and build udesks with -lvm flag.
udesks does not pull in lvm because of the -lvm flag, but it pulls in libblockdev with mandatory cryptsetup use flag.
libblockdev pulls in sys-fs/cryptsetup.
sys-fs/cryptsetup then unconditionally pulls in lvm2.
This should not happen. and can be prevented by having cryptsetup honor the lvm flag.

Reproducible: Always

Steps to Reproduce:
1. set USE="-lvm" in make.conf
2. emerge -uDN udisks
3. lvm2 is pulled in due to cryptsetup.
Actual Results:  
sys-fs/lvm2 is emerged even when use flag -lvm says it should not be.

Expected Results:  
USE flag -lvm in make.conf should make sure that package lvm is never emerged.
Comment 1 Lars Wendler (Polynomial-C) (RETIRED) gentoo-dev 2020-04-22 17:24:46 UTC
I do not see a possibility to make lvm optional in sys-fs/cryptsetup. There's a non-optional configure check for libdevmapper which belongs to sys-fs/lvm2:

  https://gitlab.com/cryptsetup/cryptsetup/-/blob/master/configure.ac#L71

The only other solution I can see here is to install sys-fs/lvm2 with USE="device-mapper-only" which does what the USE flag says, it's only installing device-mapper stuff. Would that be a feasible alternative to you?
Comment 2 jan vereecke 2020-04-26 16:48:54 UTC
This would meet the goal of removing parts that are unnecessary bloat, while keeping essential functionality.

My concern with this kind of use flags is twofold: 
They are relatively hard to understand for someone who does not delve deeply in the details of a package, so that means that the meaning of this use flag may need some more description that just 'emerges the device mapper only'.
So if I want to globally set -lvm, I may understand what logical volumes are, as they are something on a user level, but not what the device mapper is, as that is more of an implementation issue. Also the relation to the global -lvm flag may not be clear.

The second concern is that according to its name this is one flag that enables/disable two things: the logical volume management  and the device mapper. I believe there is more flexibility to have one flag for each thing that you want to enable/disable.

So I guess there should be in fact two local flags: lvm and device-mapper with the semantics that the first emerges the 'logical volumes' and the second the device mapper'.

They would have the following relation in the lvm2 ebuild:
if lvm is set, then device-mapper must be set.
if lvm is unset, then device mapper is free to be enabled, and can be required by depending packages.

In this way, cryptsetup can specify it requires sys-fs/lvm2[device-mapper]. This is more logical than requiring sys-fs/cryptsetup[device-mapper-only].
Comment 3 Mike Gilbert gentoo-dev 2020-04-26 18:14:27 UTC
(In reply to jan vereecke from comment #2)

What would happen if the user has USE="-lvm -device-mapper"? I suspect we would end up installing nothing, which doesn't make any sense. I think the "device-mapper" USE flag would serve no useful purpose.

However, changing "device-mapper-only" to "lvm" and inverting its logic definitely makes sense. Enabling USE flags should add functionality, not remove it.
Comment 4 jan vereecke 2020-04-27 18:20:20 UTC
That would work and makes sense. packages such as cryptsetup would then only depend on sys-fs/lvm2, whereas packages requiring lvm functionality would need sys-fs/lvm2[lvm], and it would follow the global meaning of the lvm flag.
Comment 5 Larry the Git Cow gentoo-dev 2022-10-28 17:50:01 UTC
The bug has been closed via the following commit(s):

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=f613f36003b14030478b90d57f908d63e2097a82

commit f613f36003b14030478b90d57f908d63e2097a82
Author:     David Seifert <soap@gentoo.org>
AuthorDate: 2022-10-28 17:49:52 +0000
Commit:     David Seifert <soap@gentoo.org>
CommitDate: 2022-10-28 17:49:52 +0000

    sys-fs/lvm2: switch to positive USE=lvm logic
    
    Closes: https://github.com/gentoo/gentoo/pull/27994
    Closes: https://bugs.gentoo.org/718910
    Signed-off-by: David Seifert <soap@gentoo.org>

 ...irt-7.7.0-r2.ebuild => libvirt-7.7.0-r3.ebuild} |   4 +-
 ...ibvirt-8.2.0.ebuild => libvirt-8.2.0-r1.ebuild} |   4 +-
 ...ibvirt-8.7.0.ebuild => libvirt-8.7.0-r1.ebuild} |   4 +-
 ...ibvirt-8.8.0.ebuild => libvirt-8.8.0-r1.ebuild} |   4 +-
 app-emulation/libvirt/libvirt-9999.ebuild          |   4 +-
 ...{ceph-15.2.17.ebuild => ceph-15.2.17-r1.ebuild} |   2 +-
 ...ph-16.2.10-r2.ebuild => ceph-16.2.10-r3.ebuild} |   2 +-
 ...ceph-16.2.9-r2.ebuild => ceph-16.2.9-r3.ebuild} |   2 +-
 ...ceph-17.2.3-r3.ebuild => ceph-17.2.3-r4.ebuild} |   2 +-
 .../{ceph-17.2.4.ebuild => ceph-17.2.4-r1.ebuild}  |   2 +-
 .../{ceph-17.2.5.ebuild => ceph-17.2.5-r1.ebuild}  |   2 +-
 ...1.46.5-r1.ebuild => e2fsprogs-1.46.5-r3.ebuild} |   2 +-
 ...1.46.5-r2.ebuild => e2fsprogs-1.46.5-r4.ebuild} |   2 +-
 ...m2-2.03.14-r3.ebuild => lvm2-2.03.14-r4.ebuild} |  33 ++---
 ...{lvm2-2.03.16.ebuild => lvm2-2.03.16-r1.ebuild} | 137 +++++++++++----------
 sys-fs/lvm2/metadata.xml                           |   2 +-
 16 files changed, 107 insertions(+), 101 deletions(-)
Comment 6 Snail 2022-12-04 18:40:34 UTC
Hello,

I would like to humbly point out that, from a user point of view, installing only device-mapper when emerging lvm is not something that really "makes sense".
I mean that when a user installs lvm, they expect lvm to be installed, don't you think ?
Plus, it might break installations of people using lvm but not reading carefully gentoo news. 

That is how it works on other distros. I must admit that this is not the kind of argument I like but who cares...

Maybe ( I do not create gentoo packages so I do not know if this is a stupid idea), a best idea would be to create a device-mapper package being a subset of sys-fs/lvm2.

Anyway, this seems risky. Please reconsider or at least create a poll to ask gentoo people if they agree ;-) .
Comment 7 Larry the Git Cow gentoo-dev 2023-01-01 21:05:26 UTC
The bug has been closed via the following commit(s):

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=e31bcf83eb070afb477f68cf9e22387a3f95e592

commit e31bcf83eb070afb477f68cf9e22387a3f95e592
Author:     Sam James <sam@gentoo.org>
AuthorDate: 2023-01-01 21:04:20 +0000
Commit:     Sam James <sam@gentoo.org>
CommitDate: 2023-01-01 21:04:37 +0000

    sys-fs/lvm2: disable LVM and thin by default
    
    See https://www.gentoo.org/support/news-items/2022-11-19-lvm2-default-USE-flags.html.
    
    Closes: https://bugs.gentoo.org/476908
    Closes: https://bugs.gentoo.org/718910
    Signed-off-by: Sam James <sam@gentoo.org>

 sys-fs/lvm2/lvm2-2.03.14-r5.ebuild | 4 ++--
 sys-fs/lvm2/lvm2-2.03.17-r1.ebuild | 4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)
Comment 8 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2023-01-01 23:43:37 UTC
(In reply to Snail from comment #6)
> Hello,
> 
> I would like to humbly point out that, from a user point of view, installing
> only device-mapper when emerging lvm is not something that really "makes
> sense".
> I mean that when a user installs lvm, they expect lvm to be installed, don't
> you think ?

I think the improved USE flag description for LVM should help.

> Plus, it might break installations of people using lvm but not reading
> carefully gentoo news. 

The news item mechanism is for "critical news". I'm not sure we can do much better than that.

> Maybe ( I do not create gentoo packages so I do not know if this is a stupid
> idea), a best idea would be to create a device-mapper package being a subset
> of sys-fs/lvm2.
> 

Unfortunately, this isn't easily done because of how LVM's build system is.
Comment 9 Kobboi 2023-01-03 17:54:02 UTC
Without USE=lvm, dracut does not create an initramfs that supports logical volumes. USE=initramfs (using dracut) is a gentoo-kernel (and likely a dist-kernel default) via kernel-install.eclass. 

Spent a couple of hours figuring out why my system wouldn't boot today. I admit I did not see the news item, but it would be nice if a user would be better protected, no? Using logical volumes is something I would assume a fair percentage of users do.
Comment 10 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2023-01-03 17:55:34 UTC
(In reply to Kobboi from comment #9)
> Without USE=lvm, dracut does not create an initramfs that supports logical
> volumes. USE=initramfs (using dracut) is a gentoo-kernel (and likely a
> dist-kernel default) via kernel-install.eclass. 
> 
> Spent a couple of hours figuring out why my system wouldn't boot today. I
> admit I did not see the news item, but it would be nice if a user would be
> better protected, no? Using logical volumes is something I would assume a
> fair percentage of users do.

It's hard for us to change anything if people don't see news items.
Comment 11 Kobboi 2023-01-03 18:36:01 UTC
Without USE=lvm, dracut does not create an initramfs that supports logical volumes. USE=initramfs (using dracut) is a gentoo-kernel (and likely a dist-kernel default) via kernel-install.eclass.

Spent a couple of hours figuring out why my system wouldn't boot today. I admit I did not see the news item, but it would be nice if a user would be better protected, no? Using logical volumes is something I would assume a fair percentage of users do.
Comment 12 Kobboi 2023-01-03 18:36:39 UTC
Oops, I thought my earlier post failed, sorry for the repost
Comment 13 Kobboi 2023-01-03 18:37:51 UTC
(In reply to Sam James from comment #10)
> (In reply to Kobboi from comment #9)
> > Without USE=lvm, dracut does not create an initramfs that supports logical
> > volumes. USE=initramfs (using dracut) is a gentoo-kernel (and likely a
> > dist-kernel default) via kernel-install.eclass. 
> > 
> > Spent a couple of hours figuring out why my system wouldn't boot today. I
> > admit I did not see the news item, but it would be nice if a user would be
> > better protected, no? Using logical volumes is something I would assume a
> > fair percentage of users do.
> 
> It's hard for us to change anything if people don't see news items.

True, but what in case of a fresh install?
Comment 14 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2023-01-03 18:42:13 UTC
I think a compromise might be to display an ewarn if:
1. changing from USE=lvm -> USE=-lvm, or
2. fresh install and USE=-lvm.
Comment 15 Larry the Git Cow gentoo-dev 2023-01-15 15:12:32 UTC
The bug has been referenced in the following commit(s):

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=793e2d209234d2e90ca28f37f5474d619b455f9f

commit 793e2d209234d2e90ca28f37f5474d619b455f9f
Author:     Sam James <sam@gentoo.org>
AuthorDate: 2023-01-15 15:10:34 +0000
Commit:     Sam James <sam@gentoo.org>
CommitDate: 2023-01-15 15:12:24 +0000

    sys-fs/lvm2: add pkg_postinst warning for USE=lvm -> USE=-lvm
    
    I was reluctant to do this because we already published a news item
    (and it's the critical news item mechanism for a reason) but if it saves
    someone some pain, it's worth it, and it's cheap to do.
    
    Show a warning for USE=-lvm -> USE=lvm or for fresh installs with USE=-lvm
    as a one-off.
    
    But warnings are not a substitute for reading news items, so this is mostly
    for the benefit of new users who might be confused about how to get the tools
    they're familiar with.
    
    Bug: https://bugs.gentoo.org/718910
    Bug: https://bugs.gentoo.org/890254
    Signed-off-by: Sam James <sam@gentoo.org>

 ...m2-2.03.17-r1.ebuild => lvm2-2.03.17-r2.ebuild} | 39 ++++++++++++++++------
 1 file changed, 28 insertions(+), 11 deletions(-)
Comment 16 flasch 2023-08-22 16:27:03 UTC
This is a insane bug and patch because : LVM2 is mostly to use on real HD's and it's functions are like using fdisk or part etc .  It's a low level partitioning system not just  device-mapper or other misc functions .  When I install lvm2 I expect to get LVM2 not a useless system .   OK you put this change in the gentoo NEWS system , but that isn't the problem here .  The problem is you need to query all the flags to figure out how to install a real LVM2 system that matches the documentation for LVM2 .  All of this begs the question why call this LVM2 at all , since it now as a default installs a useless system ?   The logic here is just bad , the patch is bad , etc .
Comment 17 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2023-08-22 16:36:05 UTC
(In reply to flasch from comment #16)
> This is a insane bug and patch because : LVM2 is mostly to use on real HD's
> and it's functions are like using fdisk or part etc .  It's a low level
> partitioning system not just  device-mapper or other misc functions .  When
> I install lvm2 I expect to get LVM2 not a useless system .   OK you put this
> change in the gentoo NEWS system , but that isn't the problem here .  The
> problem is you need to query all the flags to figure out how to install a
> real LVM2 system that matches the documentation for LVM2 .

You need to do this in general on Gentoo to make sure USE flags do what you want.

>  All of this begs
> the question why call this LVM2 at all , since it now as a default installs
> a useless system ?   The logic here is just bad , the patch is bad , etc .

And yet many people have it installed only for dm or as a library.