I'm working directly in an Ubuntu Virtual Machine (VM). Some updates (like kernel) were available at the update manager.

If I weren't using a VM, I wouldn't update it since it's a risk to break something. Since it's a VM, you can create a Snapshot or export an appliance and restore if something goes wrong.

Suppose I'm not using a VM with a Debian/Ubuntu installation. Is there a install-restore approach that doesn't depend in a VM configuration to restore your system exactly before an upgrade (Like a "Restore Point" in Windows), being easy to restore like a VM appliance?

(I'm not looking for "ghost images" or something like that (Norton Ghost, Clonezilla, etc), I'm looking for something builtin in the Linux System)

  • 3
    I know that this is off-topic, so I'm adding it as comment, but OpenSolaris can make a snapshot of entire ZFS file system and restore it later. It doesn't take much disk space too, because of deduplication. In fact the standard way to make major upgrades is to create a new FS snapshot and install the upgrades on it. If ti works, you can delete the old one. If not, you can just go back to the one that was working. – AndrejaKo Jul 15 '10 at 7:53
  • 3
    @AndrejaKo: +1 However, it's a "clone" (a writeable snapshot; normal snapshots are read-only) and the fact that it doesn't need much space has nothing to do with deduplication but with the way snapshots and clones are handled in COW filesystems. I.e. you get the same disk space saving on non-dedup pools, too. – knweiss Jul 15 '10 at 18:56
  • @knweiss Yeah, that's right. I just looked it up! – AndrejaKo Jul 15 '10 at 19:22
up vote 15 down vote accepted

There is no similar feature built into any Linux distribution that I know of. There are several reasons why it would be a lot less useful than for Windows.

  • Primarily, Linux distributions are a lot more serious than Microsoft about stable releases being upgraded only to fix important bugs and with minimum changes. For example, with Ubuntu and Debian, you can choose to receive only security updates (-security), or only security updates and important bug fixes (-updates).

  • Kernel upgrades are the riskiest ones, because of the chance that a seemingly beneficial change will cause trouble on a specific hardware configuration. This is why most distributions allow more than one kernel version to be installed at the same time; for example, at the time I'm writing this, Ubuntu 10.04 has three kernel versions available: from the original release, with security updates, and with non-security updates as well. If the ...24 release causes a problem on your computer, you can reboot under ...23 (and even mark the ...24 as forbidden to install, at least if you're using aptitude).

  • There is no registry: all configuration data is in files (in the /etc hierarchy), which can easily be restored individually if something goes wrong. Even then, updates to the stable release rarely affect files under /etc.

  • If you're installing packages from some source other than a stable release, then you may want to keep copies of older versions of packages, and keep backups of your configuration files. Here are a few hints about this in Debian and Ubuntu.

    • Downloaded packages are kept in /var/cache/apt/archives. If you have the disk space, just don't delete old package files until you've confirmed the newer version works for you.
    • Many sources keep older versions, so you can downgrade easily (either by downloading and installing an older version manually, or by using apt preferences). For Debian, look at snapshot.debian.org.
    • There is a very easy way to set up version control over /etc: install the etckeeper package and activate it with the command etckeeper init. (I do it, but not because I'm worried about upgrades breaking something, rather because I'm worried about my changes breaking something.)
  • Yes, there is simply no comparison between stability of Windows and Debian/stable. Even if something breaks (almost always due to evident user mistake), there are plenty of tools to debug and fix problem. – liori Jul 14 '10 at 23:11
  • 2
    "Kernel upgrades are the riskiest ones" - That's why I keep a copy of Knoppix next to my computer. 5 and not 6. – amphetamachine Jul 15 '10 at 1:08
  • You might also find useful [rsnapshot](rsnapshot.org), a filesystem snapshot utility based on rsync. – Pablo Bianchi Jan 23 at 3:37

