prometheus/node_exporter · error
failed to read Desktop Management Interface (DMI)…
Error message
failed to read Desktop Management Interface (DMI) information: %w
What it means
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.
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
Defensive patterns
Strategy: validation
Validate before calling
if _, err := os.Stat("/sys/class/dmi/id"); err != nil {
// DMI class unavailable; expect empty DMI metrics
}
for _, f := range []string{"bios_date", "bios_vendor", "product_name"} {
if _, err := os.ReadFile(filepath.Join("/sys/class/dmi/id", f)); err != nil {
// check readability/permissions
}
} Try / catch
c, err := collector.NewDMICollector(logger)
if err != nil {
logger.Warn("DMI collector unavailable", "err", err) // inspect wrapped cause
} Prevention
- 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
When it happens
Trigger: 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.
Common situations: 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.
Understand the failure class
Background: "failed to read file", EACCES, ENOENT and "could not read <path>" errors: when a program can't read a file from disk — this error's family across 49 libraries.
Related errors
- failed to open sysfs
- Could not derive a human-readable chip type for
- failed to open sysfs
- failed to retrieve bcache stats
- failed to open sysfs
AI-assisted analysis of prometheus/node_exporter@17ddd77c59 (2026-09-07).
Data as JSON: /api/errors/f6dad91722d421cf.
Report an issue: GitHub.
Appendix: source
Thrown at collector/dmi.go:51
func init() {
registerCollector("dmi", defaultEnabled, NewDMICollector)
}
// NewDMICollector returns a new Collector exposing DMI information.
func NewDMICollector(logger *slog.Logger) (Collector, error) {
fs, err := sysfs.NewFS(*sysPath)
if err != nil {
return nil, fmt.Errorf("failed to open sysfs: %w", err)
}
dmi, err := fs.DMIClass()
if err != nil {
if errors.Is(err, os.ErrNotExist) {
logger.Debug("Platform does not support Desktop Management Interface (DMI) information", "err", err)
dmi = &sysfs.DMIClass{}
} else {
return nil, fmt.Errorf("failed to read Desktop Management Interface (DMI) information: %w", err)
}
}
var labels, values []string
for label, value := range map[string]*string{
"bios_date": dmi.BiosDate,
"bios_release": dmi.BiosRelease,
"bios_vendor": dmi.BiosVendor,
"bios_version": dmi.BiosVersion,
"board_asset_tag": dmi.BoardAssetTag,
"board_name": dmi.BoardName,
"board_serial": dmi.BoardSerial,
"board_vendor": dmi.BoardVendor,
"board_version": dmi.BoardVersion,
"chassis_asset_tag": dmi.ChassisAssetTag,
"chassis_serial": dmi.ChassisSerial,
"chassis_vendor": dmi.ChassisVendor,
"chassis_version": dmi.ChassisVersion,View on GitHub (pinned to 17ddd77c59)