{"record":{"id":"8dd9d48cb2396f3b","repo":"k3s-io/k3s","slug":"failed-to-find-memory-cgroup-you-may-need-to-add","errorCode":null,"errorMessage":"failed to find memory cgroup, you may need to add \"cgroup_memory=1 cgroup_enable=memory\" to your linux cmdline (/boot/cmdline.txt on a Raspberry Pi)","messagePattern":"failed to find memory cgroup, you may need to add \"cgroup_memory=1 cgroup_enable=memory\" to your linux cmdline \\(/boot/cmdline\\.txt on a Raspberry Pi\\)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"critical","filePath":"pkg/cgroups/cgroups_linux.go","lineNumber":49,"sourceCode":"func validateCgroupsV1() error {\n\tcontrollers, err := cgroupsv1.Default()\n\tif err != nil {\n\t\treturn err\n\t}\n\tm := make(map[string]struct{})\n\tfor _, controller := range controllers {\n\t\tname := string(controller.Name())\n\t\tm[name] = struct{}{}\n\t}\n\n\tif _, ok := m[\"cpuset\"]; !ok {\n\t\tlogrus.Warn(`Failed to find cpuset cgroup, you may need to add \"cgroup_enable=cpuset\" to your linux cmdline (/boot/cmdline.txt on a Raspberry Pi)`)\n\t}\n\n\tif _, ok := m[\"memory\"]; !ok {\n\t\tmsg := \"ailed to find memory cgroup, you may need to add \\\"cgroup_memory=1 cgroup_enable=memory\\\" to your linux cmdline (/boot/cmdline.txt on a Raspberry Pi)\"\n\t\tlogrus.Error(\"F\" + msg)\n\t\treturn errors.New(\"f\" + msg)\n\t}\n\n\treturn nil\n}\n\nfunc validateCgroupsV2() error {\n\tmanager, err := cgroupsv2.NewManager(\"/sys/fs/cgroup\", \"/\", &cgroupsv2.Resources{})\n\tif err != nil {\n\t\treturn err\n\t}\n\tcontrollers, err := manager.RootControllers()\n\tif err != nil {\n\t\treturn err\n\t}\n\tm := make(map[string]struct{})\n\tfor _, controller := range controllers {\n\t\tm[controller] = struct{}{}\n\t}","sourceCodeStart":31,"sourceCodeEnd":67,"githubUrl":"https://github.com/k3s-io/k3s/blob/6ba341e396edc16b8dcae978a7c5e3ac7ee5606e/pkg/cgroups/cgroups_linux.go#L31-L67","documentation":"During cgroup v1 validation k3s lists active controllers; a missing 'cpuset' controller only logs a warning, but a missing 'memory' controller is fatal because kubelet cannot enforce memory limits/reservations without it. The message includes the remedy because the dominant cause is a kernel booted without the memory cgroup enabled — classically on Raspberry Pi / embedded boards.","triggerScenarios":"Host booted without cgroup_memory=1 cgroup_enable=memory (Raspberry Pi OS and some ARM boards default to memory cgroups off); lxc/container configs that mask the memory controller from the guest; very old kernels lacking the controller.","commonSituations":"Raspberry Pi clusters (hence the /boot/cmdline.txt hint); Armbian/embedded SBCs; k3s inside an LXC container where the proxied cgroup set lacks memory; upgrading an old node to a k3s version that validates strictly.","solutions":["Add cgroup_memory=1 cgroup_enable=memory to the kernel command line (/boot/cmdline.txt on Raspberry Pi, GRUB_CMDLINE_LINUX on GRUB systems) and reboot","For LXC: ensure the container's cgroup set includes the memory controller (lxc.apparmor / cgroup config in Proxmox)","Verify after reboot: grep memory /proc/cgroups and cat /proc/cgroups shows the memory controller enabled with non-zero hierarchy","On cgroup v2 hosts this check is bypassed — switching the host to unified v2 also avoids it"],"exampleFix":"# before (/boot/cmdline.txt on Raspberry Pi)\nconsole=serial0,115200 root=/dev/mmcblk0p2 rootwait\n# -> failed to find memory cgroup\n\n# after\nconsole=serial0,115200 root=/dev/mmcblk0p2 rootwait cgroup_memory=1 cgroup_enable=memory\n# then: sudo reboot","handlingStrategy":"validation","validationCode":"func memoryCgroupEnabled() bool {\n    if cgroups.Mode() == cgroups.Unified { return true } // v2 check differs\n    b, err := os.ReadFile(\"/proc/cgroups\")\n    if err != nil { return false }\n    for _, line := range strings.Split(string(b), \"\\n\") {\n        f := strings.Fields(line)\n        if len(f) >= 4 && f[0] == \"memory\" { return f[3] != \"0\" }\n    }\n    return false\n}\nif !memoryCgroupEnabled() { log.Fatal(\"enable memory cgroup: add cgroup_memory=1 cgroup_enable=memory to kernel cmdline\") }","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Bake cgroup_memory=1 cgroup_enable=memory into SBC/RPi images from day one","Run a preflight cgroup check in node provisioning before k3s install","For LXC/PVE containers, enable the memory controller in the container config"],"tags":["cgroups","memory","raspberry-pi","kernel","cmdline"],"backgroundTag":null,"analyzedSha":"6ba341e396edc16b8dcae978a7c5e3ac7ee5606e","analyzedAt":"2026-08-15T16:27:54.286Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}