It is not needed, since the package manager takes care of which file is from which package, and also is able to roll back the package update or installation.

  • 2
    but if the package has broken something during the reboot, doing a rollback could become difficult (especially related to kernel revisions) – warren Jul 15 '10 at 4:16
  • 1
    Thats why usually the previous kernel is kept and can be selected to be booted in grub. – mbq Jul 15 '10 at 9:20
  • 1
    I do not agree. It would be very useful to be able to switch between OS update x and update x+1 (the difference could include much more than a kernel package) with a simple reboot. This is possible with OpenSolaris. – knweiss Jul 15 '10 at 19:19
  • Everything is possible with Solaris, except of finding stable drivers ;-) – mbq Jul 15 '10 at 20:17

You could try using a tool like etckeeper. This tool simply keeps system-wide configuration files in a version control repository and makes it easy to rollback and apply again any change.

But, to be honest, I never needed to rollback any change that came from updates on my debian/stable systems. I use it to fix mistakes I did manually.

  • I use etckeeper, but actually find it more useful to view a timeline of changes than to rollback (of course you get both abilities). Using the backend's (e.g. hg, git, bzr, etc.) built-in webserver is often the easiest: sudo hg serve -R /etc – Roger Pate Jul 15 '10 at 3:42

TMK, the Windows restore feature only reverses changes to the registry and some critical directories. Linux does not have this.

You could try the manual approach with backups. Simply backup your home directory and the list of programs from Synaptic and use that as a restore point.

Note that Ubuntu in particular (but probably also Debian) won't remove old kernel packages when installing the updates, and you can configure the bootloader to present a list of kernels to choose when booting.

This automatically creates "restore points" – for the kernel only – because you can choose the previous version if the newer causes problems. As far as I know, Windows has nothing like this for its kernel updates. (And especially for home users, I wouldn't want to fathom helping one diagnose and fix an unbootable system due to a kernel update.)

There is a tool called Timeshift. ( http://www.teejeetech.in/p/timeshift.html ) I haven't used it, but looks promising and I've heard good things about it from the users. The snapshots are designed to avoid data duplication. And don't get scared by obscure-looking website. :)

If you use the Logical Volume Manager to manage the contents of your hard disks, then you get this for free to some extent using snapshots. To quote the great HOWTO: "One example is to snapshot a volume, mount the snapshot, and try an experimental program that change files on that volume. If you don't like what it did, you can unmount the snapshot, remove it, and mount the original filesystem in its place."

  • I'de like to note, the suggested disk partitioning on Ubuntu 12.04+ uses LVM, so this is really the best suggestion. – kevinf Aug 6 '15 at 19:36

Depending of your VM technology, you can stop/suspend/pause the VM, dump the core and copy the image of the VM. If it failed, just restore the original.

If you are straight on a logical volume, you can create a LVM snapshot based on the original LV. Test an upgrade and if it work you redo it on the original VM (see lvcreate(8) -s)

Or using the gold old tar(1). You create a complete tar ball of the userspace, restore the files and removed the files that were not in the original tar ball.

  • From the question: "Is there a install-restore approach that doesn't depend on a VM configuration"? – Ben Voigt Jun 30 '12 at 23:56

Right now Linux does not really offer such a feature although it would be very useful.

However, the article Unbreakable upgrades, ZFS and Apt describes the apt-clone feature of the Linux-based Nexenta storage distribution and suggests ...

There is also a new filesystem being created in part as a response to ZFS, called BTRFS, which will have many of the advantages of ZFS and may be capable of enabling “unbreakable upgrades” for average Linux distributions like Ubuntu in the future as well.

IMHO we first need a usable Copy-On-Write (COW) filesystem for Linux before such a feature can be implemented in system installers/updaters in a sane way.

Notice: Although Nexenta is Linux-based it doesn't use the Linux kernel. It uses the OpenSolaris kernel and ZFS.

  • I don't mean to pick your nits, but Linux-Based with no Linux kernel is a bit of an oxymoron. – Seamus Connor Aug 16 '10 at 19:00

protected by Community Nov 23 '12 at 10:31

Thank you for your interest in this question. Because it has attracted low-quality or spam answers that had to be removed, posting an answer now requires 10 reputation on this site (the association bonus does not count).

Would you like to answer one of these unanswered questions instead?

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