All Products
Search
Document Center

Alibaba Cloud Linux:How to switch to cgroup v1 in Alibaba Cloud Linux 4

Last Updated:Apr 01, 2026

Alibaba Cloud Linux 4 uses cgroup v2 by default. If your workloads depend on cgroup v1 APIs—such as older monitoring agents, container runtimes, or Java applications without cgroup v2 support—you can switch the active cgroup version to v1.

cgroup v1 and cgroup v2 differ significantly in design and API. For a comparison, see Differences between cgroup v1 and cgroup v2.

When to switch to cgroup v1

Switch to cgroup v1 if your environment includes software that directly accesses the cgroup filesystem and does not yet support cgroup v2. Common cases include:

  • Third-party monitoring or security agents that depend on cgroup v1 subsystems

  • Older container runtimes not yet updated for cgroup v2

Both cgroup v1 and cgroup v2 are compiled into the kernel. The active version is determined by systemd at boot time based on kernel command-line parameters—not by the kernel itself. The parameters added in the steps below instruct systemd to mount cgroup v1 hierarchies on startup.

Prerequisites

Before you begin, make sure you have:

  • Root access on the Alibaba Cloud Linux 4 instance

Switch to cgroup v1

  1. Check the current cgroup version.

    mount | grep cgroup

    If the output contains cgroup2, cgroup v2 is active:

    cgroup2 on /sys/fs/cgroup type cgroup2 (rw,nosuid,nodev,noexec,relatime,nsdelegate,memory_recursiveprot)
  2. Add the cgroup v1 kernel parameters to the current boot entry.

    grubby --update-kernel=/boot/vmlinuz-$(uname -r) --args="systemd.unified_cgroup_hierarchy=0 systemd.legacy_systemd_cgroup_controller"
  3. Reboot the instance for the changes to take effect.

    reboot

Verify cgroup v1 is active

After the instance restarts, confirm that cgroup v1 is active.

  1. Run the mount check.

    mount | grep cgroup

    The output should show a tmpfs mount on /sys/fs/cgroup and individual subsystem mounts beneath it—not a single cgroup2 entry:

    tmpfs on /sys/fs/cgroup type tmpfs (ro,nosuid,nodev,noexec,size=4096k,nr_inodes=1024,mode=755)
    cgroup on /sys/fs/cgroup/systemd type cgroup (rw,nosuid,nodev,noexec,relatime,xattr,release_agent=/usr/lib/systemd/systemd-cgroups-agent,name=systemd)
    cgroup on /sys/fs/cgroup/cpu,cpuacct type cgroup (rw,nosuid,nodev,noexec,relatime,cpu,cpuacct)
    cgroup on /sys/fs/cgroup/rdma type cgroup (rw,nosuid,nodev,noexec,relatime,rdma)
    cgroup on /sys/fs/cgroup/memory type cgroup (rw,nosuid,nodev,noexec,relatime,memory)
    cgroup on /sys/fs/cgroup/freezer type cgroup (rw,nosuid,nodev,noexec,relatime,freezer)
    cgroup on /sys/fs/cgroup/net_cls,net_prio type cgroup (rw,nosuid,nodev,noexec,relatime,net_cls,net_prio)
    cgroup on /sys/fs/cgroup/devices type cgroup (rw,nosuid,nodev,noexec,relatime,devices)
    cgroup on /sys/fs/cgroup/cpuset type cgroup (rw,nosuid,nodev,noexec,relatime,cpuset)
    cgroup on /sys/fs/cgroup/perf_event type cgroup (rw,nosuid,nodev,noexec,relatime,perf_event)
    cgroup on /sys/fs/cgroup/pids type cgroup (rw,nosuid,nodev,noexec,relatime,pids)
    cgroup on /sys/fs/cgroup/hugetlb type cgroup (rw,nosuid,nodev,noexec,relatime,hugetlb)
    cgroup on /sys/fs/cgroup/blkio type cgroup (rw,nosuid,nodev,noexec,relatime,blkio)

    The tmpfs mount on /sys/fs/cgroup and the individual subsystem mounts (such as memory, cpu,cpuacct, and blkio) confirm that cgroup v1 is active.

  2. (Optional) List the mounted subsystems under /sys/fs/cgroup/.

    ls /sys/fs/cgroup/