lima-vm/lima · error
sysctl: unimplemented on Windows
Error message
sysctl: unimplemented on Windows
What it means
The Windows build of osutil.Sysctl is a stub that always returns this error, since Windows has no sysctl interface (that's a BSD/macOS kernel API). It exists to keep the cross-platform Sysctl function signature compilable on Windows.
Source
Thrown at pkg/osutil/osutil_windows.go:76
}
func Dup2(_ int, _ syscall.Handle) error {
return errors.New("unimplemented")
}
func SignalName(sig os.Signal) string {
switch sig {
case syscall.SIGINT:
return "SIGINT"
case syscall.SIGTERM:
return "SIGTERM"
default:
return fmt.Sprintf("Signal(%d)", sig)
}
}
func Sysctl(_ context.Context, _ string) (string, error) {
return "", errors.New("sysctl: unimplemented on Windows")
}
func IsEACCES(err error) bool {
return errors.Is(err, syscall.ERROR_ACCESS_DENIED) || errors.Is(err, syscall.WSAEACCES)
}
View on GitHub (pinned to dd909d0973)
Solutions
- Gate sysctl reads behind runtime.GOOS checks and use the Windows registry / GetSystemInfo / WMI equivalents on Windows.
- For kernel version info on Windows use golang.org/x/sys/windows RtlGetVersion instead of Sysctl.
- Handle the error gracefully with a platform-appropriate default value.
Example fix
// before
v, err := osutil.Sysctl(ctx, "kern.osrelease")
// after
if runtime.GOOS == "windows" {
v = windowsKernelVersion() // RtlGetVersion
} else {
v, err = osutil.Sysctl(ctx, "kern.osrelease")
} Defensive patterns
Strategy: fallback
Validate before calling
if runtime.GOOS == "windows" {
// Sysctl always errors here; obtain the value via registry/WMI/RtlGetVersion instead
} Type guard
func sysctlSupported() bool { return runtime.GOOS == "linux" || runtime.GOOS == "darwin" } Try / catch
v, err := osutil.Sysctl(ctx, name)
if err != nil && strings.Contains(err.Error(), "unimplemented on Windows") {
v = windowsEquivalent(name) // registry/WMI fallback
} Prevention
- Gate all Sysctl calls behind runtime.GOOS checks
- Use golang.org/x/sys/windows (RtlGetVersion, registry) for kernel info on Windows
- Return sensible defaults when sysctl is unavailable on a platform
When it happens
Trigger: Any call to osutil.Sysctl(ctx, name) on a Windows build unconditionally returns errors.New("sysctl: unimplemented on Windows") — there is no successful path.
Common situations: Shared code that reads kernel parameters via sysctl (e.g. detecting cgroup limits or kernel versions) running on a Windows host; cross-platform tooling developed on Linux/macOS then run on Windows.
Related errors
- unimplemented
- unimplemented
- unimplemented
- --condition=boot is only supported on macOS
- failed to register instance %#q to start at login: %w
AI-assisted analysis of lima-vm/lima@dd909d0973 (2026-09-01).
Data as JSON: /api/errors/3b2b918bfa8495df.
Report an issue: GitHub.