cloudfoundry / bosh-linux-stemcell-builder

BOSH Ubuntu Linux stemcells
Apache License 2.0
41 stars 104 forks source link

Noble uses control groups (cgroups) v2 instead of v1 #327

Closed cunnie closed 1 month ago

cunnie commented 4 months ago

Control Groups v2 is the new standard; Ubuntu switched to it as the default since pre-Jammy Impish Indra (21.10).

Kernel 6.5 + cgroups v1 has caused problems (OOM during staging): #318

This change will probably affect the following components:

rkoster commented 3 months ago

Garden cgroups v2 support: https://github.com/cloudfoundry/guardian/commit/a11a929395980a7ccd5d44ad7bc68ae70ff350e5

cunnie commented 3 months ago

If you're testing on a Jammy stemcell with cgroups v2, and the agent isn't coming up ("unresponsive agent"), then you need to do the following:

-    net_cls_location="$(cat /proc/self/mounts | grep ^cgroup | grep net_cls | awk '{ print $2 }' )"
-    monit_access_cgroup="${net_cls_location}/monit-api-access"
-
-    mkdir -p "${monit_access_cgroup}"
-    echo "${monit_isolation_classid}" > "${monit_access_cgroup}/net_cls.classid"
-
-    echo $$ > "${monit_access_cgroup}/tasks"
+       :
 }

Note: we need to get rid of monit-access-helper.sh because hopefully we'll have deprecated monit by the time we get to Noble.

Also, see above for where in the BOSH Agent we need to make changes to accommodate cgroups-v1-with-monit and cgroups-v2-no-monit.

ramonskie commented 2 months ago

current noble stemcell is on cgroup v2 https://github.com/cloudfoundry/bosh-linux-stemcell-builder/commit/933220bb3c24781bd6e2d983793c570c2add1940

currently i have removed the helpers and monit wrapper and used the following iptable rules

        -m cgroup \! --path "/system.slice/monit.service" -j DROP
then
  /bin/true
else
    iptables -t mangle -I POSTROUTING -d 127.0.0.1 -p tcp --dport 2822 \
         -m cgroup \! --path "/system.slice/monit.service" -j DROP
    iptables -t mangle -I POSTROUTING -d 127.0.0.1 -p tcp --dport 2822 \
         -m state --state ESTABLISHED,RELATED -j ACCEPT
fi
ramonskie commented 2 months ago

we moved to nftables see https://github.com/cloudfoundry/bosh-linux-stemcell-builder/commit/e1245f41aa5db4acc6d7e3bc81acab0ebdd8509f

ramonskie commented 1 month ago

noble now uses cgroups v2. there is a issue created for warden #352