Move your Ubuntu system to a new machine.

ubuntu logo

Recently I changed Ubuntu laptops, where a simple dd would not have worked due to the large changes in hardware, like going from non efi to a efi system. So the disk structure had to change. Why doing a disk image was ruled out.

I worked out a way after some google searching that it was best to install a basic installation of Ubuntu 16.10 on the new laptop then, create a list of the packages I had installed upon the old laptop, which I could use to install upon the new laptop.

Once this was done, all you need to do was transfer your data and any configuration files to the new laptop.

Below is a method I used with the commands to replicate the packages from the old system to the new system.

Step One:
On the old machine run this command to make a list of the packages that exist.

You also need to copy from the old machine the /etc/apt directory. This has any repositories etc that are custom added like Mariadb as a example.

Step Two:
Now copy the files across to the new machine. Replace the /etc/apt directory from the old machine.

After you have done this with the pkglist file you can install the packages with the following command.

There is a chance that packages will not be found or it will crash during installation. To get around packages that are not found, you need to edit your pkglist file to continue with package installation. When a package crashes during configuration/installation. You need to kill the dpkg process then type the following command:

This will fix the current installation/configuration issues. You can then restart the command from step two to continue installation of packages.

Step Three:
You can now copy your configuration files and anything else from your old machine to the new machine.

A easier way long as there are not too many files in your machine would be to just archive your home directory and copy the archive file to the new machine and un-archive it in your home directory. This is easiest as there are a lot of hidden files in your home directory.

Now enjoy your new machine.

Leave a Reply

