Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Is there a way in Ubuntu to rollback or undo the last upgrade after doing an apt-get upgrade if you don't like the results?

share|improve this question
Not with out a lot of work, that wouldn't be worth it. Can you save your /home and start over? What didn't you like? –  user10547 Sep 9 '09 at 22:31
I haven't done it yet, but this is a production server and I need to be sure there's no incompatibilities with our custom PHP/MySQL/Apache2 setup, and get back quickly if there is. I'd like to upgrade because I think it will fix another problem I'm having. –  jjclarkson Sep 9 '09 at 22:45
Unless you did dist-upgrade, I don't see what results there are not to like, since those are most likely security updates. –  LiraNuna Sep 9 '09 at 22:48
If you have a custom install, it's your responsibility to save patches and apply them against the current version. –  LiraNuna Sep 9 '09 at 22:51
If it's a server, try a dev server before upgrading the production one –  solarc Oct 3 '09 at 2:27

7 Answers 7

aptitude gives you access to all versions of a package if available according to Debian package management.

share|improve this answer
2.7.3 might help you downgrade to stable. 2.7.16 explains saving and restoring dpkg state. dpkg-repack allows you to "compress" a single package. –  joeytwiddle Nov 2 '12 at 20:50

I came across Hartman's Blogstatic Blog: How to Undo an Update in Ubuntu Lucid

The first step to undoing the offending update was to find out what updates it was exactly. After searching some forums I came across a way to see my update history: Open synaptic package manager ("sudo synaptic" in the terminal). From the menu bar, click File -> History and you will see all your updates sorted by date.

Unfortunately I had installed about 20 updates today, and I didn't know which one had caused the problem. By searching through each of the packages named in the History list, I was able to downgrade a few at a time until the problem was solved and I had identified the offending update. To do this:

Use the search bar to find the package you want to downgrade. Once you've found what you're looking for, click on the package to select it. From the menu bar, click Package -> Force Version and select the previous version of the package from the drop down menu. Click the "Apply" button to apply the downgrade.

share|improve this answer
I am expecting everyone here to know the basics on how to look up the last offending update: –  Manav Brar Jun 14 '12 at 20:56
What was that edit about? Do you have another question? Do you want us to play a guessing game? –  slhck Jun 15 '12 at 7:15

I believe not, aside from taking a full backup of the relevant filesystems (those that contain /, /bin, /lib, /sbin, /usr, /var, /etc and /boot (which may all be on on filesystem) and your boot record) so you can roll the machine back afterwards.

share|improve this answer
I could (and probably will) take a bare metal backup, but I wanted a software option that would let me undo the upgrade in a faster time frame. Restoring from the bare metal backup could take several hours. –  jjclarkson Sep 9 '09 at 22:47
You could make sure you have copies of all the packages you are about to upgrade in their previous versions (they are probably still sat in your apt cache somewhere in /var) and any relevant config files stored away. You could then try force a roll back by explicitly telling dpkg to install those versions. You might have some work to do afterwards when you want the normal upgrades to happen, so it isn't something I'd recommend. –  David Spillett Sep 9 '09 at 23:20
A backup made with rsync (timestamping enabled) can be restored quite quickly, compared to a backup made with tar. –  joeytwiddle Oct 6 '12 at 10:48

You could try checkinstall

After you ./configure; make your program, CheckInstall will run make install (or whatever you tell it to run) and keep track of every file modified by this installation, using the excelent installwatch ...

So maybe you could tell it to run aptitude safe-upgrade and it would keep track of every modification made by the upgrade.

share|improve this answer

There's a project called Nexenta that combines the OpenSolaris kernel with the Ubuntu userspace. It provides a tool to integrate Solaris's ZFS and Debian's apt in order to provide an undo button for upgrades. See here: http://www.nexenta.org/os/TransactionalZFSUpgrades

More generally, what you need is a versioning file system. Btrfs for Linux is in development.

share|improve this answer

Using Apt-Undo is a possible option, but it can only work if you are using it to installed and uninstall packages. It won't help if you've already uninstalled software the normal way.

http://www.ubuntugeek.com/apt-undo-a-simple-way-of-undoing-apt-actions.html http://lkubuntu.wordpress.com/2011/07/27/apt-undo-a-simple-way-of-undoing-apt-actions/

share|improve this answer

I run my linux servers in a virtualized environment and run a shapshot just before an apt-get upgrade, or any major 3rd party updates/upgrades for that matter.

Then if something goes wrong, I simply revert and life goes on until I can find out more information.

This came in very handle when I upgraded my Ubuntu box to 12.04, and somehow MySQL was completely non-functional after the upgrade. I rolled back, found the answer later, reran the upgrade, fixed MySQL, and life was good.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.