{"record":{"id":"2a024b526c89cccb","repo":"hashicorp/nomad","slug":"failed-to-configure-container-s-v","errorCode":null,"errorMessage":"failed to configure container(%s): %v","messagePattern":"failed to configure container\\((.+?)\\): (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"drivers/shared/executor/executor_linux_cgo.go","lineNumber":198,"sourceCode":"\treturn fmt.Errorf(\"orphaned processes %v have not been removed from cgroups pid file\", orphanedPIDs)\n}\n\n// Launch creates a new container in libcontainer and starts a new process with it\nfunc (l *LibcontainerExecutor) Launch(command *ExecCommand) (*ProcessState, error) {\n\tl.logger.Trace(\"preparing to launch command\", \"command\", command.Cmd, \"args\", strings.Join(command.Args, \" \"))\n\n\tif command.Resources == nil {\n\t\tcommand.Resources = &drivers.Resources{\n\t\t\tNomadResources: &structs.AllocatedTaskResources{},\n\t\t}\n\t}\n\n\tl.command = command\n\n\t// A container groups processes under the same isolation enforcement\n\tcontainerCfg, err := l.newLibcontainerConfig(command)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"failed to configure container(%s): %v\", l.id, err)\n\t}\n\n\tif err := l.cleanOldProcessesInCGroup(containerCfg.Cgroups.Path); err != nil {\n\t\treturn nil, err\n\t}\n\n\tcontainer, err := libcontainer.Create(path.Join(command.TaskDir, \"../alloc/container\"), l.id, containerCfg)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"failed to create container(%s): %v\", l.id, err)\n\t}\n\tl.container = container\n\n\t// Look up the binary path and make it executable\n\ttaskPath, hostPath, err := lookupTaskBin(command)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif err := makeExecutable(hostPath); err != nil {","sourceCodeStart":180,"sourceCodeEnd":216,"githubUrl":"https://github.com/hashicorp/nomad/blob/482b49bf1aec006f089bcfc7e632d8f6ac303e5e/drivers/shared/executor/executor_linux_cgo.go#L180-L216","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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)"],"exampleFix":null,"handlingStrategy":"validation","validationCode":"cmd := &executor.ExecCommand{ /* ... */ }\nif cmd.ResourceLimits && cmd.StatsCgroup() == \"\" {\n    return fmt.Errorf(\"ResourceLimits requires a stats cgroup\")\n}\n// also validate mounts/namespaces/capabilities against kernel support before Launch","typeGuard":null,"tryCatchPattern":"if _, err := executor.Launch(cmd); err != nil && strings.Contains(err.Error(), \"failed to configure container\") {\n    log.Printf(\"container config invalid: %v\", err) // suffix names the failing step\n}","preventionTips":["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"],"tags":["libcontainer","configuration","cgroups","executor"],"backgroundTag":"container-config-invalid","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"}