Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 807349 - sys-auth/elogind: cgroup mode should be set as a USE flag
Summary: sys-auth/elogind: cgroup mode should be set as a USE flag
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Andreas Sturmlechner
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2021-08-10 01:15 UTC by Maciej S. Szmigiero
Modified: 2024-01-29 11:42 UTC (History)
3 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 Maciej S. Szmigiero 2021-08-10 01:15:18 UTC
Currently the sys-auth/elogind package ebuild tries to autodetect the system cgroup mode in its src_configure() phase.

These are some issues with that:
1) The /etc/rc.conf parser for performing the autodetection does not work correctly.

For example, having:
> #rc_cgroup_mode="hybrid"
> rc_cgroup_mode="unified"
in /etc/rc.conf results in "-Ddefault-hierarchy=legacy".

The "legacy" default hierarchy is also selected when /etc/rc.conf does not have any "rc_cgroup_mode" setting (even one that's commented out), despite OpenRC actually using "hybrid" in this case.

2) The setting in /etc/rc.conf can be changed at any time.
The sys-auth/elogind package does not give any external hints that it needs to be rebuilt in this case.


For the above reasons I think this setting should be at least made into USE flags (or similar things) so it's obvious that it needs to be adapted accordingly if it is changed in OpenRC (as long as it isn't possible to make this runtime-configurable for elogind, like it is for OpenRC).
Comment 1 Andreas Sturmlechner gentoo-dev 2021-08-15 11:26:46 UTC
Or maybe we should set a better distribution default.
Comment 2 Maciej S. Szmigiero 2021-08-15 12:15:06 UTC
(In reply to Andreas Sturmlechner from comment #1)
> Or maybe we should set a better distribution default.

Can you elaborate what do you mean by that?

The default OpenRC rc_cgroup_mode of "hybrid" seems reasonable to me, since some controllers aren't yet available in the cgroups v2 (unified hierarchy).
Comment 3 Sven Eden 2021-11-16 07:11:39 UTC
(In reply to Maciej S. Szmigiero from comment #0)
> For example, having:
> > #rc_cgroup_mode="hybrid"
> > rc_cgroup_mode="unified"
> in /etc/rc.conf results in "-Ddefault-hierarchy=legacy".

That's not good!

However, the option in elogind is *ONLY* meant for the situation when elogind has to be a fake cgroup controller. If there is one on the machine, the build option about the cgroup system does nothing at all.

It was added exclusively for VOID linux, that does not come with a cgroup controller of their own.

On machines where a cgroup controller is running, like openrc, elogind detects the used variant on startup, exactly like systemd-logind does.
Comment 4 Piotr Karbowski (RETIRED) gentoo-dev 2021-11-16 10:46:28 UTC
What we do in ebuild, probing the filesystem of build machine to determinate cgroups configuration is wrong. It creates flawed bin packages.

In this case USE flags are to go, one of cgroups-hybrid, cgroups-legacy, cgroups-unified. Thoughts on it before I commit it to tree?
Comment 5 Piotr Karbowski (RETIRED) gentoo-dev 2021-11-16 23:26:05 UTC
Looking thought the code I see that it will fallback to legacy if kernel do not support cgroup controller, and in case it does but it is not mounted, elogind will mount it. In this case there's no reason to have legacy USE flag, what we can do is have 'hybrid' as default, and 'unified' around in IUSE, with || (hybrid unified). This should cover all the use cases.

Unless anyone sees a problem with it, I will revbump it with USE flags tomorrow.
Comment 6 Andreas Sturmlechner gentoo-dev 2021-11-17 09:53:53 UTC
Why such complexity when you can do it with one flag?
Comment 7 Piotr Karbowski (RETIRED) gentoo-dev 2021-11-17 11:45:27 UTC
I can, sure, -unified flag that goes hybrid then. Will do.
Comment 8 Larry the Git Cow gentoo-dev 2021-11-18 23:08:29 UTC
The bug has been closed via the following commit(s):

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

commit 2869bb0fcd77e99b4a75630576b8252757c40bfd
Author:     Piotr Karbowski <slashbeast@gentoo.org>
AuthorDate: 2021-11-18 23:03:53 +0000
Commit:     Piotr Karbowski <slashbeast@gentoo.org>
CommitDate: 2021-11-18 23:08:27 +0000

    sys-auth/elogind: 246.10-r2: introduce cgroup-hybrid.
    
    Drop the code that probes for /etc/rc.conf configuration during build
    time, with a proper solution utilizing  USE flag cgroup-hybrid.
    
    The new flag matches the one from sys-apps/systemd andapp-emulation/snapd.
    
    Closes: https://bugs.gentoo.org/807349
    Signed-off-by: Piotr Karbowski <slashbeast@gentoo.org>

 sys-auth/elogind/elogind-246.10-r2.ebuild | 146 ++++++++++++++++++++++++++++++
 sys-auth/elogind/metadata.xml             |   3 +
 2 files changed, 149 insertions(+)