Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!

Bug 691310

Summary: sys-apps/systemd-243_rc1: libvirtd-lxc (and others) breaks because legacy cgroupv1 hierarchy is unavailable.
Product: Gentoo Linux Reporter: Matthias Maier <tamiko>
Component: Current packagesAssignee: Gentoo systemd Team <systemd>
Status: RESOLVED FIXED    
Severity: normal CC: axl, devurandom, flyser42, james05+gentoo, jbuchert+genbug, johannes.hirte, lssndrbarbieri, maggu2810, skobkin-ru, stoffepojken, virtualization, wgh
Priority: Normal    
Version: unspecified   
Hardware: All   
OS: Linux   
Whiteboard:
Package list:
Runtime testing required: ---
Bug Depends on: 691844    
Bug Blocks:    

Description Matthias Maier gentoo-dev 2019-08-02 19:17:03 UTC
Citing from the changelog [1]

        * systemd now defaults to the "unified" cgroup hierarchy setup during
          build-time, i.e. -Ddefault-hierarchy=unified is now the build-time
          default. Previously, -Ddefault-hierarchy=hybrid was the default. This
          change reflects the fact that cgroupsv2 support has matured
          substantially in both systemd and in the kernel, and is clearly the
          way forward. Downstream production distributions might want to
          continue to use -Ddefault-hierarchy=hybrid (or even =legacy) for
          their builds as unfortunately the popular container managers have not
          caught up with the kernel API changes.

Unfortunately, we still have quite a number of consumers for the legacy cgroupv1 hierarchy, one notable example is the libvirtd-lxc hypervisor.

I see two options:

 (a) enable -Ddefault-hierarchy=hybrid per default,

 (b) introduce a use flag to enable hybrid setup

in order to keep libvirt-lxc and other containerization hypervisors functional.

[1] https://github.com/systemd/systemd/blob/master/NEWS
Comment 1 Larry the Git Cow gentoo-dev 2019-08-02 19:24:32 UTC
The bug has been referenced in the following commit(s):

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

commit d2202248997bf8b8a025306b28a5a98969b016f7
Author:     Mike Gilbert <floppym@gentoo.org>
AuthorDate: 2019-08-02 19:24:18 +0000
Commit:     Mike Gilbert <floppym@gentoo.org>
CommitDate: 2019-08-02 19:24:18 +0000

    sys-apps/systemd: add cgroup-hybrid USE flag
    
    Bug: https://bugs.gentoo.org/691310
    Package-Manager: Portage-2.3.70_p1, Repoman-2.3.16_p21
    Signed-off-by: Mike Gilbert <floppym@gentoo.org>

 sys-apps/systemd/metadata.xml                                          | 1 +
 sys-apps/systemd/{systemd-243_rc1.ebuild => systemd-243_rc1-r1.ebuild} | 3 ++-
 sys-apps/systemd/systemd-9999.ebuild                                   | 3 ++-
 3 files changed, 5 insertions(+), 2 deletions(-)
Comment 2 Larry the Git Cow gentoo-dev 2019-08-02 19:48:13 UTC
The bug has been referenced in the following commit(s):

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

commit a5b2246874f8adbfe7745614296ece8adb2b23f0
Author:     Matthias Maier <tamiko@gentoo.org>
AuthorDate: 2019-08-02 19:39:05 +0000
Commit:     Matthias Maier <tamiko@gentoo.org>
CommitDate: 2019-08-02 19:45:47 +0000

    app-emulation/libvirt: block sys-apps/systemd[-cgroup-hypbrid(+)]
    
    For the time being we have to ensure that systemd is configured with
    hybrid cgroup layout. Otherwise libvirt-lxc ceases to work.
    
    Bug: https://bugs.gentoo.org/691310
    Package-Manager: Portage-2.3.70, Repoman-2.3.16
    Signed-off-by: Matthias Maier <tamiko@gentoo.org>

 app-emulation/libvirt/libvirt-5.2.0-r2.ebuild | 1 +
 app-emulation/libvirt/libvirt-5.5.0-r1.ebuild | 1 +
 app-emulation/libvirt/libvirt-9999.ebuild     | 1 +
 3 files changed, 3 insertions(+)
Comment 3 Alexandru N. Barloiu 2019-08-08 19:45:52 UTC
Also libvirt/qemu/kvm is broken for the same reason.
Comment 4 Michael Schmid 2019-08-09 15:36:32 UTC
Same issue with docker, reported analogous Bug 691844
Comment 5 Larry the Git Cow gentoo-dev 2019-08-13 05:52:48 UTC
The bug has been referenced in the following commit(s):

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

