Is there a way to backup your package configuration?

Is there a way to backup your package configuration?

For example, if I wanted to help out with trying edge(in this case Quantal), but I wanted to be able to revert to a stable-ish system if some update caused a problem -- how would I accomlish this task?

答案1

Configuration for your applications will be in folders whose names start with a dot, in your home folder. Backing those up may be advisable, especially if you want to revert to Precise, as config formats may change in newer packages, and things.

System-wide configuration is in /etc. Ditto.

You can back up your package selections with dpkg --get-selections > /path/to/backup/file and restore them with dpkg --set-selections < /path/to/backup/file && sudo apt-get install, but note that you'll also need to backup several files from /etc/apt if you're using any non-default repositories.

EDIT: If you don't have somewhere to do backups to, or you want to revert your system to exactly the way it was, package-versions and all, you have the following options (copied from my comments on the question): For the release upgrade, there's the --sandbox flag for do-release-upgrade, which (AIUI) puts the changes in an aufs tmpfs, so you can roll it back without trouble. There may be a way to do this with the later apt-get upgrades: Remount your partitions as aufs or overlayfs (overlayfs is meant to be without some problems aufs has, but Ubuntu didn't consider it stable enough to use it by default, so that may be a consideration) bases and use either tmpfs (if you have a lot of RAM) or a spare partition as the writable overlay before doing the upgrade. I don't believe there's really anything simpler, but I could be wrong. More information on this at this page - it's geared to USB Flash devices but should be useful even on "proper" hard drives.

If you choose certain filesystems at install time, you may be able to produce copy-on-write snapshots, enabling you to roll your entire system back to precisely its previous state. Note, though, that the only fs I know to be able to do this is btrfs, which is very slow to run package-management on, because dpkg uses lots of fsync(), which is slow on btrfs. This can be overcome by installing and using the "eatmydata" package, but that will make your system a lot harder to recover if it crashes or loses power in the middle of package-management operations. Other filesystems may have the same snapshotting capability; you may want to research this.

相关内容