[Bug 1183247] New: starting lxc container failes with GDBus.Error:org.freedesktop.machine1.NoMachineForPID: PID 4370 does not belong to any known machine
http://bugzilla.opensuse.org/show_bug.cgi?id=1183247 Bug ID: 1183247 Summary: starting lxc container failes with GDBus.Error:org.freedesktop.machine1.NoMachineForPID: PID 4370 does not belong to any known machine Classification: openSUSE Product: openSUSE Tumbleweed Version: Current Hardware: x86-64 OS: openSUSE Tumbleweed Status: NEW Severity: Normal Priority: P5 - None Component: Virtualization:Other Assignee: virt-bugs@suse.de Reporter: stefan.eisenwiener@eisenwiener.com QA Contact: qa-bugs@suse.de Found By: --- Blocker: --- Created attachment 846959 --> http://bugzilla.opensuse.org/attachment.cgi?id=846959&action=edit reduced log with descriped error after Tumbleweed update to 20210307 starting an lxc container failes with GDBus.Error:org.freedesktop.machine1.NoMachineForPID: PID 4370 does not belong to any known machine. -- You are receiving this mail because: You are on the CC list for the bug.
http://bugzilla.opensuse.org/show_bug.cgi?id=1183247
http://bugzilla.opensuse.org/show_bug.cgi?id=1183247#c1
Stefan Eisenwiener
zypper in -y --no-recommends libvirt-daemon-lxc libvirt-client libvirt-admin libvirt-daemon-config-network libvirt-daemon-config-nwfilter
This was tested with a also minimal lxc container setup
<domain type='lxc'>
<name>vm1</name>
<memory>500000</memory>
<os>
<type>exe</type>
<init>/bin/sh</init>
</os>
<vcpu>1</vcpu>
<clock offset='utc'/>
http://bugzilla.opensuse.org/show_bug.cgi?id=1183247
http://bugzilla.opensuse.org/show_bug.cgi?id=1183247#c2
--- Comment #2 from Stefan Eisenwiener
http://bugzilla.opensuse.org/show_bug.cgi?id=1183247
http://bugzilla.opensuse.org/show_bug.cgi?id=1183247#c3
James Fehlig
tumbleweed-20210302 still working tumbleweed-20210305 shows the issue - libvirt was updated from 7.0.0 to 7.1.0
Thanks for bisecting to this point! I've bisected libvirt between these releases and found commit 9c1693eff4 introduced the problem. When starting an LXC container, virLXCProcessStart() calls virCgroupNewDetectMachine(), which now calls virSystemdGetMachineUnitByPID(). The latter fails, even though the container process should be running since handshake with the lxc driver has already occurred. Investigating... -- You are receiving this mail because: You are on the CC list for the bug.
http://bugzilla.opensuse.org/show_bug.cgi?id=1183247
http://bugzilla.opensuse.org/show_bug.cgi?id=1183247#c4
James Fehlig
http://bugzilla.opensuse.org/show_bug.cgi?id=1183247
http://bugzilla.opensuse.org/show_bug.cgi?id=1183247#c8
Bernd Wachter
http://bugzilla.opensuse.org/show_bug.cgi?id=1183247
http://bugzilla.opensuse.org/show_bug.cgi?id=1183247#c12
--- Comment #12 from James Fehlig
http://bugzilla.opensuse.org/show_bug.cgi?id=1183247
http://bugzilla.opensuse.org/show_bug.cgi?id=1183247#c16
--- Comment #16 from OBSbugzilla Bot
http://bugzilla.opensuse.org/show_bug.cgi?id=1183247
http://bugzilla.opensuse.org/show_bug.cgi?id=1183247#c18
Zhufa Sa
http://bugzilla.opensuse.org/show_bug.cgi?id=1183247
http://bugzilla.opensuse.org/show_bug.cgi?id=1183247#c19
--- Comment #19 from James Fehlig
Is there a plan for backport these patches to Leap 15.3? It ships Libvirt 7.1.0.
I hadn't planned on it since the bug was filed against TW. Are you affected by this issue on 15.3? -- You are receiving this mail because: You are on the CC list for the bug.
http://bugzilla.opensuse.org/show_bug.cgi?id=1183247
http://bugzilla.opensuse.org/show_bug.cgi?id=1183247#c20
--- Comment #20 from Bernd Wachter
(In reply to Zhufa Sa from comment #18)
Is there a plan for backport these patches to Leap 15.3? It ships Libvirt 7.1.0.
I hadn't planned on it since the bug was filed against TW. Are you affected by this issue on 15.3?
See https://bugzilla.opensuse.org/show_bug.cgi?id=1183247#c8 - we're stuck on Leap 15.2 for all systems hosting LXC containers until this is fixed. -- You are receiving this mail because: You are on the CC list for the bug.
http://bugzilla.opensuse.org/show_bug.cgi?id=1183247
http://bugzilla.opensuse.org/show_bug.cgi?id=1183247#c21
--- Comment #21 from Zhufa Sa
(In reply to Zhufa Sa from comment #18)
Is there a plan for backport these patches to Leap 15.3? It ships Libvirt 7.1.0.
I hadn't planned on it since the bug was filed against TW. Are you affected by this issue on 15.3?
Yes, I affected by it. I also thinking in consideration of that the libvirtd shiped within SLE repo relevant to SLE-15-SP3, so there is a plan following ... But this is not a big problem for me because I can workaround it by using Virtualization repo from OBS, Let it go if there no any plan. Thanks. -- You are receiving this mail because: You are on the CC list for the bug.
http://bugzilla.opensuse.org/show_bug.cgi?id=1183247
http://bugzilla.opensuse.org/show_bug.cgi?id=1183247#c22
--- Comment #22 from James Fehlig
http://bugzilla.opensuse.org/show_bug.cgi?id=1183247
http://bugzilla.opensuse.org/show_bug.cgi?id=1183247#c26
James Fehlig
http://bugzilla.opensuse.org/show_bug.cgi?id=1183247
http://bugzilla.opensuse.org/show_bug.cgi?id=1183247#c27
--- Comment #27 from Bernd Wachter
http://bugzilla.opensuse.org/show_bug.cgi?id=1183247
http://bugzilla.opensuse.org/show_bug.cgi?id=1183247#c28
Eric van Blokland
http://bugzilla.opensuse.org/show_bug.cgi?id=1183247
http://bugzilla.opensuse.org/show_bug.cgi?id=1183247#c30
--- Comment #30 from Eric van Blokland
(In reply to Eric van Blokland from comment #28)
I've been hit by this as well and had to shelve some upgrades.
Is it the same issue like the initial comment? I.e. 'GDBus.Error:org.freedesktop.machine1.NoMachineForPID:'? What process does the offending PID refer to (is it the PID 1 of the container?) Can you check what's in /proc/$PID/cgroup (when the error occurs)? TY
Tumbleweed is working fine at the moment.
FTR, openSUSE TW defaults to the unified (v2) hierarchy now and it's not affected (was confirmed in comment 4).
Figures, I thought TW was still hybrid. I'm pretty sure it's the same issue. Booting with 'systemd.unified_cgroup_hierarchy=1' resolves it. If I'm not mistaken the offending PID is that from the driver/controller(?) not the actual container. It exits too quickly to dump the cgroup information. I could try and attach a debugger if you're interested. But that would have to wait till tomorrow. -- You are receiving this mail because: You are on the CC list for the bug.
http://bugzilla.opensuse.org/show_bug.cgi?id=1183247
http://bugzilla.opensuse.org/show_bug.cgi?id=1183247#c32
--- Comment #32 from Eric van Blokland
(In reply to Eric van Blokland from comment #30)
It exits too quickly to dump the cgroup information.
Understood.
I could try and attach a debugger if you're interested. But that would have to wait till tomorrow.
Maybe the debug logs as in comment 0 would suffice. (Although they don't seem to contain the unified hierarchy path.)
As an exercise I've taken a dive into this issue. I have very little knowledge about cgroups so that has been a bit of a handicap. As mentioned in one of the comments, the lxc control process is started within the scope of the parent, libvirtd. To me it seems as if the control process is correctly added to the new scope. However, the PID remains tied to the old scope. I've tried changing the controller to use cgroup.procs instead of tasks, which does get rid of the process in the old scope. However, the last line of /proc/PID/cgroup never changes and systemd does not find the controller process in the correct unit. -- You are receiving this mail because: You are on the CC list for the bug.
http://bugzilla.opensuse.org/show_bug.cgi?id=1183247
http://bugzilla.opensuse.org/show_bug.cgi?id=1183247#c34
--- Comment #34 from Eric van Blokland
(In reply to Eric van Blokland from comment #32)
To me it seems as if the control process is correctly added to the new scope. However, the PID remains tied to the old scope.
There are multiple hierarchies, for systemd tracking purposes the only v2 is relevant.
Like I said my understanding of cgroups is extremely limited. I have no clue about the differences between v1, v2 and what unified is supposed to mean. Somehow I was led to believe that v2 is unified.
I've tried changing the controller ...
Do you refer to libvirt or lxc or other code here?
I'm referring to the code in libvirt, specifically the code for the lxc controller process (lxc_controller) that attempts to associate the process with correct cgroups
... to use cgroup.procs instead of tasks, which does get rid of the process in the old scope.
(That should only cause change if you dealt with multi-threaded processes.)
So I understood and as far as I've seen the lxc_controller process is not threaded. Imagine my confusion. Could the controller be running threads to handle IPC?
However, the last line of /proc/PID/cgroup never changes and systemd does not find the controller process in the correct unit.
The last row (assuming it's the '0::' v2 hierarchy) is the "source of truth" for systemd when it comes to unit assocition (when it runs in hybrid or unified mode).
I glanced over the systemd code and that led me to believe that if it's not using unified cgroups, it uses the controller at 1:name=systemd Or does it use the "unified code path" when v2 is available? While I am writing this I think to recall only v1 was mounted, but now I'm unsure, I would have to check. Anyway, it is clear I'm having some issues with the terminology. -- You are receiving this mail because: You are on the CC list for the bug.
http://bugzilla.opensuse.org/show_bug.cgi?id=1183247
http://bugzilla.opensuse.org/show_bug.cgi?id=1183247#c36
Eric van Blokland
http://bugzilla.opensuse.org/show_bug.cgi?id=1183247
http://bugzilla.opensuse.org/show_bug.cgi?id=1183247#c39
--- Comment #39 from Eric van Blokland
(In reply to Eric van Blokland from comment #36)
Your patch does not work out of the box. It fails in virCgroupV2BindMount when it tries to create the directory (g_mkdir_with_parents) "/sys/fs/cgroup/unified".
Thanks for the test!
That may seem a bit dirty, but to me it's less convoluted than letting V2 be aware it should be mounted within V1.
It relies on the tmpfs mount over the ro-path in the v1 virCgroupBindMount, yeah, that's slightly dirty but nothing incorrectable (should be explained in the commit message though).
If you have any suggestions on how to improve that, let me know. I recall "do" loops are frowned upon these days, but I wanted to make explicit this loop was doing something else than the others, without messing with types. In any case I'll mention it more explicitly in the commit message.
I've tested this patch with hybrid and unified cgroups, but not without systemd.
Would you send the patch (even the current form) to the upstream [1]? (To resolve the nuances there.) I can help you if you're unfamiliar; if you send yourself, please Cc me on that mail.
You guessed correctly that I'm not familiar with mailing patches around, but I think I'll manage. I've got time tomorrow in the afternoon to tidy things up. I'll let you know if I get stuck somewhere. I'll also be sure to cc you and mention the report in the libvirt gitlab. -- You are receiving this mail because: You are on the CC list for the bug.
http://bugzilla.opensuse.org/show_bug.cgi?id=1183247
http://bugzilla.opensuse.org/show_bug.cgi?id=1183247#c40
--- Comment #40 from Eric van Blokland
http://bugzilla.opensuse.org/show_bug.cgi?id=1183247
http://bugzilla.opensuse.org/show_bug.cgi?id=1183247#c41
--- Comment #41 from Eric van Blokland
http://bugzilla.opensuse.org/show_bug.cgi?id=1183247
http://bugzilla.opensuse.org/show_bug.cgi?id=1183247#c42
--- Comment #42 from James Fehlig
Since my patch broke cgroups, it was reverted. On the mailinglist three possible fixes/workarounds were mentioned but upstream does not seem to care. I would like to see this fixed though. I would like to know which fix would be acceptable by the OpenSUSE maintainers, so I can implement that.
1. Skip obtaining the machine unit name during container startup 2. Let systemd launch the lxc controller process as a transient unit 3. Add a dummy controller to force some v2 logic
I'd be receptive to any fix that is isolated to the lxc driver. I'm less fond of a fix that touches common code, which could also affect the qemu driver. -- You are receiving this mail because: You are on the CC list for the bug.
http://bugzilla.opensuse.org/show_bug.cgi?id=1183247
http://bugzilla.opensuse.org/show_bug.cgi?id=1183247#c43
--- Comment #43 from Eric van Blokland
(In reply to Eric van Blokland from comment #41)
Since my patch broke cgroups, it was reverted. On the mailinglist three possible fixes/workarounds were mentioned but upstream does not seem to care. I would like to see this fixed though. I would like to know which fix would be acceptable by the OpenSUSE maintainers, so I can implement that.
1. Skip obtaining the machine unit name during container startup 2. Let systemd launch the lxc controller process as a transient unit 3. Add a dummy controller to force some v2 logic
I'd be receptive to any fix that is isolated to the lxc driver. I'm less fond of a fix that touches common code, which could also affect the qemu driver.
In that case it's a trade off between maintainability and reliability. In lxc_process.c there are two calls that cause issues: virLXCDomainGetMachineName lxc_process.c:1465 virCgroupNewDetectMachine lxc_process.c:1473 The purpose of these calls is to abort the container initialization in an early stage if something goes wrong. More specifically, if issues occurred with machined registration and cgroup creation. Option 1: For easy maintenance I could make a condition to only call these when the cgroup v2 backend is available or when there is no systemd at the cost of some reliability. Option 2: Alter the signature of virCgroupNewDetectMachine to have a flag to optionally check the unit name. When called from lxc_process.c we pass the flag to not check the unit name when the cgroup v2 backend is not available and systemd is present. This way we keep some reliability at the cost of (probably) more maintenance. Option 3: Implement a function with the relevant parts of virCgroupNewDetectMachine directly in lxc_process.c as a fallback for when the cgroup v2 backend is not available and systemd is present. Some reliability, more maintenance. In my opinion option 1 is sufficient. Let me know if one of these solutions would be acceptable. -- You are receiving this mail because: You are on the CC list for the bug.
http://bugzilla.opensuse.org/show_bug.cgi?id=1183247
http://bugzilla.opensuse.org/show_bug.cgi?id=1183247#c44
Eric van Blokland
http://bugzilla.opensuse.org/show_bug.cgi?id=1183247
http://bugzilla.opensuse.org/show_bug.cgi?id=1183247#c45
Till D�rges
http://bugzilla.opensuse.org/show_bug.cgi?id=1183247
http://bugzilla.opensuse.org/show_bug.cgi?id=1183247#c48
Eric van Blokland
http://bugzilla.opensuse.org/show_bug.cgi?id=1183247
http://bugzilla.opensuse.org/show_bug.cgi?id=1183247#c49
--- Comment #49 from Till D�rges
participants (1)
-
bugzilla_noreply@suse.com