Is there a "restore point" in Linux (Debian/Ubuntu) like Windows?

18

10

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)

Somebody still uses you MS-DOS

Posted 2010-07-14T21:02:57.907

Reputation: 4 143

3I 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 – 2010-07-15T07:53:14.473

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 – 2010-07-15T18:56:13.443

@knweiss Yeah, that's right. I just looked it up! – AndrejaKo – 2010-07-15T19:22:44.093

Answers

15

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

Gilles 'SO- stop being evil'

Posted 2010-07-14T21:02:57.907

Reputation: 58 319

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 – 2010-07-14T23:11:39.857

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 – 2010-07-15T01:08:21.720

You might also find useful rsnapshot, a filesystem snapshot utility based on rsync.

– Pablo A – 2018-01-23T03:37:36.130

5

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.

mbq

Posted 2010-07-14T21:02:57.907

Reputation: 727

2but if the package has broken something during the reboot, doing a rollback could become difficult (especially related to kernel revisions) – warren – 2010-07-15T04:16:15.800

1Thats why usually the previous kernel is kept and can be selected to be booted in grub. – mbq – 2010-07-15T09:20:20.880

1I 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 – 2010-07-15T19:19:37.553

Everything is possible with Solaris, except of finding stable drivers ;-) – mbq – 2010-07-15T20:17:28.840

5

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.

liori

Posted 2010-07-14T21:02:57.907

Reputation: 3 044

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 – None – 2010-07-15T03:42:16.537

3

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.

TheLQ

Posted 2010-07-14T21:02:57.907

Reputation: 2 738

3

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

Roger Pate

Posted 2010-07-14T21:02:57.907

Reputation:

3

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

user31389

Posted 2010-07-14T21:02:57.907

Reputation: 286

2

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

vwegert

Posted 2010-07-14T21:02:57.907

Reputation: 294

I'de like to note, the suggested disk partitioning on Ubuntu 12.04+ uses LVM, so this is really the best suggestion. – kevinf – 2015-08-06T19:36:47.103

1

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.

bclermont

Posted 2010-07-14T21:02:57.907

Reputation: 2 001

1From the question: "Is there a install-restore approach that doesn't depend on a VM configuration"? – Ben Voigt – 2012-06-30T23:56:26.533

1

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.

knweiss

Posted 2010-07-14T21:02:57.907

Reputation: 1 636

I don't mean to pick your nits, but Linux-Based with no Linux kernel is a bit of an oxymoron. – Seamus Connor – 2010-08-16T19:00:58.707