{"record":{"id":"f6dad91722d421cf","repo":"prometheus/node_exporter","slug":"failed-to-read-desktop-management-interface-dmi","errorCode":null,"errorMessage":"failed to read Desktop Management Interface (DMI) information: %w","messagePattern":"failed to read Desktop Management Interface \\(DMI\\) information: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"collector/dmi.go","lineNumber":51,"sourceCode":"\nfunc init() {\n\tregisterCollector(\"dmi\", defaultEnabled, NewDMICollector)\n}\n\n// NewDMICollector returns a new Collector exposing DMI information.\nfunc NewDMICollector(logger *slog.Logger) (Collector, error) {\n\tfs, err := sysfs.NewFS(*sysPath)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"failed to open sysfs: %w\", err)\n\t}\n\n\tdmi, err := fs.DMIClass()\n\tif err != nil {\n\t\tif errors.Is(err, os.ErrNotExist) {\n\t\t\tlogger.Debug(\"Platform does not support Desktop Management Interface (DMI) information\", \"err\", err)\n\t\t\tdmi = &sysfs.DMIClass{}\n\t\t} else {\n\t\t\treturn nil, fmt.Errorf(\"failed to read Desktop Management Interface (DMI) information: %w\", err)\n\t\t}\n\t}\n\n\tvar labels, values []string\n\tfor label, value := range map[string]*string{\n\t\t\"bios_date\":         dmi.BiosDate,\n\t\t\"bios_release\":      dmi.BiosRelease,\n\t\t\"bios_vendor\":       dmi.BiosVendor,\n\t\t\"bios_version\":      dmi.BiosVersion,\n\t\t\"board_asset_tag\":   dmi.BoardAssetTag,\n\t\t\"board_name\":        dmi.BoardName,\n\t\t\"board_serial\":      dmi.BoardSerial,\n\t\t\"board_vendor\":      dmi.BoardVendor,\n\t\t\"board_version\":     dmi.BoardVersion,\n\t\t\"chassis_asset_tag\": dmi.ChassisAssetTag,\n\t\t\"chassis_serial\":    dmi.ChassisSerial,\n\t\t\"chassis_vendor\":    dmi.ChassisVendor,\n\t\t\"chassis_version\":   dmi.ChassisVersion,","sourceCodeStart":33,"sourceCodeEnd":69,"githubUrl":"https://github.com/prometheus/node_exporter/blob/17ddd77c59ba27e1508e9f7894b1e55b44d6aed3/collector/dmi.go#L33-L69","documentation":"After sysfs opens successfully, NewDMICollector calls fs.DMIClass() to read /sys/class/dmi/id. If that read fails with an error other than os.ErrNotExist, the collector construction is aborted with this wrapped error. ErrNotExist is treated as 'platform has no DMI' and yields an empty collector instead.","triggerScenarios":"fs.DMIClass() returns a non-ErrNotExist error: permission failure reading /sys/class/dmi/id/*, an unexpected glob/filesystem error, or a corrupted/partial sysfs DMI class directory.","commonSituations":"Containers where /sys/class/dmi is masked or the files are permission 000; hardened kernels restricting DMI exposure (dmi_restrict=/sys/kernel/security); chroot environments missing part of the dmi class tree; VM images where DMI entries exist but are unreadable.","solutions":["Check permissions on /sys/class/dmi/id and its files (they are root-readable by default)","Run node_exporter with sufficient privileges or relax DMI file permissions","Inspect the underlying error (%w) to distinguish EACCES from other filesystem errors","If the platform truly has no DMI, verify the error is os.ErrNotExist; if it is not, fix the environment rather than ignoring it"],"exampleFix":null,"handlingStrategy":"validation","validationCode":"if _, err := os.Stat(\"/sys/class/dmi/id\"); err != nil {\n    // DMI class unavailable; expect empty DMI metrics\n}\nfor _, f := range []string{\"bios_date\", \"bios_vendor\", \"product_name\"} {\n    if _, err := os.ReadFile(filepath.Join(\"/sys/class/dmi/id\", f)); err != nil {\n        // check readability/permissions\n    }\n}","typeGuard":null,"tryCatchPattern":"c, err := collector.NewDMICollector(logger)\nif err != nil {\n    logger.Warn(\"DMI collector unavailable\", \"err\", err) // inspect wrapped cause\n}","preventionTips":["Grant read access to /sys/class/dmi/id/* for the exporter user","Check dmi_sysfs_restrictions / security settings when DMI files return EACCES","In containers, decide explicitly whether DMI data is required and mount /sys accordingly"],"tags":["linux","sysfs","dmi","permissions"],"backgroundTag":"file-read-failed","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"}