prometheus/node_exporter · error
failed to open procfs
Error message
failed to open procfs: %w
What it means
NewMeminfoCollector builds a procfs filesystem handle from the --path.procfs flag (default /proc) via procfs.NewFS. If procfs cannot be mounted/opened at that path, the collector cannot be constructed and this wrapped error is returned at startup. It almost always means the procfs mount point is missing, not mounted, or the configured path is wrong.
Solutions
- Ensure /proc is mounted in the container/environment (docker run without disabling /proc, or explicitly mount it: -v /proc:/proc:ro)
- Verify the --path.procfs flag points to a mounted procfs directory (check with `ls <path>/meminfo`)
- If running in a restrictive sandbox, run the collector with the privileges/namespace access needed to read /proc
- Disable the meminfo collector (e.g. build with the nomeminfo tag or --collector.meminfo flag off) if /proc is intentionally unavailable
Example fix
// before (container start) docker run --rm my-node-exporter // after docker run --rm -v /proc:/host/proc:ro my-node-exporter --path.procfs=/host/proc
Defensive patterns
Strategy: validation
Validate before calling
const procPath = "/proc"
if info, err := os.Stat(filepath.Join(procPath, "meminfo")); err != nil || info.IsDir() {
log.Fatalf("procfs not available at %s: %v", procPath, err)
} Try / catch
collector, err := NewMeminfoCollector(logger)
if err != nil {
logger.Error("failed to init meminfo collector; is /proc mounted?", "err", err)
return err
} Prevention
- Always mount /proc (read-only) when running in containers
- Explicitly pass --path.procfs when the exporter runs against a host-mounted /proc
- Verify the mount before starting the exporter in minimal images/chroots
When it happens
Trigger: procfs.NewFS(*procPath) returns an error because the directory given by --path.procfs does not exist, is not a directory, is unreadable, or /proc is not mounted — typically in containers without /proc mounted or with a custom --path.procfs value pointing at a nonexistent location.
Common situations: Running node_exporter in a Docker/container runtime where /proc was not bind-mounted; running in a chroot or minimal image lacking /proc; typo in --path.procfs; running inside restricted namespaces (e.g. some CI sandboxes) where procfs is hidden.
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
- failed to open procfs
- failed to open procfs
- failed to open procfs
- failed to open sysfs
- failed to open sysfs
AI-assisted analysis of prometheus/node_exporter@17ddd77c59 (2026-09-07).
Data as JSON: /api/errors/218250c54d3ab185.
Report an issue: GitHub.
Appendix: source
Thrown at collector/meminfo_linux.go:34
package collector
import (
"fmt"
"log/slog"
"github.com/prometheus/procfs"
)
type meminfoCollector struct {
fs procfs.FS
logger *slog.Logger
}
// NewMeminfoCollector returns a new Collector exposing memory stats.
func NewMeminfoCollector(logger *slog.Logger) (Collector, error) {
fs, err := procfs.NewFS(*procPath)
if err != nil {
return nil, fmt.Errorf("failed to open procfs: %w", err)
}
return &meminfoCollector{
logger: logger,
fs: fs,
}, nil
}
func (c *meminfoCollector) getMemInfo() (map[string]float64, error) {
meminfo, err := c.fs.Meminfo()
if err != nil {
return nil, fmt.Errorf("failed to get memory info: %w", err)
}
metrics := make(map[string]float64)
if meminfo.ActiveBytes != nil {
metrics["Active_bytes"] = float64(*meminfo.ActiveBytes)View on GitHub (pinned to 17ddd77c59)