hashicorp/nomad · critical

failed to create reserve cpuset partition: %w

Error message

failed to create reserve cpuset partition: %w

What it means

During cgroupslib.Init in CG1 mode, creating the reserve cpuset partition directory (/sys/fs/cgroup/cpuset/<nomad-parent>/reserve) via os.MkdirAll failed. This directory holds cgroups for tasks with reserved (dedicated) cores. The error is a filesystem mkdir failure, typically EACCES, EROFS, or a missing cpuset mount.

Source

Thrown at client/lib/cgroupslib/init.go:113

		if err := mkCG("cpuset", NomadCgroupParent, SharePartition()); err != nil {
			return fmt.Errorf("failed to create share cpuset partition: %w", err)
		}

		if err := writeCG(noClone, "cpuset", NomadCgroupParent, SharePartition(), cloneFile); err != nil {
			return fmt.Errorf("failed to set clone_children on nomad cpuset cgroup: %w", err)
		}

		if err := writeCG(memsSet, "cpuset", NomadCgroupParent, SharePartition(), memsFile); err != nil {
			return fmt.Errorf("failed to set cpuset.mems on share cpuset partition: %w", err)
		}

		//
		// reserve partition
		//

		if err := mkCG("cpuset", NomadCgroupParent, ReservePartition()); err != nil {
			return fmt.Errorf("failed to create reserve cpuset partition: %w", err)
		}

		if err := writeCG(noClone, "cpuset", NomadCgroupParent, ReservePartition(), cloneFile); err != nil {
			return fmt.Errorf("failed to set clone_children on nomad cpuset cgroup: %w", err)
		}

		if err := writeCG(memsSet, "cpuset", NomadCgroupParent, ReservePartition(), memsFile); err != nil {
			return fmt.Errorf("failed to set cpuset.mems on reserve cpuset partition: %w", err)
		}

		log.Debug("nomad cpuset partitions initialized", "cores", cores)

	case CG2:
		// the cgroup controllers we need to activate at the root and on the nomad slice
		const activation = "+cpuset +cpu +io +memory +pids"

		// the name of the cgroup subtree interface file
		const subtreeFile = "cgroup.subtree_control"

View on GitHub (pinned to 482b49bf1a)

Solutions

  1. Run Nomad as root or grant capabilities to manage cgroups.
  2. Confirm the cpuset controller is mounted and the parent nomad cgroup exists and is writable.
  3. Remount cgroupfs rw in containerized environments.
  4. Clear any stale file occupying the reserve directory path.
Defensive patterns

Strategy: validation

Validate before calling

test -d /sys/fs/cgroup/cpuset/nomad && echo ok || echo "nomad cpuset parent missing"
mkdir -p /sys/fs/cgroup/cpuset/nomad/reserve 2>&1 # pre-check as the running user

Try / catch

if err := cgroupslib.Init(logger, cores); err != nil {
    if strings.Contains(err.Error(), "reserve cpuset partition") {
        return fmt.Errorf("cannot create reserve cgroup; run as root on cgroup v1 host: %w", err)
    }
    return err
}

Prevention

When it happens

Trigger: mkCG("cpuset", NomadCgroupParent, ReservePartition()) fails during Init CG1, after the share partition was fully configured.

Common situations: Agent without root privileges; cgroupfs mounted read-only; cgroup v2-only host lacking /sys/fs/cgroup/cpuset; leftover filesystem object at the reserve path.

Related errors


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