{"record":{"id":"299f8a038ec6c389","repo":"hashicorp/nomad","slug":"failed-to-set-cpuset-mems-on-share-cpuset-partitio","errorCode":null,"errorMessage":"failed to set cpuset.mems on share cpuset partition: %w","messagePattern":"failed to set cpuset\\.mems on share cpuset partition: %w","errorType":"error_code","errorClass":null,"httpStatus":null,"severity":"critical","filePath":"client/lib/cgroupslib/init.go","lineNumber":105,"sourceCode":"\n\t\tif err := writeCG(cores, \"cpuset\", NomadCgroupParent, cpusetFile); err != nil {\n\t\t\treturn fmt.Errorf(\"failed to write cores to nomad cpuset cgroup: %w\", err)\n\t\t}\n\n\t\t//\n\t\t// share partition\n\t\t//\n\n\t\tif err := mkCG(\"cpuset\", NomadCgroupParent, SharePartition()); err != nil {\n\t\t\treturn fmt.Errorf(\"failed to create share cpuset partition: %w\", err)\n\t\t}\n\n\t\tif err := writeCG(noClone, \"cpuset\", NomadCgroupParent, SharePartition(), cloneFile); err != nil {\n\t\t\treturn fmt.Errorf(\"failed to set clone_children on nomad cpuset cgroup: %w\", err)\n\t\t}\n\n\t\tif err := writeCG(memsSet, \"cpuset\", NomadCgroupParent, SharePartition(), memsFile); err != nil {\n\t\t\treturn fmt.Errorf(\"failed to set cpuset.mems on share cpuset partition: %w\", err)\n\t\t}\n\n\t\t//\n\t\t// reserve partition\n\t\t//\n\n\t\tif err := mkCG(\"cpuset\", NomadCgroupParent, ReservePartition()); err != nil {\n\t\t\treturn fmt.Errorf(\"failed to create reserve cpuset partition: %w\", err)\n\t\t}\n\n\t\tif err := writeCG(noClone, \"cpuset\", NomadCgroupParent, ReservePartition(), cloneFile); err != nil {\n\t\t\treturn fmt.Errorf(\"failed to set clone_children on nomad cpuset cgroup: %w\", err)\n\t\t}\n\n\t\tif err := writeCG(memsSet, \"cpuset\", NomadCgroupParent, ReservePartition(), memsFile); err != nil {\n\t\t\treturn fmt.Errorf(\"failed to set cpuset.mems on reserve cpuset partition: %w\", err)\n\t\t}\n","sourceCodeStart":87,"sourceCodeEnd":123,"githubUrl":"https://github.com/hashicorp/nomad/blob/482b49bf1aec006f089bcfc7e632d8f6ac303e5e/client/lib/cgroupslib/init.go#L87-L123","documentation":"During cgroupslib.Init in CG1 mode, writing the mems value to /sys/fs/cgroup/cpuset/<nomad-parent>/share/cpuset.mems failed. The share partition must be pinned to valid memory nodes before task cgroups can be created under it. Failures are typically permission errors or EINVAL if the mems value is empty/invalid relative to the parent.","triggerScenarios":"os.WriteFile on the share partition's cpuset.mems with the detected memsSet fails during Init CG1.","commonSituations":"Root cpuset.mems was empty (cpuset controller newly enabled with no nodes assigned), so writing an empty/invalid value is rejected; non-root agent; container with read-only cgroupfs.","solutions":["Verify /sys/fs/cgroup/cpuset/cpuset.mems at the root contains a valid mask (e.g. 0) before starting Nomad; if empty, assign nodes first.","Run the agent with sufficient privileges to write cgroupfs.","Ensure cgroupfs is mounted rw.","Confirm the detected mems value (root or pre-existing parent) is valid for this system's NUMA topology."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"mems=$(cat /sys/fs/cgroup/cpuset/cpuset.mems 2>/dev/null)\nif [ -z \"$mems\" ] || [ \"$mems\" = \"\" ]; then\n  echo \"root cpuset.mems empty; assign memory nodes before starting Nomad\"\nfi\ncat /sys/fs/cgroup/cpuset/nomad/share/cpuset.mems 2>/dev/null || echo \"share cpuset.mems missing\"","typeGuard":null,"tryCatchPattern":"if err := cgroupslib.Init(logger, cores); err != nil {\n    if strings.Contains(err.Error(), \"cpuset.mems on share\") {\n        return fmt.Errorf(\"invalid/undetected mems mask; verify root cpuset.mems and privileges: %w\", err)\n    }\n    return err\n}","preventionTips":["Ensure root cpuset.mems contains a valid mask (e.g. 0).","Run the agent with write access to cgroupfs.","On NUMA hosts, verify topology matches the detected mems value."],"tags":["linux","cgroups","cgroup-v1","cpuset","numa"],"backgroundTag":"cgroup-cpuset-invalid-mems","analyzedSha":"482b49bf1aec006f089bcfc7e632d8f6ac303e5e","analyzedAt":"2026-09-04T07:54:14.808Z","contentChangedAt":"2026-09-04T07:54:14.808Z","schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}