{"record":{"id":"5d93552674e82b53","repo":"MHSanaei/3x-ui","slug":"bash-is-required-to-run-the-panel-updater-w","errorCode":null,"errorMessage":"bash is required to run the panel updater: %w","messagePattern":"bash is required to run the panel updater: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/web/service/panel/panel.go","lineNumber":233,"sourceCode":"func (s *PanelService) startUpdate(useDev bool) (int64, error) {\n\trunID := time.Now().UnixNano()\n\tif !acquireUpdateSlot(runID) {\n\t\treturn 0, fmt.Errorf(\"a panel update is already in progress\")\n\t}\n\tlaunched := false\n\tdefer func() {\n\t\tif !launched {\n\t\t\treleaseUpdateSlot()\n\t\t}\n\t}()\n\n\tif runtime.GOOS != \"linux\" {\n\t\treturn 0, fmt.Errorf(\"panel web update is supported only on Linux installations\")\n\t}\n\n\tbash, err := exec.LookPath(\"bash\")\n\tif err != nil {\n\t\treturn 0, fmt.Errorf(\"bash is required to run the panel updater: %w\", err)\n\t}\n\n\tscriptPath, err := downloadPanelUpdater()\n\tif err != nil {\n\t\treturn 0, err\n\t}\n\n\tstatusFile := config.GetUpdateStatusFilePath()\n\n\tmainFolder, serviceFolder := resolveUpdateFolders()\n\tupdateTag := \"\"\n\tif useDev {\n\t\tupdateTag = devReleaseTag\n\t}\n\tupdateScript := fmt.Sprintf(\"set -e; trap 'rm -f %s' EXIT; %s %s\", shellQuote(scriptPath), shellQuote(bash), shellQuote(scriptPath))\n\trunIDEnv := \"XUI_UPDATE_RUN_ID=\" + strconv.FormatInt(runID, 10)\n\tstatusFileEnv := \"XUI_UPDATE_STATUS_FILE=\" + statusFile\n","sourceCodeStart":215,"sourceCodeEnd":251,"githubUrl":"https://github.com/MHSanaei/3x-ui/blob/ad32144c42455696ea9f14e12168beac3e25f5d2/internal/web/service/panel/panel.go#L215-L251","documentation":"The updater is a shell script executed via bash -lc; exec.LookPath(\"bash\") must find a bash binary on PATH before anything else runs. Failure means no bash in PATH — typically minimal containers (distroless/scratch, alpine without bash, only busybox sh) or a stripped-down server image.","triggerScenarios":"Triggering the web update inside a container image that ships no bash (sh/dash/ash only), or with a sanitized PATH for the panel service.","commonSituations":"Alpine-based custom panel image without 'apk add bash'; systemd service with RestrictEnvironment/empty PATH; distroless container.","solutions":["Install bash: apt install bash / apk add bash, then restart the panel","Fix the service unit's PATH so /bin or /usr/bin (where bash lives) is included","Or perform a manual binary update instead of the web updater"],"exampleFix":"# before (alpine image)\ndocker exec panel sh -c 'which bash'   # empty -> update fails\n\n# after\ndocker exec -u root panel apk add bash\ndocker restart panel","handlingStrategy":"validation","validationCode":"if _, err := exec.LookPath(\"bash\"); err != nil {\n    return errors.New(\"bash not found; install it or update manually\")\n}","typeGuard":null,"tryCatchPattern":"_, err := panelService.StartUpdate(false)\nif err != nil && strings.Contains(err.Error(), \"bash is required\") {\n    // instruct admin to install bash in the container/host, then retry\n}","preventionTips":["Include bash in custom panel container images","Pre-flight check for bash before exposing the update button"],"tags":["environment","updates","bash","containers","panel-update"],"backgroundTag":null,"analyzedSha":"ad32144c42455696ea9f14e12168beac3e25f5d2","analyzedAt":"2026-08-15T11:13:23.905Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}