hashicorp/nomad · error
failed to configure container(%s): %v
Error message
failed to configure container(%s): %v
What it means
Launch wraps any failure from l.newLibcontainerConfig(command) with this error, prefixing the executor/container id. newLibcontainerConfig builds the libcontainer Config (namespaces, mounts, cgroups, capabilities, device rules) from the ExecCommand; a problem anywhere in that construction surfaces here with the original error appended as %v.
Source
Thrown at drivers/shared/executor/executor_linux_cgo.go:198
return fmt.Errorf("orphaned processes %v have not been removed from cgroups pid file", orphanedPIDs)
}
// Launch creates a new container in libcontainer and starts a new process with it
func (l *LibcontainerExecutor) Launch(command *ExecCommand) (*ProcessState, error) {
l.logger.Trace("preparing to launch command", "command", command.Cmd, "args", strings.Join(command.Args, " "))
if command.Resources == nil {
command.Resources = &drivers.Resources{
NomadResources: &structs.AllocatedTaskResources{},
}
}
l.command = command
// A container groups processes under the same isolation enforcement
containerCfg, err := l.newLibcontainerConfig(command)
if err != nil {
return nil, fmt.Errorf("failed to configure container(%s): %v", l.id, err)
}
if err := l.cleanOldProcessesInCGroup(containerCfg.Cgroups.Path); err != nil {
return nil, err
}
container, err := libcontainer.Create(path.Join(command.TaskDir, "../alloc/container"), l.id, containerCfg)
if err != nil {
return nil, fmt.Errorf("failed to create container(%s): %v", l.id, err)
}
l.container = container
// Look up the binary path and make it executable
taskPath, hostPath, err := lookupTaskBin(command)
if err != nil {
return nil, err
}
if err := makeExecutable(hostPath); err != nil {View on GitHub (pinned to 482b49bf1a)
Solutions
- Read the wrapped %v suffix — it names the actual config step that failed (often 'configureCgroups: ...')
- Ensure the task has a stats cgroup allocated (command.StatsCgroup() non-empty) when ResourceLimits is enabled
- Validate the task's driver config (mounts, namespaces, capabilities) against supported values for your kernel
- Confirm the host supports the required cgroups/namespaces (cgroup v2 vs v1 setup for Nomad)
Defensive patterns
Strategy: validation
Validate before calling
cmd := &executor.ExecCommand{ /* ... */ }
if cmd.ResourceLimits && cmd.StatsCgroup() == "" {
return fmt.Errorf("ResourceLimits requires a stats cgroup")
}
// also validate mounts/namespaces/capabilities against kernel support before Launch Try / catch
if _, err := executor.Launch(cmd); err != nil && strings.Contains(err.Error(), "failed to configure container") {
log.Printf("container config invalid: %v", err) // suffix names the failing step
} Prevention
- Always assign the stats cgroup when ResourceLimits is true
- Test driver task configs (mounts, caps, namespaces) on the target kernel before rollout
- Keep host cgroups/namespaces enabled and consistent with Nomad client config
When it happens
Trigger: newLibcontainerConfig fails: configureCgroups error (ErrCgroupMustBeSet), invalid namespaces/capabilities config, mount setup failure (e.g. /dev, /proc), or an invalid device/cgroup path derived from the command.
Common situations: Task launched without an allocated stats cgroup while ResourceLimits=true; malformed driver task config (bad cgroup path, unknown namespace); kernel lacking required namespaces/cgroups (e.g. no cgroup v2 support configured); missing device rules for the task.
Related errors
- configureCgroups: %w
- error setting up exec subcommand: %w
- ErrCgroupMustBeSet
- unable to get orphaned task PIDs: %v
- unable to send signal to process %d: %v
AI-assisted analysis of hashicorp/nomad@482b49bf1a (2026-09-04).
Data as JSON: /api/errors/2a024b526c89cccb.
Report an issue: GitHub.