hashicorp/nomad · error
QEMU driver can't execute commands
Error message
QEMU driver can't execute commands
What it means
Unconditional error from the QEMU driver's ExecTask: commands cannot be executed inside a QEMU-started virtual machine, so any exec request against a QEMU task always fails.
Source
Thrown at drivers/qemu/driver.go:814
func (d *Driver) TaskStats(ctx context.Context, taskID string, interval time.Duration) (<-chan *drivers.TaskResourceUsage, error) {
handle, ok := d.tasks.Get(taskID)
if !ok {
return nil, drivers.ErrTaskNotFound
}
return handle.exec.Stats(ctx, interval)
}
func (d *Driver) TaskEvents(ctx context.Context) (<-chan *drivers.TaskEvent, error) {
return d.eventer.TaskEvents(ctx)
}
func (d *Driver) SignalTask(_ string, _ string) error {
return fmt.Errorf("QEMU driver can't signal commands")
}
func (d *Driver) ExecTask(_ string, _ []string, _ time.Duration) (*drivers.ExecTaskResult, error) {
return nil, fmt.Errorf("QEMU driver can't execute commands")
}
// GetAbsolutePath returns the absolute path of the passed binary by resolving
// it in the path and following symlinks.
func GetAbsolutePath(bin string) (string, error) {
lp, err := exec.LookPath(bin)
if err != nil {
return "", fmt.Errorf("failed to resolve path to %q executable: %v", bin, err)
}
return filepath.EvalSymlinks(lp)
}
func (d *Driver) handleWait(ctx context.Context, handle *taskHandle, ch chan *drivers.ExitResult) {
defer close(ch)
var result *drivers.ExitResult
ps, err := handle.exec.Wait(ctx)View on GitHub (pinned to 482b49bf1a)
Solutions
- Use exec-based tooling inside the guest VM (SSH, cloud-init, QEMU guest agent) instead
- Switch exec-based health checks to TCP/HTTP checks against the VM
- Use the raw_exec or exec driver if in-VM exec via Nomad is essential
Example fix
// before
res, err := driver.ExecTask(taskID, []string{"ls"}, time.Second) // unsupported
// after
// check: nomad alloc exec only works for exec/java/raw_exec drivers; use ssh into the VM Defensive patterns
Strategy: validation
Validate before calling
// Go: gate exec calls by driver kind
if driverName == "qemu" {
return errors.New("exec unsupported; use ssh/guest agent")
} Try / catch
if _, err := drv.ExecTask(id, cmd, timeout); err != nil && strings.Contains(err.Error(), "can't execute commands") {
// fall back to ssh into the VM
} Prevention
- Avoid exec-based health checks on QEMU tasks; use TCP/HTTP checks
- Do not use `nomad alloc exec` on QEMU allocations
- Plan VM debugging via SSH or cloud-init
When it happens
Trigger: Calling Driver.ExecTask(taskID, cmd, timeout) on a QEMU task, e.g. nomad alloc exec or exec-based health checks against a QEMU workload.
Common situations: Running `nomad alloc exec <alloc> qemu-task -- ls` ; exec-based check blocks in job specs; debugging scripts assuming exec support.
Related errors
- QEMU driver can't signal commands
- QEMU Guest Agent socket is unsupported on the Windows platfo
- monitorPath not set
- executor Shutdown failed: %v
- cannot destroy running task
AI-assisted analysis of hashicorp/nomad@482b49bf1a (2026-09-04).
Data as JSON: /api/errors/9353ac725f455e9e.
Report an issue: GitHub.