{"record":{"id":"db695a3aaafc6c7c","repo":"prometheus/node_exporter","slug":"failed-to-open-procfs-w-db695a","errorCode":null,"errorMessage":"failed to open procfs: %w","messagePattern":"failed to open procfs: %w","errorType":"error_code","errorClass":null,"httpStatus":null,"severity":"error","filePath":"collector/time_linux.go","lineNumber":29,"sourceCode":"// See the License for the specific language governing permissions and\n// limitations under the License.\n\n//go:build !notime\n\npackage collector\n\nimport (\n\t\"fmt\"\n\t\"strconv\"\n\n\t\"github.com/prometheus/client_golang/prometheus\"\n\t\"github.com/prometheus/procfs/sysfs\"\n)\n\nfunc (c *timeCollector) update(ch chan<- prometheus.Metric) error {\n\tfs, err := sysfs.NewFS(*sysPath)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"failed to open procfs: %w\", err)\n\t}\n\n\tclocksources, err := fs.ClockSources()\n\tif err != nil {\n\t\treturn fmt.Errorf(\"couldn't get clocksources: %w\", err)\n\t}\n\tc.logger.Debug(\"in Update\", \"clocksources\", fmt.Sprintf(\"%v\", clocksources))\n\n\tfor i, clocksource := range clocksources {\n\t\tis := strconv.Itoa(i)\n\t\tfor _, cs := range clocksource.Available {\n\t\t\tch <- c.clocksourcesAvailable.mustNewConstMetric(1.0, is, cs)\n\t\t}\n\t\tch <- c.clocksourceCurrent.mustNewConstMetric(1.0, is, clocksource.Current)\n\t}\n\treturn nil\n}\n","sourceCodeStart":11,"sourceCodeEnd":47,"githubUrl":"https://github.com/prometheus/node_exporter/blob/17ddd77c59ba27e1508e9f7894b1e55b44d6aed3/collector/time_linux.go#L11-L47","documentation":"The Linux time collector's update() opens the sysfs filesystem via sysfs.NewFS(*sysPath) on every scrape and wraps any open failure as 'failed to open procfs: %w' (the message says procfs but the code opens sysfs — a historical misnomer). Failure means the configured sys path does not exist or is unreadable, so no clocksource/clockevent metrics can be produced.","triggerScenarios":"timeCollector.update (invoked from Update each scrape) when sysfs.NewFS(*sysPath) errors because --path.sysfs points to a missing path or a file rather than a directory.","commonSituations":"Containers without /sys mounted, wrong --path.sysfs value, or bind-mounting /sys read-only with restricted permissions that block directory traversal.","solutions":["Point --path.sysfs at a valid sysfs directory (typically /sys).","Mount /sys inside the container running node_exporter.","Check filesystem permissions allow the exporter user to traverse the path.","Ignore the misleading 'procfs' wording — the actual path to fix is the sysfs one."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"if fi, err := os.Stat(sysfsPath); err != nil || !fi.IsDir() {\n    // skip enabling the time collector\n}","typeGuard":null,"tryCatchPattern":"if err := c.Update(ch); err != nil {\n    if errors.Is(err, ErrNoData) { return }\n    logger.Error(\"time scrape failed\", \"err\", err)\n}","preventionTips":["Remember this error text says 'procfs' but the fix is the sysfs path (--path.sysfs).","Ensure /sys is mounted read-only but present in containers.","Pre-verify sysfs reachability in deployment health checks.","Keep exporter users able to traverse /sys directories."],"tags":["linux","sysfs","time","filesystem"],"backgroundTag":"file-not-found","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"}