Skip to content

Commit

Permalink
mocaccino/mocaccino-init: use cgroups v2
Browse files Browse the repository at this point in the history
  • Loading branch information
joostruis committed Jan 4, 2025
1 parent bc0751f commit 5df54e8
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
13 changes: 13 additions & 0 deletions packages/mocaccino/mocaccino-init/02_overlay.sh
Original file line number Diff line number Diff line change
Expand Up @@ -309,6 +309,19 @@ mount --move /proc /mnt/proc
mount --move /tmp /mnt/tmp
echo -e "Mount locations \\e[94m/dev\\e[0m, \\e[94m/sys\\e[0m, \\e[94m/tmp\\e[0m and \\e[94m/proc\\e[0m have been moved to \\e[94m/mnt\\e[0m."

# Enable cgroups v2
if [ ! -d /mnt/sys/fs/cgroup ]; then
mkdir -p /mnt/sys/fs/cgroup
fi
echo "Mounting cgroups v2..."
mount -t cgroup2 none /mnt/sys/fs/cgroup

# Ensure legacy cgroups (v1) are unmounted if present
for subsystem in $(ls /mnt/sys/fs/cgroup 2>/dev/null); do
umount /mnt/sys/fs/cgroup/$subsystem || true
done
echo "Cgroups v2 setup complete."

# The new mountpoint becomes file system root. All original root folders are
# deleted automatically as part of the command execution. The '/sbin/init'
# process is invoked and it becomes the new PID 1 parent process.
Expand Down
2 changes: 1 addition & 1 deletion packages/mocaccino/mocaccino-init/definition.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
category: "system"
name: "mocaccino-init"
version: "0.20210828+3"
version: "0.20210828+4"

0 comments on commit 5df54e8

Please sign in to comment.