I have a large number of stateful servers that use Yum for package management. I am interested in a general automatic process for rolling them back to a historical state.
Usually, enabling the correct repo and using distro-sync
would be sufficient, but packages which are marked with Obsoletes:
can break this; Yum will refuse to automatically downgrade to the obsoleted packages, and a user must manually say that they want to remove the obsoleting package and install the original.
Is there a general way to avoid this issue, other than simply banning Obsoletes:
? I could try to maintain a list of packages which should be installed for every historical version, but that seems heavyweight, and also has complexity with autoremoving unneeded dependencies (I'd have to implement logic for removing everything that I don't pin).
yum history rollback
If by "enabling the correct repo" you mean changing versions with this, that will get tricky. Reverting from EL 8 to EL 7 or whatever will be a giant gnarly transaction that almost certainly has not been tested before. Might not be possible to undo the side effects of some scripts. Specific older versions might not be on the mirrors anymore.
Also take backups of the OS image. Should you really need to revert to a package point in time, as the "full" backup that will be the most reliable.