Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 761721 - >=app-emulation/libvirt-6.10.0-r2: libvirt-lxc fails to destroy lxc containers
Summary: >=app-emulation/libvirt-6.10.0-r2: libvirt-lxc fails to destroy lxc containers
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Eclasses (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Matthias Maier
URL:
Whiteboard:
Keywords: PullRequest
Depends on:
Blocks:
 
Reported: 2020-12-26 01:39 UTC by Matthias Maier
Modified: 2021-04-20 14:10 UTC (History)
2 users (show)

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


Attachments
emerge --info (emerge.info,7.37 KB, application/x-info)
2020-12-26 07:53 UTC, Matthias Maier
Details
libvirtd debug output (libvirtd.debug.log,89.43 KB, text/plain)
2021-04-16 03:22 UTC, Matthias Maier
Details
lxc container logfile (lxc.log,1.00 KB, text/x-log)
2021-04-16 03:22 UTC, Matthias Maier
Details
container xml definition (amd64.xml,951 bytes, text/xml)
2021-04-16 03:32 UTC, Matthias Maier
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Matthias Maier gentoo-dev 2020-12-26 01:39:15 UTC
On my system libvirt-6.10.0 intermittently is unable to destroy lxc containers. It fails with

  % virsh --connect lxc:///system  destroy test
  error: Failed to destroy domain test
  error: internal error: failed to get cgroup backend for 'pathOfController'


It works at first, but when destroying one of the containers fails, it fails consistently.

As a first guess, I have set a high kernel pid limit via sysctl:

  kernel.pid_max = 4194304

Maybe that's the problem.
Comment 1 Matthias Maier gentoo-dev 2020-12-26 03:18:35 UTC
Correction: This has nothing to do with the kernel.pid_max setting and is actually reproducible (also with libvirt-6.9*)
Comment 2 Michal Privoznik 2020-12-26 07:46:19 UTC
Matthias, are you using cgroups v1 or v2? With systemd? I'm running v1 with openrc and can't reproduce.
Comment 3 Matthias Maier gentoo-dev 2020-12-26 07:52:29 UTC
This is cgroup v2 with sytemd.
Comment 4 Matthias Maier gentoo-dev 2020-12-26 07:53:15 UTC
Created attachment 679524 [details]
emerge --info
Comment 5 Matthias Maier gentoo-dev 2020-12-26 07:54:05 UTC
And I did not encounter this problem with libvirt-6.9 and cgroupv1 (and systemd).
Comment 6 Matthias Maier gentoo-dev 2021-03-11 05:28:38 UTC
This bug is present in 7.0.0 and 7.1.0 as well.
Comment 7 Matthias Maier gentoo-dev 2021-04-04 18:08:23 UTC
This bug is present in 7.2.0 as well.
Comment 8 Michal Privoznik 2021-04-15 13:48:06 UTC
Matthias, I'm sorry to hear that. Can you please attach debug logs?

https://libvirt.org/kbase/debuglogs.html
Comment 9 Matthias Maier gentoo-dev 2021-04-16 03:22:19 UTC
Created attachment 700038 [details]
libvirtd debug output
Comment 10 Matthias Maier gentoo-dev 2021-04-16 03:22:41 UTC
Created attachment 700041 [details]
lxc container logfile
Comment 11 Matthias Maier gentoo-dev 2021-04-16 03:25:22 UTC
(In reply to Michal Privoznik from comment #8)
> Matthias, I'm sorry to hear that. Can you please attach debug logs?
> 
> https://libvirt.org/kbase/debuglogs.html

Attached.

By the way, I can reliably trigger this issue on Debian bullseye (which mounts cgroupv2 only) as well.

I have attached the lxc log for startup of a container named "amd64", as well as the debug output for libvirtd for the following command:

  % virsh --connect lxc:///system destroy amd64
  error: Failed to destroy domain 'amd64'
  error: internal error: failed to get cgroup backend for 'pathOfController'
Comment 12 Matthias Maier gentoo-dev 2021-04-16 03:32:41 UTC
Created attachment 700050 [details]
container xml definition
Comment 13 Michal Privoznik 2021-04-19 07:21:26 UTC
Thank you, I was able to reproduce. The problem is with how libvirt removes nested controllers. I've posted patch here:

https://listman.redhat.com/archives/libvir-list/2021-April/msg00756.html
Comment 14 Michal Privoznik 2021-04-19 09:24:05 UTC
Merged upstream as:

ea7d0ca37c vircgroup: Fix virCgroupKillRecursive() wrt nested controllers
a0815484b1 vircgroupbackend: Extend error messages in VIR_CGROUP_BACKEND_CALL()
edce157f11 vircgroup: Debug print all arguments of virCgroupKillRecursiveInternal()

v7.2.0-228-gea7d0ca37c
Comment 15 Matthias Maier gentoo-dev 2021-04-19 18:25:08 UTC
(In reply to Michal Privoznik from comment #14)
> Merged upstream as:
> 
> [...]

Very nice! I will prepare a revision bump for the Gentoo package in a minute.
Comment 16 Larry the Git Cow gentoo-dev 2021-04-20 14:10:38 UTC
The bug has been closed via the following commit(s):

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

commit ca152da5d31120472ffce4b687550a5454b2a11f
Author:     Michal Privoznik <mprivozn@redhat.com>
AuthorDate: 2021-04-20 07:36:45 +0000
Commit:     Matthias Maier <tamiko@gentoo.org>
CommitDate: 2021-04-20 14:09:58 +0000

    app-emulation/libvirt: Allow destroy of LXC containers again
    
    The original problem was fixed upstream as:
    
      ea7d0ca37c vircgroup: Fix virCgroupKillRecursive() wrt nested controllers
    
    and the commit will be part of the upcoming 7.3.0 release.
    However, the bug is so critical that the fix deserves to be
    backported to all supported releases.
    
    Please note, that for libvirt-7.2.0 I'm also dropping the code
    under src_install() that's supposed to fix docdir for ebuilds
    with revision number. This fixup is not needed because as of
    cc20e6298b7217f4b0eab3c50078257fd77ebb1b the docdir is put
    correctly onto meson's cmd line. I'm doing these two changes to
    avoid necessary revision number bump.
    
    Closes: https://bugs.gentoo.org/761721
    Closes: https://github.com/gentoo/gentoo/pull/20468
    Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
    Signed-off-by: Matthias Maier <tamiko@gentoo.org>

 ...ix-virCgroupKillRecursive-wrt-nested-cont.patch | 189 +++++++++++++++++++++
 ...irt-7.0.0-r1.ebuild => libvirt-7.0.0-r2.ebuild} |   1 +
 ...ibvirt-7.1.0.ebuild => libvirt-7.1.0-r1.ebuild} |   1 +
 ...ibvirt-7.2.0.ebuild => libvirt-7.2.0-r1.ebuild} |   7 +-
 4 files changed, 192 insertions(+), 6 deletions(-)