Add check for CONFIG_CGROUP_BPF in check-config.sh

cgroup v2 requires CONFIG_CGROUP_BPF kernel option to be set
else runc can not start containers.

check-config.sh script checks if the CONFIG_CGROUP_BPF option
is set. The script checks if version of kernel is atleast
4.15 and cgroup v2 is being used before checking if the
CONFIG_CGROUP_BPF option is set.

Closes #3547

Signed-off-by: dharmicksai <dharmicksaik@gmail.com>
This commit is contained in:
dharmicksai
2022-09-08 14:28:47 +05:30
parent 4a51b04703
commit 29a28848de

View File

@@ -178,14 +178,17 @@ echo
echo 'Generally Necessary:'
cgroup=""
echo -n '- '
if [ "$(stat -f -c %t /sys/fs/cgroup 2>/dev/null)" = "63677270" ]; then
wrap_good 'cgroup hierarchy' 'cgroupv2'
cgroup="v2"
else
cgroupSubsystemDir="$(awk '/[, ](cpu|cpuacct|cpuset|devices|freezer|memory)[, ]/ && $3 == "cgroup" { print $2 }' /proc/mounts | head -n1)"
cgroupDir="$(dirname "$cgroupSubsystemDir")"
if [ -d "$cgroupDir/cpu" ] || [ -d "$cgroupDir/cpuacct" ] || [ -d "$cgroupDir/cpuset" ] || [ -d "$cgroupDir/devices" ] || [ -d "$cgroupDir/freezer" ] || [ -d "$cgroupDir/memory" ]; then
wrap_good 'cgroup hierarchy' 'properly mounted' "[$cgroupDir]"
cgroup="v1"
else
if [ "$cgroupSubsystemDir" ]; then
wrap_bad 'cgroup hierarchy' 'single mountpoint!' "[$cgroupSubsystemDir]"
@@ -227,6 +230,12 @@ flags=(
)
check_flags "${flags[@]}"
if ! kernel_lt 4 14; then
if [ $cgroup = "v2" ]; then
check_flags CGROUP_BPF
fi
fi
if kernel_lt 5 1; then
check_flags NF_NAT_IPV4
fi