{"record":{"id":"143aebc4d38db9ed","repo":"prometheus/node_exporter","slug":"sysctl-ctl-vm-vm-uvmexp-failed-w","errorCode":null,"errorMessage":"sysctl CTL_VM VM_UVMEXP failed: %w","messagePattern":"sysctl CTL_VM VM_UVMEXP failed: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"collector/meminfo_openbsd.go","lineNumber":72,"sourceCode":"import \"C\"\n\ntype meminfoCollector struct {\n\tlogger *slog.Logger\n}\n\n// NewMeminfoCollector returns a new Collector exposing memory stats.\nfunc NewMeminfoCollector(logger *slog.Logger) (Collector, error) {\n\treturn &meminfoCollector{\n\t\tlogger: logger,\n\t}, nil\n}\n\nfunc (c *meminfoCollector) getMemInfo() (map[string]float64, error) {\n\tvar uvmexp C.struct_uvmexp\n\tvar bcstats C.struct_bcachestats\n\n\tif _, err := C.sysctl_uvmexp(&uvmexp); err != nil {\n\t\treturn nil, fmt.Errorf(\"sysctl CTL_VM VM_UVMEXP failed: %w\", err)\n\t}\n\n\tif _, err := C.sysctl_bcstats(&bcstats); err != nil {\n\t\treturn nil, fmt.Errorf(\"sysctl CTL_VFS VFS_GENERIC VFS_BCACHESTAT failed: %w\", err)\n\t}\n\n\tps := float64(uvmexp.pagesize)\n\n\t// see uvm(9)\n\treturn map[string]float64{\n\t\t\"active_bytes\":                  ps * float64(uvmexp.active),\n\t\t\"cache_bytes\":                   ps * float64(bcstats.numbufpages),\n\t\t\"free_bytes\":                    ps * float64(uvmexp.free),\n\t\t\"inactive_bytes\":                ps * float64(uvmexp.inactive),\n\t\t\"size_bytes\":                    ps * float64(uvmexp.npages),\n\t\t\"swap_size_bytes\":               ps * float64(uvmexp.swpages),\n\t\t\"swap_used_bytes\":               ps * float64(uvmexp.swpginuse),\n\t\t\"swapped_in_pages_bytes_total\":  ps * float64(uvmexp.pgswapin),","sourceCodeStart":54,"sourceCodeEnd":90,"githubUrl":"https://github.com/prometheus/node_exporter/blob/17ddd77c59ba27e1508e9f7894b1e55b44d6aed3/collector/meminfo_openbsd.go#L54-L90","documentation":"This error is returned by getMemInfo in collector/meminfo_openbsd.go:72 when the CGO helper C.sysctl_uvmexp fails to fetch the VM_UVMEXP sysctl (CTL_VM / VM_UVMEXP) on OpenBSD. Without uvm.exp stats the meminfo collector cannot produce memory metrics, so the collection errors out. The underlying errno is wrapped via %w.","triggerScenarios":"getMemInfo calls C.sysctl_uvmexp(&uvmexp) and the sysctl call returns non-zero — e.g. running on an OpenBSD version where VM_UVMEXP is unavailable, a restricted environment (pledge/unveil or sandbox) blocking sysctl, or a syscall failure in the C shim.","commonSituations":"Running node_exporter on an OpenBSD release whose kernel removed or renumbered VM_UVMEXP; running under strict pledge() restrictions; compiled binaries mismatched with the running kernel; chroot environments missing sysctl access.","solutions":["Check the OpenBSD kernel version supports CTL_VM/VM_UVMEXP (sysctl vm.uvmexp works in shell)","Run node_exporter without restrictive pledge/sandbox settings that block sysctl(2)","Rebuild node_exporter on/for the exact OpenBSD release so the C shim's sysctl mib matches","Disable the meminfo collector (-collector.meminfo or build tags) if the platform can't provide uvmexp","Verify with `sysctl -n vm.uvmexp` that the sysctl is readable by the exporter's user"],"exampleFix":"// before\nif _, err := C.sysctl_uvmexp(&uvmexp); err != nil {\n\treturn nil, fmt.Errorf(\"sysctl CTL_VM VM_UVMEXP failed: %w\", err)\n}\n// after (skip sysctl-dependent metrics instead of failing collection)\nif _, err := C.sysctl_uvmexp(&uvmexp); err != nil {\n\treturn map[string]float64{}, fmt.Errorf(\"sysctl CTL_VM VM_UVMEXP failed: %w\", err)\n}","handlingStrategy":"try-catch","validationCode":"// Check sysctl availability before relying on meminfo metrics\n// $ sysctl -n vm.uvmexp || echo \"VM_UVMEXP unavailable\"","typeGuard":null,"tryCatchPattern":"metrics, err := c.getMemInfo()\nif err != nil {\n\tif strings.Contains(err.Error(), \"VM_UVMEXP failed\") {\n\t\t// log warning, expose no meminfo metrics rather than failing the scrape\n\t\treturn nil\n\t}\n\treturn err\n}","preventionTips":["Confirm `sysctl vm.uvmexp` is readable in your OpenBSD environment before enabling meminfo","Avoid pledge/sandbox profiles that block sysctl(2) for the exporter process","Rebuild node_exporter per OpenBSD release so CGO sysctl shims match kernel mibs","Run node_exporter as a user with access to kernel sysctls (not a chroot without them)"],"tags":["openbsd","sysctl","meminfo","cgo"],"backgroundTag":"unsupported-operation","analyzedSha":"17ddd77c59ba27e1508e9f7894b1e55b44d6aed3","analyzedAt":"2026-09-07T17:54:06.211Z","contentChangedAt":"2026-09-07T17:54:06.211Z","schemaVersion":2},"datasetVersion":"2026-09-16T04:17:20.429Z"}