Skip to contentSkip to conversation

lxc: Fix containers failed to start with LXC 3.2.1

PATCH In review Xu, Yanfei 2 participants 3 messages Apr 6, 2020 – Apr 9, 2020

lore
Share & tools
lore

Xu, Yanfei

author
#0 lore raw

PATCH 1/1 lxc: Fix containers failed to start with LXC 3.2.1

From: Yanfei Xu <[email protected]>

LXC 3.2.1 has a bug that containers may start failed in some cases, and this patch from upstream fix it.

-------error message------
lxc-start vc0 20200323102154.497 ERROR cgfsng -
cgfsng.c:__do_cgroup_enter:1500 - No space left on device - Failed to enter cgroup "/sys/fs/cgroup/cpuset//lxc.monitor/vc0-4/cgroup.procs"
lxc-start vc0 20200323102154.497 ERROR start -
start.c:__lxc_start:2009 - Failed to enter monitor cgroup
lxc-start vc0 20200323102154.497 ERROR lxccontainer -
lxccontainer.c:wait_on_daemonized_start:872 - Received container state "STOPPING" instead of "RUNNING"
lxc-start vc0 20200323102154.497 ERROR lxc_start -
lxc_start.c:main:329 - The container failed to start
lxc-start vc0 20200323102154.497 ERROR lxc_start -
lxc_start.c:main:332 - To get more details, run the container in foreground mode
-------------------------

---
 ...1-cgroups-initialize-cpuset-properly.patch | 40 +++++++++++++++++++
 recipes-containers/lxc/lxc_3.2.1.bb           |  1 +
 2 files changed, 41 insertions(+)
 create mode 100644 recipes-containers/lxc/files/0001-cgroups-initialize-cpuset-properly.patch
