{"record":{"id":"a2583db135968973","repo":"AdguardTeam/AdGuardHome","slug":"starting-service-w","errorCode":null,"errorMessage":"starting service: %w","messagePattern":"starting service: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"critical","filePath":"internal/home/service.go","lineNumber":342,"sourceCode":"\tl.DebugContext(ctx, \"using\", \"args\", args)\n\n\terr = mgr.Perform(ctx, &ossvc.ActionInstall{\n\t\tServiceName:      serviceName,\n\t\tDisplayName:      serviceDisplayName,\n\t\tDescription:      serviceDescription,\n\t\tWorkingDirectory: pwd,\n\t\tVersion:          version.Full(),\n\t\tArguments:        args,\n\t})\n\tif err != nil {\n\t\treturn fmt.Errorf(\"installing service: %w\", err)\n\t}\n\n\terr = mgr.Perform(ctx, &ossvc.ActionStart{\n\t\tServiceName: serviceName,\n\t})\n\tif err != nil {\n\t\treturn fmt.Errorf(\"starting service: %w\", err)\n\t}\n\n\tif detectFirstRun(ctx, l, workDir, confPath) {\n\t\tslogutil.PrintLines(ctx, l, slog.LevelInfo, \"\", \"Almost ready!\\n\"+\n\t\t\t\"AdGuard Home is successfully installed and will automatically start on boot.\\n\"+\n\t\t\t\"There are a few more things that must be configured before you can use it.\\n\"+\n\t\t\t\"Click on the link below and follow the Installation Wizard steps to finish setup.\\n\"+\n\t\t\t\"AdGuard Home is now available at the following addresses:\")\n\t\tprintHTTPAddresses(ctx, l)\n\t}\n\n\treturn nil\n}\n","sourceCodeStart":324,"sourceCodeEnd":356,"githubUrl":"https://github.com/AdguardTeam/AdGuardHome/blob/b41aefbe51c8dde65e2c50f093996afa0502edf9/internal/home/service.go#L324-L356","documentation":"Immediately after installing the service, the code sends an ActionStart to the service manager and that start operation failed. The service was registered but could not be launched, commonly because the binary, working directory, or arguments recorded in the service definition are wrong, or the start itself requires privileges that were dropped.","triggerScenarios":"mgr.Perform(&ossvc.ActionStart{...}) failing due to a bad WorkingDirectory (deleted between install and start), binary path resolution problems, or the service manager refusing to start without root.","commonSituations":"Install succeeded from a temp directory that no longer exists at start time; the binary was moved after installation; OS-level start restrictions (SELinux, AppArmor) blocking execution; partial install leaving a broken unit.","solutions":["Check 'systemctl status AdGuardHome' / sc query output and journal logs for the start failure","Ensure the working directory recorded at install time still exists and is accessible","Uninstall and reinstall from a permanent location with correct privileges","Inspect SELinux/AppArmor denials if on a hardened system"],"exampleFix":null,"handlingStrategy":"validation","validationCode":"// verify the recorded working directory and binary exist before start\nif _, err := os.Stat(workDir); err != nil {\n    log.Fatal(\"working directory missing: \", err)\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Install from a permanent location","Keep the binary path stable after installation","Check service manager logs immediately when start fails"],"tags":["service-management","start","install"],"backgroundTag":"service-start-failed","analyzedSha":"b41aefbe51c8dde65e2c50f093996afa0502edf9","analyzedAt":"2026-08-27T04:57:55.097Z","schemaVersion":2},"datasetVersion":"2026-08-27T08:17:20.692Z"}