diff --git a/src/lxc/cmd/lxc-checkconfig.in b/src/lxc/cmd/lxc-checkconfig.in index 675e4716b4..ccddfe4b3a 100755 --- a/src/lxc/cmd/lxc-checkconfig.in +++ b/src/lxc/cmd/lxc-checkconfig.in @@ -161,10 +161,8 @@ fi echo echo "--- Control groups ---" - echo -n "Cgroups: " && is_enabled CONFIG_CGROUPS echo - echo -n "Cgroup namespace: " && has_cgroup_ns echo @@ -172,39 +170,39 @@ print_cgroups() { # print all mountpoints for cgroup filesystems awk '$1 !~ /#/ && $3 == mp { print $2; } ; END { exit(0); } ' "mp=$1" "$2" ; } - CGROUP_V1_MNTS=$(print_cgroups cgroup /proc/self/mounts) -echo +CGROUP_V2_MNTS=$(print_cgroups cgroup2 /proc/self/mounts) + echo "Cgroup v1 mount points: " -echo "$CGROUP_V1_MNTS" -echo +for mnt in ${CGROUP_V1_MNTS}; do + echo " - ${mnt}" +done -CGROUP_V2_MNTS=$(print_cgroups cgroup2 /proc/self/mounts) echo "Cgroup v2 mount points: " -echo "$CGROUP_V2_MNTS" -echo - -CGROUP_SYSTEMD_MNTPT=$(echo "$CGROUP_V1_MNTS" | grep "/systemd") -if [ -z "$CGROUP_SYSTEMD_MNTPT" ]; then - echo -n "Cgroup v1 systemd controller: " - $SETCOLOR_FAILURE && echo -n "missing" && $SETCOLOR_NORMAL - echo -fi +for mnt in ${CGROUP_V2_MNTS}; do + echo " - ${mnt}" +done + +if [ "${CGROUP_V2_MNTS}" != "/sys/fs/cgroup" ]; then + CGROUP_SYSTEMD_MNTPT=$(echo "$CGROUP_V1_MNTS" | grep "/systemd") + if [ -z "$CGROUP_SYSTEMD_MNTPT" ]; then + echo -n "Cgroup v1 systemd controller: " + $SETCOLOR_FAILURE && echo -n "missing" && $SETCOLOR_NORMAL + echo + fi -CGROUP_FREEZER_MNTPT=$(echo "$CGROUP_V1_MNTS" | grep "/freezer") -if [ -z "$CGROUP_FREEZER_MNTPT" ]; then - echo -n "Cgroup v1 freezer controller: " - $SETCOLOR_FAILURE && echo -n "missing" && $SETCOLOR_NORMAL - echo -fi + CGROUP_FREEZER_MNTPT=$(echo "$CGROUP_V1_MNTS" | grep "/freezer") + if [ -z "$CGROUP_FREEZER_MNTPT" ]; then + echo -n "Cgroup v1 freezer controller: " + $SETCOLOR_FAILURE && echo -n "missing" && $SETCOLOR_NORMAL + echo + fi -CGROUP_MNT_PATH=$(echo "$CGROUP_V1_MNTS" | head -n 1) -if [ -f $CGROUP_MNT_PATH/cgroup.clone_children ]; then - echo -n "Cgroup v1 clone_children flag: " && - $SETCOLOR_SUCCESS && echo "enabled" && $SETCOLOR_NORMAL -else - echo -n "Cgroup ns_cgroup: " && is_enabled CONFIG_CGROUP_NS yes - echo + CGROUP_MNT_PATH=$(echo "$CGROUP_V1_MNTS" | head -n 1) + if [ -f $CGROUP_MNT_PATH/cgroup.clone_children ]; then + echo -n "Cgroup v1 clone_children flag: " && + $SETCOLOR_SUCCESS && echo "enabled" && $SETCOLOR_NORMAL + fi fi echo -n "Cgroup device: " && is_enabled CONFIG_CGROUP_DEVICE