OpenNHP/opennhp · error
eBPF functionality is only supported on Linux, current…
Error message
eBPF functionality is only supported on Linux, current platform is not Linux
What it means
ErrEBPFSupportedOnlyOnLinux is a sentinel error declared in the build-tagged file ebpf_other.go (//go:build !linux). On any non-Linux platform, EbpfEngineLoad and getBootTimeNanos return this error because the eBPF implementation only compiles/works on Linux. It is a deliberate platform guard, not a runtime fault.
Solutions
- Run the component on Linux (the only supported platform for eBPF features)
- Guard eBPF startup with runtime.GOOS check and skip/disable the feature gracefully
- Use a Linux VM/container for local development
- If the error appears on Linux, verify build tags didn't pick ebpf_other.go (wrong GOOS at build time)
Example fix
// before
if err := ebpf.EbpfEngineLoad(dir, logLevel, acId); err != nil { log.Fatal(err) }
// after
if err := ebpf.EbpfEngineLoad(dir, logLevel, acId); err != nil {
if errors.Is(err, ebpf.ErrEBPFSupportedOnlyOnLinux) {
log.Warn("eBPF disabled: unsupported platform")
return nil
}
return err
} Defensive patterns
Strategy: fallback
Validate before calling
if runtime.GOOS != "linux" { return ebpf.ErrEBPFSupportedOnlyOnLinux } // guard before loading Type guard
func ebpfSupported() bool { return runtime.GOOS == "linux" } Try / catch
if err := EbpfEngineLoad(dir, lvl, id); err != nil { if errors.Is(err, ErrEBPFSupportedOnlyOnLinux) { disableEbpfGracefully(); return nil }; return err } Prevention
- Gate eBPF init behind runtime.GOOS == "linux"
- Treat ErrEBPFSupportedOnlyOnLinux as a feature-disable signal, not a crash
- Use errors.Is against the sentinel rather than string matching
- Build/test on Linux CI for eBPF paths
When it happens
Trigger: Calling EbpfEngineLoad(dirPath, logLevel, acId) or getBootTimeNanos on macOS/Windows (or any GOOS != linux) build; importing the endpoints/ac/ebpf package and starting eBPF-based access control on a dev laptop.
Common situations: Developers running nhp-ac locally on macOS for debugging; CI on non-Linux runners; forgetting that ebpf features are silently stubbed out via build tags.
Understand the failure class
Background: "unsupported platform" / "not supported on this platform" errors: what they mean and how to fix them — this error's family across 47 libraries.
Related errors
- eBPF functionality is only supported on Linux, current…
- failed to parse default route
- clock_gettime failed
- Failed to get the system running time:
- 'events' map not found
AI-assisted analysis of OpenNHP/opennhp@6e04ca5ff0 (2026-09-07).
Data as JSON: /api/errors/9b1251eeec70beb2.
Report an issue: GitHub.
Appendix: source
Thrown at nhp/utils/ebpf/ebpf_other.go:7
//go:build !linux
package ebpf
import "fmt"
var ErrEBPFSupportedOnlyOnLinux = fmt.Errorf("eBPF functionality is only supported on Linux, current platform is not Linux")
func getBootTimeNanos() (uint64, error) {
ttlSec := 1222222222222
return uint64(ttlSec), ErrEBPFSupportedOnlyOnLinux
}
View on GitHub (pinned to 6e04ca5ff0)