Struggle moving my cgroup v1 to cgroup v2 on a ubuntu 24.04 container

I am currently struggling switching my cgroup v1 to cgroup v2 on my path to learning on how containers work, I am current using one of the courses that’s taught in Frontendmasters on intros to containers. As you can see I am very new to linux and etc. And I found out in the middle of my course that I have to switch my cgroup to v2, and I have looked into several tutorials about it such as these websites

https://webuzo.com/docs/how-tos/how-to-enable-cgroups-v2/

I’m currently running on a docker container with the latest ubuntu image version, and I have also used the code that confirm its compatible for cgroup v2.

I did the steps and when I’m on my way to do the update-grub command it had this problem. I have been trying to find ways to fix it through websites and etc. But some of the answers are too far fetched for me to get, does anybody here has the solution to this? I would beg for your help, thank you :pray:

# grep cgroup /proc/filesystems
nodev   cgroup
nodev   cgroup2
# stat -fc %T /sys/fs/cgroup
tmpfs
# update-grub
/usr/sbin/grub-probe: error: failed to get canonical path of `overlay'.

I have used all the apt update commands on ubuntu and also installed grubpc, as before it didn’t know it as the command.

I have also did every steps from the websites and it all led to that error or another ones that I do not understand at all. I beg your help, thank you

Client:
Version: 27.1.1
API version: 1.46
Go version: go1.21.12
Git commit: 6312585
Built: Tue Jul 23 19:57:57 2024
OS/Arch: windows/amd64
Context: desktop-linux

Server: Docker Desktop 4.33.1 (161083)
Engine:
Version: 27.1.1
API version: 1.46 (minimum version 1.24)
Go version: go1.21.12
Git commit: cc13f95
Built: Tue Jul 23 19:57:19 2024
OS/Arch: linux/amd64
Experimental: false

containerd:
Version: 1.7.19
GitCommit: 2bf793ef6dc9a18e00cb12efb64355c2c9d5eb41

runc:
Version: 1.7.19
GitCommit: v1.1.13-0-g58aa920

docker-init:
Version: 0.19.0
GitCommit: de40ad0

Wait, do you also run the update-grub command in a container?

Yes, I have only used the grub-update command inside the container, which gives out

/usr/sbin/grub-probe: error: failed to get canonical path of `overlay'.```

That command has to run “on the host” (=not in a container). The container has no boot loader as a container doesn’t boot like a virtual machine.

So perhaps it is impossible to move my cgroup version from a docker container because it doesn’t have any boot loader that behaves like a virtual machine, or perhaps I’m missing something that I can actually do?

I apologize as I am very new to learning about containers and trying to create a container inside a container. Thank you

Linux Control Groups or CGroups is a Linux kernel feature: cgroups - Wikipedia
You can’t change it inside a container, but you can change it on the host, so when you run the new container, it will use CGroup v2.