prometheus/node_exporter · error

failed to open procfs

Error message

failed to open procfs: %w

What it means

NewBuddyinfoCollector wraps errors from procfs.NewFS(*procPath) in "failed to open procfs". The /proc filesystem handle could not be created, so the buddyinfo collector cannot be constructed. This typically indicates /proc is missing, not mounted, or the --path.procfs override is invalid.

Solutions

  1. Verify /proc is mounted (mount | grep proc) and readable by the exporter
  2. Correct the --path.procfs flag if a custom path was supplied
  3. Disable the buddyinfo collector (--no-collector.buddyinfo) in environments without procfs
  4. Check LSM denials if /proc access is blocked by security policy

Example fix

// before
 c, err := NewNodeCollector(logger, "buddyinfo") // fails when /proc missing
// after
 if _, err := os.Stat(*procPath); err != nil {
	logger.Warn("procfs unavailable; skipping buddyinfo collector")
	return nil
 }
 c, err = NewNodeCollector(logger, "buddyinfo")
Defensive patterns

Strategy: fallback

Validate before calling

if fi, err := os.Stat(*procPath); err != nil || !fi.IsDir() { /* skip buddyinfo collector */ }

Type guard

func procfsAvailable(path string) bool { fi, err := os.Stat(path); return err == nil && fi.IsDir() }

Try / catch

c, err := collector.NewNodeCollector(logger)
if err != nil {
	logger.Warn("buddyinfo collector unavailable", "err", err)
	c = nil
}

Prevention

When it happens

Trigger: Enabling the buddyinfo collector on a system without /proc mounted, a wrong --path.procfs value, insufficient permissions to stat/access /proc, or in containers/chroots where procfs is not mounted.

Common situations: Minimal Docker images or sandboxes without procfs; node_exporter running with a custom --path.procfs for testing that points at a nonexistent directory; non-Linux platforms where procfs semantics don't apply.

Understand the failure class

Background: "open() failed", "failed to open file", "cannot create file" — what a file open error means and how to fix it — this error's family across 42 libraries.

Related errors


AI-assisted analysis of prometheus/node_exporter@17ddd77c59 (2026-09-07). Data as JSON: /api/errors/ea22593b86e39362. Report an issue: GitHub.

Appendix: source

Thrown at collector/buddyinfo.go:52

}

func init() {
	registerCollector("buddyinfo", defaultDisabled, NewBuddyinfoCollector)
}

var (
	buddyinfoBlocks = prometheus.NewDesc(
		prometheus.BuildFQName(namespace, buddyInfoSubsystem, "blocks"),
		"Count of free blocks according to size.",
		[]string{"node", "zone", "size"}, nil,
	)
)

// NewBuddyinfoCollector returns a new Collector exposing buddyinfo stats.
func NewBuddyinfoCollector(logger *slog.Logger) (Collector, error) {
	fs, err := procfs.NewFS(*procPath)
	if err != nil {
		return nil, fmt.Errorf("failed to open procfs: %w", err)
	}
	return &buddyinfoCollector{fs, logger}, nil
}

// Update calls (*buddyinfoCollector).getBuddyInfo to get the platform specific
// buddyinfo metrics.
func (c *buddyinfoCollector) Update(ch chan<- prometheus.Metric) error {
	buddyInfo, err := c.fs.BuddyInfo()
	if err != nil {
		return fmt.Errorf("couldn't get buddyinfo: %w", err)
	}

	c.logger.Debug("Set node_buddy", "buddyInfo", buddyInfo)
	for _, entry := range buddyInfo {
		for size, value := range entry.Sizes {
			ch <- prometheus.MustNewConstMetric(
				buddyinfoBlocks,
				prometheus.GaugeValue, value,

View on GitHub (pinned to 17ddd77c59)