I remotely administer a 12.04 LTS desktop and will periodically do
sudo apt-get update
sudo apt-get upgrade
However, if the upgrade installs something that causes a system issue, I'd like to roll it back to the previous version.
- Is there a way to tell what items will be upgrade, along with the from/to versions?
- Once the upgrade is done, is there a way to restore the previous version (and all its dependencies).
For example, I see on my local machine, that there is a newer version of the flash player. Historically, I've had numerous issues with flash breaking things, so I'm really concerned about blindly updating on this remote system and not being able to back it out.
Thoughts/suggestions?
Best Answer
You can display packages that are going to be upgraded and version changes with:
The '-V' flag shows you the additional info. As for the snapshots - you really have to roll your own here.
My favourite method for having the rollback ability is using LVM with snapshots on Linux - but the last time I checked, there was no progress on the automated rollback to the chosen snapshot. This might have changed since then (I'd be happy for someone to correct me), but you can always boot using
root=/dev/vg0/root-snap
kernel parameter (for instance) and then use rsync to sync the snapshot/dev/vg0/root-snap
to the original volume/dev/vg0/root
and then discard the snapshot. Not ideal but can be automated.Of course ZFS snapshots rock but there's no official, production-ready ZFS support for Linux (yes, I'm aware of zfsonlinux.org and ZFS-FUSE), so unless you're just playing around, that's not really a feasible option for you.
UPDATE: it looks that we can now rollback (merge in LVM2 parlance) snapshots. So the update would take the following form with LVM2:
Create a 5GB snapshot of your root LV:
lvcreate -s /dev/vg0/root -L5G -n root-snap
Update the package (as above).
Roll back if necessary by running:
lvconvert --merge /dev/vg0/root-snap
And because /dev/vg0/root (the original LV) is opened, lvconvert will notify you that the /dev/vg0/root will be rolled back to /dev/vg0/root-snap upon the next activation of this volume. This happens when you run
while this LV is closed, which is upon the next boot or after running: