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.

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)

share|improve this question
    
Why? In case you get a virus? (:snicker:) –  amphetamachine Jul 15 '10 at 1:24
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
add comment

9 Answers 9

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: 2.6.32.21.22 from the original release, 2.6.32.22.23 with security updates, and 2.6.32.23.24 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.)
share|improve this answer
    
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
    
Great answer. Thanks! –  Somebody still uses you MS-DOS Jul 15 '10 at 12:23
add comment

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.

share|improve this answer
1  
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
add comment

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.

share|improve this answer
    
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
add comment

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.

share|improve this answer
add comment

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.)

share|improve this answer
add comment

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.

share|improve this answer
    
I don't mean to pick your nits, but Linux-Based with no Linux kernel is a bit of an oxymoron. –  Seamus Aug 16 '10 at 19:00
add comment

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. :)

share|improve this answer
add comment

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.

share|improve this answer
    
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
add comment

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."

share|improve this answer
add comment

protected by Community Nov 23 '12 at 10:31

Thank you for your interest in this question. Because it has attracted low-quality answers, posting an answer now requires 10 reputation on this site.

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.