A simple bash script to undo the last pacman system update.
Effort was focused on performing a system downgrade to Arch wiki described standards.
See: https://wiki.archlinux.org/index.php/downgrading_packages.
Warning: Running an Arch linux system holding packages back from update is not recommended.
See: https://wiki.archlinux.org/index.php/System_maintenance#Upgrading_the_system
And: https://wiki.archlinux.org/index.php/System_maintenance#Partial_upgrades_are_unsupported
Downgrade-ud reinstalls packages available in the pacman package cache only. Does not use ALA.
Primairly intended for use within a short time after an update leaves the system in a bootable,
but otherwise undesireable state, and is presumed correctable by reversing the update.
Dependencies: sudo pacutils
USAGE: downgrade-ud [operation]
operations: -rl --readable_list print detailed downgrade list (packages-new-old-versions)
-dl --downgrade_list print downgrade list in pacman useable format
-dt --downgrade_test pacman simulated downgrade (prints only)
-dg --downgrade pacman downgrades packages-versions from list
-h --help print this help info
Downgrade-ud gets the last update package list with versions from /var/log/pacman.log.
The script verifies the packages prior to the last update are present in /var/cache/pacman/pkg/,
and will skip any packages not available.
The downgrade operation uses command sudo pacman -U "${DowngradeList[@]}"
.
Downgrade-ud provides various levels of information gathering operations before downgrading.
The first two operations, '-rl, -dl' are provided for easy evaluation of what the downgrade entails.
The '-dt --downgrade_test' runs sudo pacman -Up "${DowngradeList[@]}"
, on the downgrade package list,
which is essentially a non transactional "dry run" with pacman providing output.
NEWS/UPDATE INFO:
UPDATE: Mar 23, 2021:
Added check function to exit if no updates were made today.
Reworded help info for clarity.
Changed "parse for no options" from calling the help function, to print a message.
Implemented shellcheck.
REPORT: initial release, Feb 12, 2021:
I've used and tested downgrade-ud on my system, including downgrading the kernel and nvidia packages.
Have not encountered issues, but be aware this has minimal usage and testing on one system only.
Use at your own risk and before considering using it, please be advised to:
- Know enough shell scripting to be able to read and understand what the script is doing.
- Are able to handle a system downgrade manually, possibly using the script more for convenience.
- Are capable of troubleshooting and fixing a borked system from an update/downgrade issue.