Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enable cgroup v2 #21

Open
nicholasdille opened this issue Aug 4, 2023 · 0 comments
Open

Enable cgroup v2 #21

nicholasdille opened this issue Aug 4, 2023 · 0 comments
Labels
enhancement New feature or request

Comments

@nicholasdille
Copy link
Contributor

: "${cgroup_version:=v2}"
current_cgroup_version="v1"
if test "$(stat -fc %T /sys/fs/cgroup/)" == "cgroup2fs"; then
    current_cgroup_version="v2"
fi
if type update-grub >/dev/null 2>&1 && test "${cgroup_version}" == "v2" && test "${current_cgroup_version}" == "v1"; then
    if test -n "${WSL_DISTRO_NAME}"; then
        error "Unable to enable cgroup v2 on WSL. Please refer to https://github.com/microsoft/WSL/issues/6662."
        error "        Please rerun this script with CGROUP_VERSION=v1"
        exit 1
    fi

    echo "cgroup v2"
    echo "Configure grub"
    sed -i 's/GRUB_CMDLINE_LINUX=""/GRUB_CMDLINE_LINUX="systemd.unified_cgroup_hierarchy=1"/' "${prefix}/etc/default/grub"
    echo "Update grub"
    update-grub

    if ! ${no_cgroup_reboot}; then
        read -r -p "Reboot to enable cgroup v2 (y/N)"
        if test "${REPLY,,}" == "y"; then
            reboot
            exit
        fi
    fi
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant