prometheus/node_exporter · critical

failed to open procfs

Error message

failed to open procfs: %w

What it means

The entropy collector's constructor calls procfs.NewFS(*procPath) (default /proc). If the configured path cannot be opened as a procfs filesystem, node_exporter fails to create the collector and reports 'failed to open procfs'. NewFS validates the path exists and looks like procfs, so this is almost always a bad --path.procfs flag or an environment where /proc is missing.

Solutions

  1. Verify the flag: `--path.procfs=/proc` and that the directory exists (`ls /proc`).
  2. Mount proc in the container: run with a proper /proc mount (docker does this by default; check overridden volumes).
  3. If procfs lives elsewhere, point the flag at the actual mount point.
  4. Check mount/permission errors: the wrapped error (%w) names the real cause — read it.

Example fix

// before: bad path
node_exporter --path.procfs=/prco

// after
node_exporter --path.procfs=/proc
Defensive patterns

Strategy: validation

Validate before calling

const fs = require('fs');
function procfsLooksValid(p = '/proc') {
  return fs.existsSync(p) && fs.statSync(p).isDirectory() &&
    fs.existsSync(`${p}/self`) && fs.existsSync(`${p}/sys/kernel/random`);
}
if (!procfsLooksValid()) console.error('--path.procfs target invalid; entropy collector will fail to start');

Try / catch

try {
  await startNodeExporter({ procPath: '/proc' });
} catch (e) {
  if (String(e).includes('failed to open procfs')) {
    console.error('Bad --path.procfs; verify the mount and flag value');
  } else throw e;
}

Prevention

When it happens

Trigger: NewEntropyCollector with --path.procfs pointing at a nonexistent or non-procfs directory; running in a container without /proc mounted.

Common situations: Typo in --path.procfs; containers/chroots lacking /proc; running the binary in an environment where procfs is mounted elsewhere; SELinux restricting access.

Understand the failure class

Background: "Invalid value" and "allowed values are" config errors: what your library rejected and how to fix it — this error's family across 41 libraries.

Related errors


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

Appendix: source

Thrown at collector/entropy_linux.go:52

var (
	entropyAvail = prometheus.NewDesc(
		prometheus.BuildFQName(namespace, "", "entropy_available_bits"),
		"Bits of available entropy.",
		nil, nil,
	)
	entropyPoolSize = prometheus.NewDesc(
		prometheus.BuildFQName(namespace, "", "entropy_pool_size_bits"),
		"Bits of entropy pool.",
		nil, nil,
	)
)

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

	return &entropyCollector{
		fs:     fs,
		logger: logger,
	}, nil
}

func (c *entropyCollector) Update(ch chan<- prometheus.Metric) error {
	stats, err := c.fs.KernelRandom()
	if err != nil {
		return fmt.Errorf("failed to get kernel random stats: %w", err)
	}

	if stats.EntropyAvaliable == nil {
		return fmt.Errorf("couldn't get entropy_avail")
	}
	ch <- prometheus.MustNewConstMetric(

View on GitHub (pinned to 17ddd77c59)