{"record":{"id":"d515f27f63f991db","repo":"hashicorp/nomad","slug":"kvm-accelerator-is-unsupported-on-the-current-plat","errorCode":null,"errorMessage":"KVM accelerator is unsupported on the current platform","messagePattern":"KVM accelerator is unsupported on the current platform","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"drivers/qemu/driver.go","lineNumber":623,"sourceCode":"\n\t\t\tfor _, p := range protocols {\n\t\t\t\tnetdevArgs = append(netdevArgs, fmt.Sprintf(\"hostfwd=%s::%d-:%d\", p, host, guest))\n\t\t\t}\n\t\t}\n\n\t\tif len(netdevArgs) != 0 {\n\t\t\targs = append(args,\n\t\t\t\t\"-netdev\",\n\t\t\t\tfmt.Sprintf(\"user,id=user.0,%s\", strings.Join(netdevArgs, \",\")),\n\t\t\t\t\"-device\", \"virtio-net,netdev=user.0\",\n\t\t\t)\n\t\t}\n\t}\n\n\t// If using KVM, add optimization args\n\tif accelerator == \"kvm\" {\n\t\tif runtime.GOOS == \"windows\" || runtime.GOOS == \"darwin\" {\n\t\t\treturn nil, nil, errors.New(\"KVM accelerator is unsupported on the current platform\")\n\t\t}\n\n\t\targs = append(args, \"-enable-kvm\")\n\n\t\t// If the user has not set the -smp flag, default to resources.cores\n\t\tif !slices.Contains(args, \"-smp\") && cfg.Resources.LinuxResources != nil && cfg.Resources.LinuxResources.CpusetCpus != \"\" {\n\t\t\tcores := strings.Split(cfg.Resources.LinuxResources.CpusetCpus, \",\")\n\t\t\targs = append(args,\n\t\t\t\t\"-smp\", fmt.Sprintf(\"%d\", len(cores)),\n\t\t\t)\n\t\t}\n\t}\n\td.logger.Debug(\"starting QEMU VM command \", \"args\", strings.Join(args, \" \"))\n\n\tpluginLogFile := filepath.Join(cfg.TaskDir().Dir, fmt.Sprintf(\"%s-executor.out\", cfg.Name))\n\texecutorConfig := &executor.ExecutorConfig{\n\t\tLogFile:  pluginLogFile,\n\t\tLogLevel: \"debug\",","sourceCodeStart":605,"sourceCodeEnd":641,"githubUrl":"https://github.com/hashicorp/nomad/blob/482b49bf1aec006f089bcfc7e632d8f6ac303e5e/drivers/qemu/driver.go#L605-L641","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Change the accelerator to \"tcg\" (software emulation) on Windows/macOS hosts, accepting slower performance","Add a client constraint so the task only schedules onto Linux hosts where KVM is available","Use a hypervisor-appropriate accelerator for the platform (e.g. hvf on macOS via extra QEMU args, if the driver supports passing them)","Verify /dev/kvm exists on the target Linux host (modprobe kvm_intel/kvm_amd) before switching back to kvm"],"exampleFix":"// before\nconfig {\n  accelerator = \"kvm\"\n}\n// after (non-Linux host)\nconfig {\n  accelerator = \"tcg\"\n}","handlingStrategy":"validation","validationCode":"func validateAccelerator(accel, hostOS string) error {\n    if accel == \"kvm\" && (hostOS == \"windows\" || hostOS == \"darwin\") {\n        return errors.New(\"kvm requires linux; use tcg or pin to a linux client\")\n    }\n    return nil\n}","typeGuard":"func kvmSupported() bool { return runtime.GOOS == \"linux\" }\nif cfg.Accelerator == \"kvm\" && !kvmSupported() { /* reject or downgrade to tcg */ }","tryCatchPattern":null,"preventionTips":["Parameterize accelerator via job template variables per client OS","Constraint tasks using kvm to hosts with /dev/kvm present","Document kvm as linux-only in internal job-spec guidelines"],"tags":["qemu","kvm","windows","macos","virtualization"],"backgroundTag":"unsupported-platform-feature","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"}