{"record":{"id":"5fd643e2e0fd7c73","repo":"cloudflare/cloudflared","slug":"rc-service-s-start-w","errorCode":null,"errorMessage":"rc-service %s start: %w","messagePattern":"rc-service (.+?) start: %w","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cmd/cloudflared/linux_service.go","lineNumber":437,"sourceCode":"func installOpenRC(templateArgs *ServiceTemplateArgs, autoUpdate bool) error {\n\tif autoUpdate {\n\t\ttemplateArgs.ExtraArgs = append([]string{\"--autoupdate-freq\", \"24h0m0s\"}, templateArgs.ExtraArgs...)\n\t} else {\n\t\ttemplateArgs.ExtraArgs = append([]string{\"--no-autoupdate\"}, templateArgs.ExtraArgs...)\n\t}\n\n\tif err := openrcConfTemplate.Generate(templateArgs); err != nil {\n\t\treturn fmt.Errorf(\"error generating OpenRC conf.d template: %w\", err)\n\t}\n\tif err := openrcTemplate.Generate(templateArgs); err != nil {\n\t\treturn fmt.Errorf(\"error generating OpenRC service template: %w\", err)\n\t}\n\n\tif err := runCommand(\"rc-update\", \"add\", cloudflaredOpenRCService, \"default\"); err != nil {\n\t\treturn fmt.Errorf(\"rc-update add %s default: %w\", cloudflaredOpenRCService, err)\n\t}\n\tif err := runCommand(\"rc-service\", cloudflaredOpenRCService, \"start\"); err != nil {\n\t\treturn fmt.Errorf(\"rc-service %s start: %w\", cloudflaredOpenRCService, err)\n\t}\n\treturn nil\n}\n\nfunc uninstallLinuxService(c *cli.Context) error {\n\tlog := logger.CreateLoggerFromContext(c, logger.EnableTerminalLog)\n\n\tvar err error\n\tswitch {\n\tcase inits.IsSystemd():\n\t\tlog.Info().Msg(\"Using Systemd\")\n\t\terr = uninstallSystemd(log)\n\tcase inits.IsOpenRC():\n\t\tlog.Info().Msg(\"Using OpenRC\")\n\t\terr = uninstallOpenRC(log)\n\tdefault:\n\t\tlog.Info().Msg(\"Using SysV\")\n\t\terr = uninstallSysv(log)","sourceCodeStart":419,"sourceCodeEnd":455,"githubUrl":"https://github.com/cloudflare/cloudflared/blob/2253eeeb25a44a713a4b60b8ba1e1b3f377d1a0f/cmd/cloudflared/linux_service.go#L419-L455","documentation":"This error wraps a failure from `rc-service cloudflared start` immediately after the OpenRC service is registered in the default runlevel. rc-service starts the service through OpenRC's init script; a non-zero exit means the service failed to launch. The wrapped error carries rc-service's output so the underlying cause (bad config, script failure) is visible.","triggerScenarios":"During `cloudflared service install` on OpenRC systems, when runCommand(\"rc-service\", cloudflaredOpenRCService, \"start\") exits non-zero — e.g. invalid tunnel credentials in the config file, the init script exits with an error, or OpenRC itself is not functional.","commonSituations":"Missing or invalid /etc/cloudflared/config.yml (no tunnel token/credentials); cloudflared binary failing at startup due to bad flags baked into the init script; stale pidfile from a previous run; OpenRC reporting 'service started but not running' due to a crash on launch.","solutions":["Start the service manually to see the error: `sudo rc-service cloudflared start` and read its output, or check /var/log/rc.log","Validate /etc/cloudflared/config.yml (or the token used at install time) — a common cause is invalid or missing tunnel credentials","Test the binary directly with the same args as the init script to reproduce the failure outside OpenRC","Remove stale state (pidfiles in /run) and retry: `sudo rc-service cloudflared zap` then start again","If the service is not needed at boot, skip install and run cloudflared directly (e.g. in a tmux session or container)"],"exampleFix":"// before: install fails at the start step due to bad config\n$ sudo cloudflared service install\n// error: rc-service cloudflared start: exit status 1\n// after: verify config first, then install\n$ sudo cloudflared tunnel --config /etc/cloudflared/config.yml run  # confirm it runs\n$ sudo cloudflared service install","handlingStrategy":"try-catch","validationCode":"// validate the service can start before installing\nfunc validateCloudflaredConfig() error {\n    if _, err := os.Stat(\"/etc/cloudflared/config.yml\"); err != nil {\n        return fmt.Errorf(\"config missing, rc-service start will fail: %w\", err)\n    }\n    return nil\n}","typeGuard":"func canStartService() bool {\n    if _, err := exec.LookPath(\"rc-service\"); err != nil { return false }\n    if _, err := os.Stat(\"/etc/init.d/cloudflared\"); err != nil { return false }\n    return true\n}","tryCatchPattern":"if err := installLinuxService(c); err != nil {\n    if strings.Contains(err.Error(), \"rc-service\") {\n        log.Warn(\"service registered but failed to start; inspect with: sudo rc-service cloudflared start; check /etc/cloudflared/config.yml and /var/log/rc.log\")\n    }\n    return err\n}","preventionTips":["Validate /etc/cloudflared/config.yml (or tunnel token) before installing the service","Test-run the binary with the same arguments the init script uses before installing","Clear stale pidfiles (/run/cloudflared*) after abnormal exits","Read the wrapped rc-service output — OpenRC logs the real startup failure"],"tags":["linux","openrc","service-start","command-failed"],"backgroundTag":"service-start-failed","analyzedSha":"2253eeeb25a44a713a4b60b8ba1e1b3f377d1a0f","analyzedAt":"2026-09-06T04:14:33.757Z","contentChangedAt":"2026-09-06T04:14:33.757Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}