Give friendlier messages when cgroup v2 is not enabled

This commit is contained in:
Omar Brikaa 2024-10-04 19:30:57 +03:00
parent 47661343da
commit 24c5c05308
1 changed files with 16 additions and 0 deletions

View File

@ -1,5 +1,21 @@
#!/bin/bash #!/bin/bash
CGROUP_FS="/sys/fs/cgroup"
if [ ! -e "$CGROUP_FS" ]; then
echo "Cannot find $CGROUP_FS. Please make sure your system is using cgroup v2"
exit 1
fi
if [ -e "$CGROUP_FS/unified" ]; then
echo "Combined cgroup v1+v2 mode is not supported. Please make sure your system is using pure cgroup v2"
exit 1
fi
if [ ! -e "$CGROUP_FS/cgroup.subtree_control" ]; then
echo "Cgroup v2 not found. Please make sure cgroup v2 is enabled on your system"
exit 1
fi
cd /sys/fs/cgroup && \ cd /sys/fs/cgroup && \
mkdir isolate/ && \ mkdir isolate/ && \
echo 1 > isolate/cgroup.procs && \ echo 1 > isolate/cgroup.procs && \