{"record":{"id":"2f91823cca7a4f8e","repo":"gitbutlerapp/gitbutler","slug":"attempting-to-restore-backup","errorCode":null,"errorMessage":"Attempting to restore backup","messagePattern":"Attempting to restore backup","errorType":"console","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"crates/but-installer/src/install_linux.rs","lineNumber":112,"sourceCode":"            .map(|c| format!(\" channel {}\", c.display_name()))\n            .unwrap_or_default(),\n        install_bin_path.to_string_lossy(),\n    ));\n\n    // NOTE: Must copy rather than rename. Rename assumes source and dest are on the same mount\n    // point, but /tmp on Linux systems is very often an in-memory file system (tmpfs) and thus on\n    // a different mount point than persistent files\n    fs::copy(but_path, &install_bin_path)?;\n\n    let mut perms = fs::metadata(&install_bin_path)?.permissions();\n    perms.set_mode(0o755);\n    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        ));","sourceCodeStart":94,"sourceCodeEnd":130,"githubUrl":"https://github.com/gitbutlerapp/gitbutler/blob/caf1f223d3cfb94488c9198ad34487c6006c648f/crates/but-installer/src/install_linux.rs#L94-L130","documentation":"A progress log inside the Linux installer's failure recovery: the freshly installed but binary failed verification and a backup of the previous version exists, so the installer renames the backup back over the install path and re-validates it. The next log line or bail! states the outcome — 'Backup restored successfully' or a combined failure. Acting on this message means acting on the outcome that follows it.","triggerScenarios":"Following the verification failure of entry 856 with but_backup present: fs::rename(&but_backup, &install_bin_path) executes at crates/but-installer/src/install_linux.rs:112 during install or update.","commonSituations":"Interrupted or partial updates (network drop mid-download, disk full during copy); architecture-mismatched binaries leaving the new install dead.","solutions":["Read the next line: 'Backup restored successfully, exiting ...' means the old version is back and you can retry later","'backup restoration also failed' means reinstall but via the official installer script","Fix the root cause first — disk space or wrong architecture — before updating again","Verify with `but --version` afterwards, whichever branch ran"],"exampleFix":null,"handlingStrategy":"fallback","validationCode":"// Take a backup only if the backup is itself a working binary\nif but_backup\n    .as_deref()\n    .map(validate_installed_binary)\n    .unwrap_or(false)\n{\n    // a safe restore target exists\n}","typeGuard":null,"tryCatchPattern":"if let Err(e) = fs::rename(&but_backup, &install_bin_path) {\n    bail!(\"restore failed: {e}\");\n}\nif !validate_installed_binary(&install_bin_path) {\n    bail!(\"restored backup does not run\");\n}","preventionTips":["Validate the backup before relying on it","Never delete the backup until the new install passes verification","Log the failure and the restore outcome as one unit for diagnosability"],"tags":["rust","linux","installer","backup-restore","recovery"],"backgroundTag":"backup-restore-failed","analyzedSha":"caf1f223d3cfb94488c9198ad34487c6006c648f","analyzedAt":"2026-08-20T07:55:40.983Z","schemaVersion":2},"datasetVersion":"2026-08-31T19:17:28.585Z"}