hashicorp/nomad · error

cannot open cpuset

Error message

cannot open cpuset

What it means

OpenFromFreezerCG1 derives a cgroup v1 interface handle by rewriting a freezer cgroup path (e.g. /freezer/ -> /cpuset/). The cpuset controller does not follow the freezer path layout this helper supports, so requesting iface="cpuset" is treated as a programming error and panics instead of returning a bogus path.

Source

Thrown at client/lib/cgroupslib/editor.go:43

	return root
}

// OpenPath creates a handle for modifying cgroup interface files under
// the given directory.
//
// In cgroups v1 this will be like, "<root>/<interface>/<parent>/<scope>".
// In cgroups v2 this will be like, "<root>/<parent>/<scope>".
func OpenPath(dir string) Interface {
	return &editor{
		dpath: dir,
	}
}

// OpenFromFreezerCG1 creates a handle for modifying cgroup interface files
// of the given interface, given a path to the freezer cgroup.
func OpenFromFreezerCG1(orig, iface string) Interface {
	if iface == "cpuset" {
		panic("cannot open cpuset")
	}
	p := strings.Replace(orig, "/freezer/", "/"+iface+"/", 1)
	return OpenPath(p)
}

// An Interface can be used to read and write the interface files of a cgroup.
type Interface interface {
	// Read the content of filename.
	Read(filename string) (string, error)

	// Write content to filename.
	Write(filename, content string) error

	// PIDs returns the set of process IDs listed in the cgroup.procs
	// interface file. We use a set here because the kernel recommends doing
	// so.
	//
	//   This list is not guaranteed to be sorted or free of duplicate TGIDs,

View on GitHub (pinned to 482b49bf1a)

Solutions

  1. Do not pass "cpuset" to OpenFromFreezerCG1; use the dedicated cpuset open helper (OpenPath on the cpuset mount point) instead
  2. Verify the client's supported cgroup controllers config excludes cpuset from the freezer-derived path logic
  3. Check cgroupslib version — cpuset handling may belong in a different code path for cgroup v1

Example fix

// before
iface := OpenFromFreezerCG1(path, "cpuset")
// after
iface := cgroupslib.OpenPath(strings.Replace(path, "/freezer/", "/cpuset/", 1)) // dedicated cpuset path, not the freezer helper
Defensive patterns

Strategy: validation

Validate before calling

if iface == "cpuset" {
    // route to the dedicated cpuset helper instead
    return cgroupslib.OpenPath(path)
}

Try / catch

func openSafe(orig, iface string) (h cgroupslib.Interface, err error) {
    defer func() {
        if r := recover(); r != nil {
            err = fmt.Errorf("cannot open %s cgroup: %v", iface, r)
        }
    }()
    return cgroupslib.OpenFromFreezerCG1(orig, iface), nil
}

Prevention

When it happens

Trigger: Calling OpenFromFreezerCG1(orig, "cpuset") directly, or via enterCG1/configureCG1 with a cgroup v1 configuration where the cpuset controller is requested through the freezer-derived path helper.

Common situations: Misconfigured Nomad client cgroup settings listing cpuset in the controllers handled by this code path; running on cgroup v1 hosts where controllers are mounted in separate hierarchies; recent refactors of cgroupslib that reroute cpuset handling incorrectly.

Related errors


AI-assisted analysis of hashicorp/nomad@482b49bf1a (2026-09-04). Data as JSON: /api/errors/9b96421d80aea12a. Report an issue: GitHub.