Ubuntu – Restore with back in time after fresh install of ubuntu

12.04backintimebackuprestoresoftware installation

I back up my home, which includes a list of installed softwares and PPA, on an external hard drive using back in time. I plan to do a fresh install of ubuntu. Will I then be able to install back in time on the fresh machine, then restore everything from there?

From what I have read on the internet, there are certain pitfalls, e.g. the two Ubuntu installs must be configured exactly the same, back in time settings must be the same, and I can only restore one folder at a time (!)

Best Answer

EDIT: There are two more detailed articles on BackInTime FAQ on how to backup and restore package selections.

Yes. This will work. Make sure you have included everything that is important to you in your last snapshot. Run this commands to backup your PPA's and package selection:

mkdir ~/.apt-backup
sudo dpkg --get-selections > /home/<USER>/.apt-backup/package.list
sudo cp -aR /etc/apt/sources.list* /home/<USER>/.apt-backup/
sudo apt-key exportall > /home/<USER>/.apt-backup/Repo.keys

Just to make sure there are no corrupt files in snapshot you should run one last snapshot with Use checksum to detect changes enabled in Options on your old machine. (starting from 1.0.28 there is a command-line option --checksum for this, too. So you don't need to enable and than disable it again anymore).

Setup your new machine, install backintime again and copy config from your last snapshot folder /path/to/backintime/HOST/USER/1/SNAPSHOT_ID to ~/.config/backintime/.

If Backintime doesn't find your old snapshots directly, go to Settings disable Auto Host - User - Profile and change Host and User entry so they match your old machine. Now restore your home directory (and all other folders which are important to you).

Recreate your /etc/apt/sources.list if you had set something special in there. If your Ubuntu version changed don't just copy them from ~/.apt-backup/sources.list

Restore apt-keys for your PPA's with sudo apt-key add ~/.apt-backup/Repo.keys

Make some "housecleaning" in ~/.apt-backup/package.list. For example you don't want to install the old kernel again. So run sed -e '/^linux-\(image\|headers\)/d' -i ~/.apt-backup/package.list

Finally install all your old packages again with:

sudo apt-get update
cat ~/.apt-backup/package.list | sudo dpkg --set-selections
sudo apt-get dselect-upgrade