commit 636ebd9472d94241da1961e631a2135d6d30ab23
Author:     Matthias Maier <tamiko@gentoo.org>
AuthorDate: 2019-08-13 05:52:08 +0000
Commit:     Matthias Maier <tamiko@gentoo.org>
CommitDate: 2019-08-13 05:52:36 +0000

    app-emulation/libvirt: Always require cgroupv1 hierarchy
    
    It turns out that we need the cgroupv1 hierarchy also for non lxc
    related stuff. Fix dependency accordingly
    
    Bug: https://bugs.gentoo.org/691310
    Package-Manager: Portage-2.3.71, Repoman-2.3.17
    Signed-off-by: Matthias Maier <tamiko@gentoo.org>

 app-emulation/libvirt/libvirt-5.2.0-r2.ebuild | 2 +-
 app-emulation/libvirt/libvirt-5.5.0-r1.ebuild | 2 +-
 app-emulation/libvirt/libvirt-5.6.0.ebuild    | 2 +-
 app-emulation/libvirt/libvirt-9999.ebuild     | 2 +-
 4 files changed, 4 insertions(+), 4 deletions(-)
Comment 6 Johannes Hirte 2019-08-14 16:21:13 UTC
Now I can't build app-emulation/libvirt with sys-apps/systemd < 243_rc1 anymore, cause it doesn't provide cgroup-hybrid useflag at all.
Comment 7 Mike Gilbert gentoo-dev 2019-08-14 16:28:44 UTC
(In reply to Johannes Hirte from comment #6)
> Now I can't build app-emulation/libvirt with sys-apps/systemd < 243_rc1
> anymore, cause it doesn't provide cgroup-hybrid useflag at all.

The blocker is written to allow for that. If you are getting an error, please post it.
Comment 8 Johannes Hirte 2019-08-14 18:41:29 UTC
(In reply to Mike Gilbert from comment #7)
> (In reply to Johannes Hirte from comment #6)
> > Now I can't build app-emulation/libvirt with sys-apps/systemd < 243_rc1
> > anymore, cause it doesn't provide cgroup-hybrid useflag at all.
> 
> The blocker is written to allow for that. If you are getting an error,
> please post it.

Seemed to be a side-effect with some other dependency and world-update. After restricting the update to libvirt (and direct dependencies), I wasn't able to reproduce. So please ignore.
Comment 9 Matthias Maier gentoo-dev 2019-08-14 19:09:13 UTC
(In reply to Johannes Hirte from comment #8)
> [...]
>
> Seemed to be a side-effect with some other dependency and world-update.
> After restricting the update to libvirt (and direct dependencies), I wasn't
> able to reproduce. So please ignore.

Unfortunately, the the blocker is not ideal in terms of conflict resolution (i.e. portage gets easily confused and does not necessarily show you the obvious solution (i.e. setting USE=cgroup-hybrid). There is unfortunately not much we can do about that :-(
Comment 10 Dennis Schridde 2019-09-15 14:13:51 UTC
libvirt is supposed to support cgroups v2 since v4.9.0: https://libvirt.org/news.html#v4.9.0

Is it possible to restrict the blocker to setups that use components of libvirt that still require cgroups v1?
Comment 11 Mike Gilbert gentoo-dev 2019-09-15 14:42:44 UTC
Maybe replace the blocker with an ewarn?
Comment 12 Alex Bennee 2019-11-14 10:50:49 UTC
According to the libvirt team all known cgroup bugs have been fixed since 5.8.0. Once I've managed to unwedge the build I'll give it a test.
Comment 13 Alex Bennee 2019-11-14 17:49:02 UTC
I've tested virt-manager with KVM guests with a cg2 systemd and it worked fine. I need to lookup what's needed to test containers via libvirt.
Comment 14 Fabian Henze 2020-04-19 09:26:43 UTC
Why is this bug resolved? How was it fixed?
Comment 15 Matthias Maier gentoo-dev 2020-04-19 17:59:36 UTC
(In reply to Fabian Henze from comment #14)
> Why is this bug resolved? How was it fixed?

Because we are now enforcing hybrid cgroup layout in systemd if you build libvirt with USE=lxc:

  lxc? ( !sys-apps/systemd[-cgroup-hybrid(+)] )