{"record":{"id":"d792e1776059e13c","repo":"cilium/cilium","slug":"get-mtime-w","errorCode":null,"errorMessage":"get mtime: %w","messagePattern":"get mtime: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/datapath/agentliveness/agent_liveness.go","lineNumber":54,"sourceCode":"\nfunc (alc agentLivenessConfig) Flags(flags *pflag.FlagSet) {\n\tflags.Duration(\"agent-liveness-update-interval\", alc.AgentLivenessUpdateInterval,\n\t\t\"Interval at which the agent updates liveness time for the datapath\")\n}\n\nfunc newAgentLivenessUpdater(\n\tjobRegistry job.Registry,\n\thealth cell.Health,\n\tconfigMap configmap.Map,\n\tagentLivenessConfig agentLivenessConfig,\n) {\n\t// Discard even debug logs since this particular job is very noisy\n\tlog := slog.New(slog.DiscardHandler)\n\tgroup := jobRegistry.NewGroup(health, job.WithLogger(log))\n\tgroup.Add(job.Timer(\"agent-liveness-updater\", func(_ context.Context) error {\n\t\tmtime, err := bpf.GetMtime()\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"get mtime: %w\", err)\n\t\t}\n\n\t\terr = configMap.Update(configmap.AgentLiveness, mtime)\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"update config map: %w\", err)\n\t\t}\n\n\t\treturn nil\n\t}, agentLivenessConfig.AgentLivenessUpdateInterval))\n\n}\n","sourceCodeStart":36,"sourceCodeEnd":66,"githubUrl":"https://github.com/cilium/cilium/blob/ac7b90affa4baf0642e6685319d56907b3a73a6d/pkg/datapath/agentliveness/agent_liveness.go#L36-L66","documentation":"This error wraps a failure from bpf.GetMtime() inside the Cilium agent-liveness updater background job. The agent periodically reads the BPF host routing 'mtime' (a kernel-side timestamp marker) and publishes it into a config map so other components can detect agent liveness. If reading that mtime fails (e.g. the BPF map or filesystem backing it is unavailable), the job returns this wrapped error so the job framework can log/retry it. Because the job uses a discard logger, the error is intentionally quiet unless surfaced by the job registry health reporting.","triggerScenarios":"The periodic timer fires and bpf.GetMtime() returns an error — typically when the BPF filesystem (bpffs) is not mounted, the liveness state file/map is missing or has wrong permissions, or the underlying syscall (stat/read of the mtime pin) fails.","commonSituations":"Running Cilium on nodes where /sys/fs/bpf is not mounted or was cleaned up; containers lacking the BPF capabilities (CAP_BPF/CAP_SYS_ADMIN); a corrupted or manually deleted bpffs pin directory after node restarts.","solutions":["Verify the BPF filesystem is mounted: run `mount | grep bpf` and mount bpffs at /sys/fs/bpf if missing.","Check the agent container has CAP_BPF/CAP_SYS_ADMIN and access to /sys/fs/bpf.","Inspect the wrapped inner error in the message ('get mtime: <err>') for the exact syscall failure and fix that root cause.","Restart the Cilium agent to re-initialize the liveness state; check health via the job registry health cell."],"exampleFix":"// before: job fails silently because logs are discarded\nlog := slog.New(slog.DiscardHandler)\n// after: use a real logger (or configure it for debugging) so the wrapped error is visible\nlog := slog.New(slog.NewTextHandler(os.Stderr, &slog.HandlerOptions{Level: slog.LevelDebug}))","handlingStrategy":"try-catch","validationCode":"// Pre-flight check before relying on the liveness updater:\nif _, err := os.Stat(\"/sys/fs/bpf\"); err != nil {\n    return fmt.Errorf(\"bpffs not mounted: %w\", err)\n}","typeGuard":null,"tryCatchPattern":"mtime, err := bpf.GetMtime()\nif err != nil {\n    return fmt.Errorf(\"get mtime: %w\", err) // inspect wrapped cause\n}","preventionTips":["Ensure /sys/fs/bpf is mounted on every node (DaemonSet init container or systemd mount).","Grant the agent CAP_BPF/CAP_SYS_ADMIN.","Monitor the job registry health for the agent-liveness-updater job.","Avoid deleting bpffs pin paths while the agent runs."],"tags":["datapath","bpf","liveness","filesystem"],"backgroundTag":"bpffs-mount-missing","analyzedSha":"ac7b90affa4baf0642e6685319d56907b3a73a6d","analyzedAt":"2026-08-31T18:27:15.868Z","schemaVersion":2},"datasetVersion":"2026-08-31T19:17:28.585Z"}