How can I unmount cgroup version 1?

How can I remove cgroup version 1 mount points such that I only cgroup version 2 in my /sys/fs/?

Answers:

Thank you for visiting the Q&A section on Magenaut. Please note that all the answers may not help you solve the issue immediately. So please treat them as advisements. If you found the post helpful (or not), leave a comment & I’ll get back to you as soon as possible.

Method 1

One easy way to do it is like this,

mount -t cgroup | cut -f 3 -d ' ' | xargs sudo umount

This will select only the mounts that are part of cgroup version 1, taking just their mount points and then unmounting them.

Update: You may also want to clean up the remaining relics on tmpsfs mount at /sys/fs/cgroup (taken from the answer there),

sudo mount -o remount,rw /sys/fs/cgroup
# Delete the symlinks
sudo find /sys/fs/cgroup -maxdepth 1 -type l -exec rm {} ;
# Delete the empty directories
sudo find /sys/fs/cgroup/ -links 2 -type d -not -path '/sys/fs/cgroup/unified/*' -exec rmdir -v {} ;
sudo mount -o remount,ro /sys/fs/cgroup


All methods was sourced from stackoverflow.com or stackexchange.com, is licensed under cc by-sa 2.5, cc by-sa 3.0 and cc by-sa 4.0

0 0 votes
Article Rating
Subscribe
Notify of
guest

0 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x