{"record":{"id":"bdb7a9de2692059c","repo":"gitbutlerapp/gitbutler","slug":"installation-failed-and-no-backup-available-to-res","errorCode":null,"errorMessage":"Installation failed and no backup available to restore","messagePattern":"Installation failed and no backup available to restore","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/but-installer/src/install_linux.rs","lineNumber":124,"sourceCode":"    fs::set_permissions(&install_bin_path, perms)?;\n\n    if !validate_installed_binary(&install_bin_path) {\n        warn(\"Final installation verification failed\");\n\n        if let Some(but_backup) = but_backup {\n            warn(\"Attempting to restore backup\");\n            fs::rename(&but_backup, &install_bin_path)?;\n\n            if validate_installed_binary(&install_bin_path) {\n                info(\"Backup restored successfully, exiting ...\");\n                bail!(\"Installation failed but your previous installation was restored\");\n            } else {\n                bail!(\n                    \"Installation failed and backup restoration also failed - 'but' command may not work\"\n                );\n            }\n        } else {\n            bail!(\"Installation failed and no backup available to restore\");\n        }\n    } else if let Some(but_backup) = but_backup {\n        info(&format!(\n            \"Removing backup at {}\",\n            but_backup.to_string_lossy()\n        ));\n        fs::remove_file(&but_backup)?;\n    }\n\n    Ok(())\n}\n","sourceCodeStart":106,"sourceCodeEnd":136,"githubUrl":"https://github.com/gitbutlerapp/gitbutler/blob/58e5313667b857ef39a730e380af31816a7b1768/crates/but-installer/src/install_linux.rs#L106-L136","documentation":"On Linux, when installing the new binary fails and no backup of the previous binary was ever created (typically a first-time install rather than an upgrade), there is nothing to roll back to, so the installer bails with this message. The system simply has no working new installation at the target path.","triggerScenarios":"First-time install where the new binary move/write fails (permissions, disk full, target dir missing) — `but_backup` is None so the restore branch cannot run.","commonSituations":"Installing into /usr/local/bin without sudo; target directory doesn't exist and creation failed; disk quota exceeded; antivirus/EDR removing the freshly written binary.","solutions":["Re-run the installer with elevated permissions if the target dir requires them (sudo), or choose a user-writable install location.","Create/verify the install directory exists and is writable before installing (mkdir -p, check ownership).","Free disk space / check quota, then retry the install.","Download the artifact manually and place it at the expected path with executable permissions."],"exampleFix":"// before\nsudo but install   # fails: cannot write /usr/local/bin/but\n// after\nmkdir -p ~/.local/bin\nexport PATH=\"$HOME/.local/bin:$PATH\"\nbut install   # installs to user-writable location\nchmod +x ~/.local/bin/but","handlingStrategy":"validation","validationCode":"let dir = install_bin_path.parent().unwrap();\nstd::fs::create_dir_all(dir)?;\nlet probe = dir.join(\".write-probe\");\nstd::fs::write(&probe, b\"\").context(\"install dir not writable\")?;\nstd::fs::remove_file(&probe)?;","typeGuard":null,"tryCatchPattern":"match install_app(&config) {\n    Err(e) if e.to_string().contains(\"no backup available\") => {\n        eprintln!(\"first install failed: {e:#}. Fix permissions/space and retry.\");\n        std::process::exit(1);\n    }\n    r => r?,\n}","preventionTips":["For first installs, verify the target directory exists and is writable (use a user-local prefix like ~/.local/bin if not root).","Ensure sufficient disk space/quota before installing.","Pre-create the install directory with correct ownership.","Watch for EDR/antivirus that deletes new binaries and add exclusions if needed."],"tags":["installation","linux","no-backup","permissions"],"backgroundTag":"file-write-failed","analyzedSha":"58e5313667b857ef39a730e380af31816a7b1768","analyzedAt":"2026-09-18T06:50:32.052Z","contentChangedAt":"2026-09-18T06:50:32.052Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}