lima-vm/lima · error

nested virtualization is not supported on %T

Error message

nested virtualization is not supported on %T

What it means

After confirming OS and hardware support, the driver type-asserts the VZ platform configuration to *vz.GenericPlatformConfiguration, the only configuration type that supports SetNestedVirtualizationEnabled. If the platformConfig built earlier is a different VZ configuration type (e.g. a macOS-specific platform config), the assertion fails and this error reports the actual Go type.

Solutions

  1. Enable nested virtualization only for standard Linux guests (generic platform configuration).
  2. Don't combine nestedVirtualization: true with the macOS-installer VM flow.
  3. Check the %T in the message to see which platform config was built and adjust the instance config accordingly.
  4. If you need nested VMs inside macOS guests, that's not supported — use a Linux guest.
Defensive patterns

Strategy: type-guard

Validate before calling

// ensure the workload targets a Linux guest, not the macOS installer flow
# only standard Linux instances use the generic platform config

Type guard

// Go: narrow the platform config type before enabling
generic, ok := platformConfig.(*vz.GenericPlatformConfiguration)
if !ok {
    return fmt.Errorf("nested virtualization is not supported on %T", platformConfig)
}
_ = generic

Try / catch

// Go: match on the concrete type before SetNestedVirtualizationEnabled
switch pc := platformConfig.(type) {
case *vz.GenericPlatformConfiguration:
    _ = pc.SetNestedVirtualizationEnabled(true)
default:
    // skip nested virt for non-generic configs
}

Prevention

When it happens

Trigger: Enabling nestedVirtualization: true while the VM was configured with a non-generic platform configuration — notably when creating a VM via createVMForMacInstaller that uses a macOS platform configuration instead of the generic Linux one.

Common situations: Attempting nested virtualization on a macOS guest installer VM; future/alternative VZ platform configs where nested virt is not implemented in Lima.

Related errors


AI-assisted analysis of lima-vm/lima@dd909d0973 (2026-09-01). Data as JSON: /api/errors/5de55cfe89832ad4. Report an issue: GitHub.

Appendix: source

Thrown at pkg/driver/vz/vm_darwin.go:364

	// nested virt
	if *inst.Config.NestedVirtualization {
		macOSProductVersion, err := osutil.ProductVersion()
		if err != nil {
			return fmt.Errorf("failed to get macOS product version: %w", err)
		}

		if macOSProductVersion.LessThan(*semver.New("15.0.0")) {
			return errors.New("nested virtualization requires macOS 15 or newer")
		}

		if !vz.IsNestedVirtualizationSupported() {
			return errors.New("nested virtualization is not supported on this device")
		}

		genericPlatformConfig, ok := platformConfig.(*vz.GenericPlatformConfiguration)
		if !ok {
			return fmt.Errorf("nested virtualization is not supported on %T", platformConfig)
		}

		if err := genericPlatformConfig.SetNestedVirtualizationEnabled(true); err != nil {
			return fmt.Errorf("cannot enable nested virtualization: %w", err)
		}
	}

	vmConfig.SetPlatformVirtualMachineConfiguration(platformConfig)
	return nil
}

func attachSerialPort(inst *limatype.Instance, config *vz.VirtualMachineConfiguration) error {
	path := filepath.Join(inst.Dir, filenames.SerialVirtioLog)
	serialPortAttachment, err := vz.NewFileSerialPortAttachment(path, false)
	if err != nil {
		return err
	}
	consoleConfig, err := vz.NewVirtioConsoleDeviceSerialPortConfiguration(serialPortAttachment)

View on GitHub (pinned to dd909d0973)