hashicorp/nomad · error

KVM accelerator is unsupported on the current platform

Error message

KVM accelerator is unsupported on the current platform

What it means

The QEMU driver throws this during StartTask when the accelerator is set to "kvm" but the host is Windows or macOS. KVM is a Linux kernel virtualization module; -enable-kvm only works where /dev/kvm exists, so the driver fails fast instead of letting QEMU die with an obscure runtime error.

Source

Thrown at drivers/qemu/driver.go:623

			for _, p := range protocols {
				netdevArgs = append(netdevArgs, fmt.Sprintf("hostfwd=%s::%d-:%d", p, host, guest))
			}
		}

		if len(netdevArgs) != 0 {
			args = append(args,
				"-netdev",
				fmt.Sprintf("user,id=user.0,%s", strings.Join(netdevArgs, ",")),
				"-device", "virtio-net,netdev=user.0",
			)
		}
	}

	// If using KVM, add optimization args
	if accelerator == "kvm" {
		if runtime.GOOS == "windows" || runtime.GOOS == "darwin" {
			return nil, nil, errors.New("KVM accelerator is unsupported on the current platform")
		}

		args = append(args, "-enable-kvm")

		// If the user has not set the -smp flag, default to resources.cores
		if !slices.Contains(args, "-smp") && cfg.Resources.LinuxResources != nil && cfg.Resources.LinuxResources.CpusetCpus != "" {
			cores := strings.Split(cfg.Resources.LinuxResources.CpusetCpus, ",")
			args = append(args,
				"-smp", fmt.Sprintf("%d", len(cores)),
			)
		}
	}
	d.logger.Debug("starting QEMU VM command ", "args", strings.Join(args, " "))

	pluginLogFile := filepath.Join(cfg.TaskDir().Dir, fmt.Sprintf("%s-executor.out", cfg.Name))
	executorConfig := &executor.ExecutorConfig{
		LogFile:  pluginLogFile,
		LogLevel: "debug",

View on GitHub (pinned to 482b49bf1a)

Solutions

  1. Change the accelerator to "tcg" (software emulation) on Windows/macOS hosts, accepting slower performance
  2. Add a client constraint so the task only schedules onto Linux hosts where KVM is available
  3. Use a hypervisor-appropriate accelerator for the platform (e.g. hvf on macOS via extra QEMU args, if the driver supports passing them)
  4. Verify /dev/kvm exists on the target Linux host (modprobe kvm_intel/kvm_amd) before switching back to kvm

Example fix

// before
config {
  accelerator = "kvm"
}
// after (non-Linux host)
config {
  accelerator = "tcg"
}
Defensive patterns

Strategy: validation

Validate before calling

func validateAccelerator(accel, hostOS string) error {
    if accel == "kvm" && (hostOS == "windows" || hostOS == "darwin") {
        return errors.New("kvm requires linux; use tcg or pin to a linux client")
    }
    return nil
}

Type guard

func kvmSupported() bool { return runtime.GOOS == "linux" }
if cfg.Accelerator == "kvm" && !kvmSupported() { /* reject or downgrade to tcg */ }

Prevention

When it happens

Trigger: StartTask on a Windows or macOS Nomad client with a qemu task config where accelerator = "kvm"; the check runs after accelerator resolution and before appending -enable-kvm.

Common situations: Developers running Nomad dev agents on macOS laptops with job specs written for Linux production; shared job templates that hardcode kvm; Docker-for-Mac/Windows environments where users assume hardware virtualization equals KVM.

Related errors


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