recipes-containers/lxc/files/0001-cgroups-initialize-cpuset-properly.patch new file +40 -0
new file mode 100644
index 0000000..9d0c2ae
@@ -0,0 +1,40 @@
+From b31d62b847a3ee013613795094cce4acc12345ef Mon Sep 17 00:00:00 2001
+From: Christian Brauner <[email protected]>
+Date: Sun, 28 Jul 2019 23:13:26 +0200
+Subject: [PATCH] cgroups: initialize cpuset properly
+
+Closes #3108.
+Signed-off-by: Christian Brauner <[email protected]>
+
+Upstream-Status: Backport[https://github.com/lxc/lxc/pull/3108]
+
+Signed-off-by: Yanfei Xu <[email protected]>
+---
+ src/lxc/cgroups/cgfsng.c | 10 +++++-----
+ 1 file changed, 5 insertions(+), 5 deletions(-)
+
+diff --git a/src/lxc/cgroups/cgfsng.c b/src/lxc/cgroups/cgfsng.c
+index 7b8fe6736..c29c0958e 100644
+--- a/src/lxc/cgroups/cgfsng.c
++++ b/src/lxc/cgroups/cgfsng.c
+@@ -496,12 +496,12 @@ static bool cg_legacy_filter_and_set_cpus(char *path, bool am_initialized)
+ 	}
+ 
+ 	if (!flipped_bit) {
+-		DEBUG("No isolated or offline cpus present in cpuset");
+-		return true;
++		cpulist = lxc_cpumask_to_cpulist(possmask, maxposs);
++		TRACE("No isolated or offline cpus present in cpuset");
++	} else {
++		cpulist = move_ptr(posscpus);
++		TRACE("Removed isolated or offline cpus from cpuset");
+ 	}
+-	DEBUG("Removed isolated or offline cpus from cpuset");
+-
+-	cpulist = lxc_cpumask_to_cpulist(possmask, maxposs);
+ 	if (!cpulist) {
+ 		ERROR("Failed to create cpu list");
+ 		return false;
+-- 
+2.18.2
+
recipes-containers/lxc/lxc_3.2.1.bb +1 -0
index 9592dd9..57e48c1 100644
@@ -50,6 +50,7 @@ SRC_URI = "http://linuxcontainers.org/downloads/${BPN}-${PV}.tar.gz \
 	file://dnsmasq.conf \
 	file://lxc-net \
 	file://0001-syscall_wrappers-rename-internal-memfd_create-to-mem.patch \
+	file://0001-cgroups-initialize-cpuset-properly.patch \
 	"
 
 SRC_URI[md5sum] = "4886c8d1c8e221fe526eefcb47857b85"
Signature · 1 line
2.24.1
#1 lore raw

As of April 6th, LXC 4.0 has been released.

Given that it is a LTS release, I'd prefer to jump to that for the dunfell branch .. even if it is just recently released by LXC.

Can you try and uprev ? If not, I'll get to it in the next few weeks, but I'll hold on merging this patch in preference for the uprev.

Bruce

Quoted 91 lines · Yanfei

From: Yanfei Xu <[email protected]>

LXC 3.2.1 has a bug that containers may start failed in some cases, and this patch from upstream fix it.

-------error message------
lxc-start vc0 20200323102154.497 ERROR cgfsng -
cgfsng.c:__do_cgroup_enter:1500 - No space left on device - Failed to enter cgroup "/sys/fs/cgroup/cpuset//lxc.monitor/vc0-4/cgroup.procs"
lxc-start vc0 20200323102154.497 ERROR start -
start.c:__lxc_start:2009 - Failed to enter monitor cgroup
lxc-start vc0 20200323102154.497 ERROR lxccontainer -
lxccontainer.c:wait_on_daemonized_start:872 - Received container state "STOPPING" instead of "RUNNING"
lxc-start vc0 20200323102154.497 ERROR lxc_start -
lxc_start.c:main:329 - The container failed to start
lxc-start vc0 20200323102154.497 ERROR lxc_start -
lxc_start.c:main:332 - To get more details, run the container in foreground mode
-------------------------

---
 ...1-cgroups-initialize-cpuset-properly.patch | 40 +++++++++++++++++++
 recipes-containers/lxc/lxc_3.2.1.bb           |  1 +
 2 files changed, 41 insertions(+)
 create mode 100644 recipes-containers/lxc/files/0001-cgroups-initialize-cpuset-properly.patch
recipes-containers/lxc/files/0001-cgroups-initialize-cpuset-properly.patch new file +40 -0
new file mode 100644
index 0000000..9d0c2ae
@@ -0,0 +1,40 @@
+From b31d62b847a3ee013613795094cce4acc12345ef Mon Sep 17 00:00:00 2001
+From: Christian Brauner <[email protected]>
+Date: Sun, 28 Jul 2019 23:13:26 +0200
+Subject: [PATCH] cgroups: initialize cpuset properly
+
+Closes #3108.
+Signed-off-by: Christian Brauner <[email protected]>
+
+Upstream-Status: Backport[https://github.com/lxc/lxc/pull/3108]
+
+Signed-off-by: Yanfei Xu <[email protected]>
+---
+ src/lxc/cgroups/cgfsng.c | 10 +++++-----
+ 1 file changed, 5 insertions(+), 5 deletions(-)
+
+diff --git a/src/lxc/cgroups/cgfsng.c b/src/lxc/cgroups/cgfsng.c
+index 7b8fe6736..c29c0958e 100644
+--- a/src/lxc/cgroups/cgfsng.c
++++ b/src/lxc/cgroups/cgfsng.c
+@@ -496,12 +496,12 @@ static bool cg_legacy_filter_and_set_cpus(char *path, bool am_initialized)
+       }
+
+       if (!flipped_bit) {
+-              DEBUG("No isolated or offline cpus present in cpuset");
+-              return true;
++              cpulist = lxc_cpumask_to_cpulist(possmask, maxposs);
++              TRACE("No isolated or offline cpus present in cpuset");
++      } else {
++              cpulist = move_ptr(posscpus);
++              TRACE("Removed isolated or offline cpus from cpuset");
+       }
+-      DEBUG("Removed isolated or offline cpus from cpuset");
+-
+-      cpulist = lxc_cpumask_to_cpulist(possmask, maxposs);
+       if (!cpulist) {
+               ERROR("Failed to create cpu list");
+               return false;
+--
+2.18.2
+
recipes-containers/lxc/lxc_3.2.1.bb +1 -1
index 9592dd9..57e48c1 100644
@@ -50,6 +50,7 @@ SRC_URI = "http://linuxcontainers.org/downloads/${BPN}-${PV}.tar.gz \
        file://dnsmasq.conf \
        file://lxc-net \
        file://0001-syscall_wrappers-rename-internal-memfd_create-to-mem.patch \
+       file://0001-cgroups-initialize-cpuset-properly.patch \
        "
 
 SRC_URI[md5sum] = "4886c8d1c8e221fe526eefcb47857b85"
--

2.24.1

Signature · 3 lines
- Thou shalt not follow the NULL pointer, for chaos and madness await
thee at its end
- "Use the force Harry" - Gandalf, Star Trek II
author
#2 lore raw

Of course yes, I'd like to uprev the lxc. But it may be a few days later.

: )

Thanks,

Yanfei

Quoted 103 lines · Bruce Ashfield

As of April 6th, LXC 4.0 has been released.

Given that it is a LTS release, I'd prefer to jump to that for the dunfell branch .. even if it is just recently released by LXC.

Can you try and uprev ? If not, I'll get to it in the next few weeks, but I'll hold on merging this patch in preference for the uprev.

Bruce

Quoted 90 lines · Yanfei

From: Yanfei Xu <[email protected]>

LXC 3.2.1 has a bug that containers may start failed in some cases, and this patch from upstream fix it.

-------error message------
lxc-start vc0 20200323102154.497 ERROR cgfsng -
cgfsng.c:__do_cgroup_enter:1500 - No space left on device - Failed to enter cgroup "/sys/fs/cgroup/cpuset//lxc.monitor/vc0-4/cgroup.procs"
lxc-start vc0 20200323102154.497 ERROR start -
start.c:__lxc_start:2009 - Failed to enter monitor cgroup
lxc-start vc0 20200323102154.497 ERROR lxccontainer -
lxccontainer.c:wait_on_daemonized_start:872 - Received container state "STOPPING" instead of "RUNNING"
lxc-start vc0 20200323102154.497 ERROR lxc_start -
lxc_start.c:main:329 - The container failed to start
lxc-start vc0 20200323102154.497 ERROR lxc_start -
lxc_start.c:main:332 - To get more details, run the container in foreground mode
-------------------------

---
  ...1-cgroups-initialize-cpuset-properly.patch | 40 +++++++++++++++++++
  recipes-containers/lxc/lxc_3.2.1.bb           |  1 +
  2 files changed, 41 insertions(+)

create mode 100644 recipes-containers/lxc/files/0001-cgroups-initialize-cpuset-properly.patch

recipes-containers/lxc/files/0001-cgroups-initialize-cpuset-properly.patch new file +40 -0
new file mode 100644
index 0000000..9d0c2ae
@@ -0,0 +1,40 @@
+From b31d62b847a3ee013613795094cce4acc12345ef Mon Sep 17 00:00:00 2001
+From: Christian Brauner <[email protected]>
+Date: Sun, 28 Jul 2019 23:13:26 +0200
+Subject: [PATCH] cgroups: initialize cpuset properly
+
+Closes #3108.
+Signed-off-by: Christian Brauner <[email protected]>
+
+Upstream-Status: Backport[https://github.com/lxc/lxc/pull/3108]
+
+Signed-off-by: Yanfei Xu <[email protected]>
+---
+ src/lxc/cgroups/cgfsng.c | 10 +++++-----
+ 1 file changed, 5 insertions(+), 5 deletions(-)
+
+diff --git a/src/lxc/cgroups/cgfsng.c b/src/lxc/cgroups/cgfsng.c
+index 7b8fe6736..c29c0958e 100644
+--- a/src/lxc/cgroups/cgfsng.c
++++ b/src/lxc/cgroups/cgfsng.c
+@@ -496,12 +496,12 @@ static bool cg_legacy_filter_and_set_cpus(char *path, bool am_initialized)
+       }
+
+       if (!flipped_bit) {
+-              DEBUG("No isolated or offline cpus present in cpuset");
+-              return true;
++              cpulist = lxc_cpumask_to_cpulist(possmask, maxposs);
++              TRACE("No isolated or offline cpus present in cpuset");
++      } else {
++              cpulist = move_ptr(posscpus);
++              TRACE("Removed isolated or offline cpus from cpuset");
+       }
+-      DEBUG("Removed isolated or offline cpus from cpuset");
+-
+-      cpulist = lxc_cpumask_to_cpulist(possmask, maxposs);
+       if (!cpulist) {
+               ERROR("Failed to create cpu list");
+               return false;
+--
+2.18.2
+
recipes-containers/lxc/lxc_3.2.1.bb +1 -1
index 9592dd9..57e48c1 100644
@@ -50,6 +50,7 @@ SRC_URI = "http://linuxcontainers.org/downloads/${BPN}-${PV}.tar.gz \
         file://dnsmasq.conf \
         file://lxc-net \
         file://0001-syscall_wrappers-rename-internal-memfd_create-to-mem.patch \
+       file://0001-cgroups-initialize-cpuset-properly.patch \
         "
 
  SRC_URI[md5sum] = "4886c8d1c8e221fe526eefcb47857b85"
--

2.24.1