I want to migrate the configuration of an Ubuntu desktop to a new box with different hardware. What is the easiest way to do this? /etc/ contains machine and hardware specific settings so I can't just copy it blindly. A similar problem exists for installed packages.

edit: This is a move from x86 to x86-64.

  • @Gilles I think the "different hardware" deserves another question, especially the move from x86 to x86-64.
    – phunehehe
    Commented Feb 14, 2011 at 3:08
  • For the simpler case when the processor architecture is the same, see Moving linux install to a new computer. @phunehehe: The question originally didn't mention the architecture difference. Commented Feb 14, 2011 at 19:08

4 Answers 4


First, if you're going to keep running 32-bit binaries, you're not actually changing the processor architecture: you'll still be running an x86 processor, even if it's also capable of doing other things. In that case, I recommend cloning your installation or simply moving the hard disk, as described in Moving linux install to a new computer.

On the other hand, if you want to have a 64-bit system (in Ubuntu terms: an amd64 architecture), you need to reinstall, because you can't install amd64 packages on an i386 system or vice versa. (This will change when Multiarch comes along).

Many customizations live in your home directory, and you can copy that to the new machine. The system settings can't be copied so easily because of the change in processor architecture.

On Ubuntu 10.10 and up, try OneConf.

OneConf is a mechanism for recording software information in Ubuntu One, and synchronizing with other computers as needed. In Maverick, the list of installed software is stored. This may eventually expand to include some application settings and application state. Other tools like Stipple can provide more advanced settings/control.

One of the main things you'll want to reproduce on the new installation is the set of installed packages. On APT-based distributions, you can use the aptitude-create-state-bundle command (part of the aptitude package) to create an archive containing the list of installed packages and their debconf configuration, and aptitude-run-state-bundle on the new machine. (Thanks to intuited for telling me about aptitude-create-state-bundle.) See also Ubuntu list explicitly installed packages and the Super User and Ask Ubuntu questions cited there, especially Telemachus's answer, on how to do this part manually.

For things you've changed in /etc, you'll need to review them. Many have to do with the specific hardware or network settings and should not be copied. Others have to do with personal preferences — but you should set personal preferences on a per-user basis whenever possible, so that the settings are saved in your home directory.

If you plan in advance, you can use etckeeper Install etckeeper to put /etc under version control (etckeeper quickstart). You don't need to know anything about version control to use etckeeper, you only need to start learning if you want to take advantage of it to do fancy things.

  • Can you explain the part about issues with processor arch. I expect that there should not be a problem since he's moving from x86-32 to x86-64.
    – tshepang
    Commented Feb 14, 2011 at 21:23
  • 1
    @Tshepang: As long as you're not changing the architecture, it's simpler to copy the whole installation (/home, /etc, /var, /usr and all) and just edit the few files in etc that need editing. That's not an option if you're switching to a different architecture, because you need to reinstall all binary packages. Commented Feb 14, 2011 at 21:28
  • 1
    @user4745: Ideally you would commit each change in /etc individually with a meaningful commit message (as opposed to relying on the autocommit hooks), and commit machine-specific changes on a different branch from sysadmin preferences or site-wide configuration. But even basic use helps keep track of the changes you've made to /etc, so that you can replicate them on the new machine. Commented Feb 15, 2011 at 18:21
  • 1
    How does this compare to using aptitude-create-state-bundle?
    – intuited
    Commented Apr 13, 2011 at 6:33
  • 1
    @intuited: I didn't know about aptitude-create-state-bundle. Thanks, that's an automatic way of reproducing the APT-managed state (better than the manual way, which didn't reproduce APT sources or debconf settings). You might want to add an answer to the related questions as well. Commented Apr 13, 2011 at 18:09

Here's how to get everything except what you've manually configured:

dpkg --get-selections > packages.txt
debconf-get-selections > debconf.txt

Edit these files as necessary for anything that's arch dependent (e.g., linux-image), but I don't think there will be much.

Copy these files to the new system then run:

debconf-set-selections < debconf.txt
dpkg --set-selections < packages.txt
apt-get dselect-upgrade

You'll also want to copy (preferably with rsync) /home and any other data directories to the new system.

The only thing left will be config files from major packages (e.g., apache, bind, cronjobs, et al.).

  • 2
    +1 for mentioning debconf, but -1 for restoring the dpkg selections. This marks all packages as manually installed on the new machine. Use aptitude search '~i !~M' to save the list of manually installed packages; see this answer for more information. Commented Feb 14, 2011 at 19:28

Really a lot of the Windows voodoo regarding drivers, the registry, and being sensitive to motherboard changes is less severe on Linux if you are using a generic kernel with all drivers as modules, which is the usual situation for Ubuntu. These are the only things in /etc that are dependent on the hardware that I know of:

  • If you have proprietary graphics drivers installed, I would think these can be a problem.
  • I've swapped a hard drive with Debian installed from an old HP Pavilion (500Mhz cpu, quite old) to a slightly newer MSI KT4V board. The only issues I had was my network interface names were messed up. But this affected me more than the usual user because this install was explicitly for use as a router.
  • Another thing that might be affected is lm-sensors, if you use it. This is motherboard specific, but you can just run sensors-detect to fix that.
  • If you change the device Linux expects its root partition to be, or if any of the device/partitions pointed to in /etc/fstab change, i.e. you are moving from a PATA drive to a SATA, then you must update this otherwise Linux will have problems.

If the GPU is the same, the drive controller is the same type, and you don't have a bunch of homemade scripts dependent on the names of your network interfaces, I don't forsee major issues.

  • The hardware will not be very similar, larger disk, different partitioning, different GPU. I don`t think copying the file hierarchy will work without drastic intervention because it will be an x86->x64 transition.
    – user4745
    Commented Feb 13, 2011 at 22:06
  • Boot options (stored in /etc/default/grub, as the value of GRUB_CMDLINE_LINUX_DEFAULT) should be added to this list.
    – intuited
    Commented Apr 13, 2011 at 6:37

[adding onto this excellent answer]

I see that you mention concern for installed packages. By this, I suppose you mean that you are going to be tranferring a disk from one machine to another. Assuming that your two machines are x86 architecture, the only problem I can think of that can happen is if your installation is 64-bit and your new machine isn't. If things are the other around, there shouldn't be a problem.

  • I am not transferring the disk but I could copy the entire drive if that would be easier. Assuming I did a clean install, I wanted to re-install the same packages, omitting hardware or system dependent ones.
    – user4745
    Commented Feb 13, 2011 at 22:00
  • Also, it will be an x86->x64 transition.
    – user4745
    Commented Feb 13, 2011 at 22:07

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .