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).
Or maybe we should set a better distribution default.
(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).
(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.
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?
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.
Why such complexity when you can do it with one flag?
I can, sure, -unified flag that goes hybrid then. Will do.
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(+)