[lxc-users] LXC 3.2.1 ./. CGroups v1

Jäkel, Guido G.Jaekel at dnb.de
Thu Aug 15 13:50:47 UTC 2019


Dear all,

may one confirm, that the issue is triggered at cg_hybrid_get_controllers(), line 733ff? Caused by the hard code assumption that the V1 cgroups are always mounted as /sys/fs/cgroup and the rough code below (skipping 15 chars).

Well, I'll try to patch it tomorrow in the same, simple manner: by replacing the constants by "/cgroup"<-"/sys/fs/cgroup/" and '7'<-'15' ...


And "yes" - the enduring way is to change "my" cgroup v1 mountpoint to the "official one" at /sys/fs/cgroup"! But in conjunction with this, I have to check if I may use either a symlink to provide a legacy fallback or otherwise to change a bunch of scripts.


Greetings

Guido

  707 /* Get the controllers from a mountinfo line There are other ways we could get
  708  * this info. For lxcfs, field 3 is /cgroup/controller-list. For cgroupfs, we
  709  * could parse the mount options. But we simply assume that the mountpoint must
  710  * be /sys/fs/cgroup/controller-list
  711  */
  712 static char **cg_hybrid_get_controllers(char **klist, char **nlist, char *line,
  713                     int type)
  714 {
  715     /* The fourth field is /sys/fs/cgroup/comma-delimited-controller-list
  716      * for legacy hierarchies.
  717      */
  718     int i;
  719     char *p2, *tok;
  720     char *p = line, *sep = ",";
  721     char **aret = NULL;
  722 
  723     for (i = 0; i < 4; i++) {
  724         p = strchr(p, ' ');
  725         if (!p)
  726             return NULL;
  727         p++;
  728     }
  729 
  730     /* Note, if we change how mountinfo works, then our caller will need to
  731      * verify /sys/fs/cgroup/ in this field.
  732      */
  733     if (strncmp(p, "/sys/fs/cgroup/", 15) != 0) {
  734         ERROR("Found hierarchy not under /sys/fs/cgroup: \"%s\"", p);
  735         return NULL;
  736     }
  737 
  738     p += 15;
  739     p2 = strchr(p, ' ');
  740     if (!p2) {
  741         ERROR("Corrupt mountinfo");
  742         return NULL;
  743     }
  744     *p2 = '\0';
[...]

>-----Original Message-----
>From: lxc-users [mailto:lxc-users-bounces at lists.linuxcontainers.org] On Behalf Of Jäkel, Guido
>Sent: Thursday, August 15, 2019 3:13 PM
>To: 'LXC users mailing-list' <lxc-users at lists.linuxcontainers.org>
>Subject: [lxc-users] LXC 3.2.1 ./. CGroups v1
>
>Dear all,
>
>Using LXC in my Gentoo environment for years (since 0.8.4) and currently using V2.1.1 in Production, I'm just evaluating LXC
>3.2.1.
>
>I'm still using CGroups V1 with all available controllers mounted on /cgroups and /cgroups/lxc as a parent group. Until yet,
>this works well. But with V3.2.1, there's an issue starting with writing the setup to the device cgroup.
>
>Below, you'll find the respective log output at trace level.
>
>The cgroup feature itself is working: There are device.* directory items below /cgroup, /cgroup/lxc and -- if I mkdir such --
>/cgroup/lxc/foo , also. If I'm using the same configuration files, root image, kernel etc. but with a LXC 2.1.1 starter, all
>works well and the container will start up.
>
>Any hint's what's going wrong here and how to fix it?
>
>
>Thank you in advance
>
>Guido
>
>
>[...]
>lxc-start evalfly6 20190815111414.815 TRACE    cgfsng - cgroups/cgfsng.c:lxc_cgfsng_print_basecg_debuginfo:1018 - basecginfo is:
>lxc-start evalfly6 20190815111414.815 TRACE    cgfsng - cgroups/cgfsng.c:lxc_cgfsng_print_basecg_debuginfo:1019 -
>2:cpuset,cpu,cpuacct,blkio,memory,devices,freezer,net_cls,perf_event,net_prio,pids:/
>1:name=openrc:/
>0::/
>
>lxc-start evalfly6 20190815111414.815 TRACE    cgfsng - cgroups/cgfsng.c:lxc_cgfsng_print_basecg_debuginfo:1022 - kernel
>subsystem 0: cpuset
>lxc-start evalfly6 20190815111414.815 TRACE    cgfsng - cgroups/cgfsng.c:lxc_cgfsng_print_basecg_debuginfo:1022 - kernel
>subsystem 1: cpu
>lxc-start evalfly6 20190815111414.815 TRACE    cgfsng - cgroups/cgfsng.c:lxc_cgfsng_print_basecg_debuginfo:1022 - kernel
>subsystem 2: cpuacct
>lxc-start evalfly6 20190815111414.815 TRACE    cgfsng - cgroups/cgfsng.c:lxc_cgfsng_print_basecg_debuginfo:1022 - kernel
>subsystem 3: blkio
>lxc-start evalfly6 20190815111414.815 TRACE    cgfsng - cgroups/cgfsng.c:lxc_cgfsng_print_basecg_debuginfo:1022 - kernel
>subsystem 4: memory
>lxc-start evalfly6 20190815111414.815 TRACE    cgfsng - cgroups/cgfsng.c:lxc_cgfsng_print_basecg_debuginfo:1022 - kernel
>subsystem 5: devices
>lxc-start evalfly6 20190815111414.815 TRACE    cgfsng - cgroups/cgfsng.c:lxc_cgfsng_print_basecg_debuginfo:1022 - kernel
>subsystem 6: freezer
>lxc-start evalfly6 20190815111414.815 TRACE    cgfsng - cgroups/cgfsng.c:lxc_cgfsng_print_basecg_debuginfo:1022 - kernel
>subsystem 7: net_cls
>lxc-start evalfly6 20190815111414.815 TRACE    cgfsng - cgroups/cgfsng.c:lxc_cgfsng_print_basecg_debuginfo:1022 - kernel
>subsystem 8: perf_event
>lxc-start evalfly6 20190815111414.815 TRACE    cgfsng - cgroups/cgfsng.c:lxc_cgfsng_print_basecg_debuginfo:1022 - kernel
>subsystem 9: net_prio
>lxc-start evalfly6 20190815111414.815 TRACE    cgfsng - cgroups/cgfsng.c:lxc_cgfsng_print_basecg_debuginfo:1022 - kernel
>subsystem 10: pids
>lxc-start evalfly6 20190815111414.815 TRACE    cgfsng - cgroups/cgfsng.c:lxc_cgfsng_print_basecg_debuginfo:1022 - kernel
>subsystem 11: cgroup2
>lxc-start evalfly6 20190815111414.815 TRACE    cgfsng - cgroups/cgfsng.c:lxc_cgfsng_print_basecg_debuginfo:1025 - named
>subsystem 0: name=openrc
>lxc-start evalfly6 20190815111414.815 TRACE    cgfsng - cgroups/cgfsng.c:cg_hybrid_init:2563 - No controllers are enabled for
>delegation in the unified hierarchy
>lxc-start evalfly6 20190815111414.815 ERROR    cgfsng - cgroups/cgfsng.c:cg_hybrid_get_controllers:734 - Found hierarchy not
>under /sys/fs/cgroup: "/cgroup rw,relatime - cgroup cgroup
>rw,cpuset,cpu,cpuacct,blkio,memory,devices,freezer,net_cls,perf_event,>
>"
>lxc-start evalfly6 20190815111414.815 TRACE    cgfsng - cgroups/cgfsng.c:cg_hybrid_init:2589 - Writable cgroup hierarchies:
>lxc-start evalfly6 20190815111414.815 TRACE    cgfsng - cgroups/cgfsng.c:lxc_cgfsng_print_hierarchies:999 -   Hierarchies:
>lxc-start evalfly6 20190815111414.815 TRACE    cgfsng - cgroups/cgfsng.c:lxc_cgfsng_print_hierarchies:1004 -   0: base_cgroup: /
>lxc-start evalfly6 20190815111414.815 TRACE    cgfsng - cgroups/cgfsng.c:lxc_cgfsng_print_hierarchies:1005 -       mountpoint:
>/sys/fs/cgroup/openrc
>lxc-start evalfly6 20190815111414.815 TRACE    cgfsng - cgroups/cgfsng.c:lxc_cgfsng_print_hierarchies:1006 -       controllers:
>lxc-start evalfly6 20190815111414.815 TRACE    cgfsng - cgroups/cgfsng.c:lxc_cgfsng_print_hierarchies:1008 -       0:
>name=openrc
>lxc-start evalfly6 20190815111414.815 TRACE    cgfsng - cgroups/cgfsng.c:lxc_cgfsng_print_hierarchies:1004 -   1: base_cgroup: /
>lxc-start evalfly6 20190815111414.815 TRACE    cgfsng - cgroups/cgfsng.c:lxc_cgfsng_print_hierarchies:1005 -       mountpoint:
>/sys/fs/cgroup/unified
>lxc-start evalfly6 20190815111414.815 TRACE    cgfsng - cgroups/cgfsng.c:lxc_cgfsng_print_hierarchies:1006 -       controllers:
>lxc-start evalfly6 20190815111414.815 TRACE    cgroup - cgroups/cgroup.c:cgroup_init:61 - Initialized cgroup driver cgfsng
>lxc-start evalfly6 20190815111414.815 TRACE    cgroup - cgroups/cgroup.c:cgroup_init:66 - Running with hybrid cgroup layout
>[...]
>lxc-start evalfly6 20190815111414.912 NOTICE   conf - conf.c:lxc_setup:3751 - The container "evalfly6" is set up
>lxc-start evalfly6 20190815111414.955 WARN     cgfsng - cgroups/cgfsng.c:get_hierarchy:205 - There is no useable devices
>controller
>lxc-start evalfly6 20190815111414.955 ERROR    cgfsng - cgroups/cgfsng.c:cg_legacy_set_data:2301 - Failed to setup limits for
>the "devices" controller. The controller seems to be unused by "cgfsng" cgroup driver or not enabled on the cgroup hierarchy
>lxc-start evalfly6 20190815111414.955 WARN     cgfsng - cgroups/cgfsng.c:__cg_legacy_setup_limits:2341 - Failed to set
>"devices.deny" to "a"
>lxc-start evalfly6 20190815111414.955 ERROR    start - start.c:lxc_spawn:1883 - Failed to setup legacy device cgroup controller
>limits
>
>
>
>Grüße
>
>Guido
>
>
>_______________________________________________
>lxc-users mailing list
>lxc-users at lists.linuxcontainers.org
>http://lists.linuxcontainers.org/listinfo/lxc-users


More information about the lxc-users mailing list