Recover your ArchLinux installation after a mid-upgrade crash, power loss, etc
MIT License
Recover your ArchLinux installation after a mid-upgrade crash, power loss, etc.
This script is intended to be used when your ArchLinux system crashed, a power outage happens, etc, during a system upgrade, leaving your system in an inconsistent state. The script will attempt to recover your system by reinstalling all packages that were installed before the crash. Here, before the crash means the date that you specify.
Note: You don't need a very specific date, just a date that is close to the date of the crash. The script will then look for all packages that were installed after that date and will reinstall them.
The script have two modes of operation:
pacutils
, and then compare that to pacman -Qq
to make sure it's installing only packages that were present at the moment of the crash. In case that your pacman database is not working, just pass the --no-db
flag. This option is activated using the --paclog
option.pacutils
installed, the script can look for the package database and will extract the list of packages that were installed after the specified date. This option is activated using the --pacman-db
option.--dry-run
option.--paclog
option among with the --no-db
flag, the script will reinstall all packages that were installed/upgraded after the specified date. This means that packages that were removed after the specified date will be reinstalled. It's because the script doesn't know if any package was removed after the specified date because it doesn't have access to the pacman database for checking the current state of the system.pacutils
(optional): Required if you want to use the --paclog
option. You can install it from the official repositories.pacman
(required): Required for the script to work. It's installed by default on ArchLinux systems. In case that your pacman got corrupted, you can use the pacman-static package from the AUR by installing it manually or simply setting the USE_PACMAN_STATIC=true
environment variable when launching the script.Important: Quote the date argument if it contains spaces or special characters.
Tip: If your local pacman installation is broken, use the USE_PACMAN_STATIC=true
environment variable when launching the script.
# Check first what packages will be reinstalled using the --dry-run option
archlinux-pkgrecover.sh --pacman-db/--paclog "2024-05-27" [--no-db] --dry-run
# If you are happy with the list of packages that will be reinstalled
archlinux-pkgrecover.sh --pacman-db/--paclog "2024-05-27" [--no-db]
# Check first what packages will be reinstalled using the --dry-run option
archlinux-pkgrecover.sh --paclog "2024-05-27" --dry-run
# If you are happy with the list of packages that will be reinstalled
archlinux-pkgrecover.sh --paclog "2024-05-27"
# Check first what packages will be reinstalled using the --dry-run option
archlinux-pkgrecover.sh --paclog "2024-05-27" --no-db --dry-run
# If you are happy with the list of packages that will be reinstalled
archlinux-pkgrecover.sh --paclog "2024-05-27" --no-db
# Check first what packages will be reinstalled using the --dry-run option
archlinux-pkgrecover.sh --pacman-db "2024-05-27" --dry-run
# If you are happy with the list of packages that will be reinstalled
archlinux-pkgrecover.sh --pacman-db "2024-05-27"
This script is licensed under the MIT license. See the LICENSE file for more information.