The pain-free guide to switching Linux distros
How to effortlessly swap between distros without losing files
Those with a distro that uses RPM packages can generate it with:
rpm --query --list >packages.txt
You can shorten the list by removing all lib* packages and those with -dev in the name, as these are generally only installed as dependencies. This produces a list on Ubuntu (there are two spaces following 'ii').
dpkg --list | grep -v -e '-dev' -e '^ii lib' >packages.txt
Gentoo users only need to copy the world file – /var/lib/ portage/world – which also has the advantage of not including dependencies, only end-user programs.
That covers packages installed through the package manager, but what if you've installed from source, or even binary packages? Binary packages usually install to their own directory in /opt, so a listing of the contents of /opt will cover this
ls -1 /opt >binary_packages.txt
Packages you compiled from source are a little more tricky, but anything installing with ./configure && make && make install will install to /usr/local unless you mess with the PREFIX setting for ./configure.
ls -l /usr/local/bin >source_packages.txt
should catch most, if not all, self-compiled programs. With the lists stored, you can recreate the software collection on the new distro.
Get the best Black Friday deals direct to your inbox, plus news, reviews, and more.
Sign up to be the first to know about unmissable Black Friday deals on top tech, plus get all your favorite TechRadar content.
Installing the new distro
While we'll be using the same /home partition, we don't want to use the same home directory for your user. Each distro can contain different versions of the same software, even specially modified versions, and blindly sharing all configuration files can cause problems.
If you plan to use a different username on the new setup, there's no problem. Otherwise, you should rename the home directory to something like username-buntu. This is best done from a Live CD, such as the OpenSUSE installation disc. After installation is complete, we'll copy over the data files as well as some of the settings.
Now that your home files and system configurations are safe you can install the new distro in the usual way, but make sure you tell it to use your existing home partition and not to format it – when we tried it, the OpenSUSE installer wanted to delete both the root and home partitions.
Click on Create Partition Setup to specify what goes where and make sure only the root partition is to be formatted. Double check that /home won't be formatted and then proceed with the installation as normal.
With your permission
Wait for the installation to complete and reboot and you'll be presented with your new OpenSUSE desktop (or whichever distro you've installed), which will be set up with a new account for your user.
If you look in /home, you'll see directories for your user and the old user directory that you previously renamed. If you open the Properties window for each of these and check the Permissions tab, you'll probably see that the ownerships don't quite match up.
In the case of the Ubuntu to OpenSUSE switch, they have the same username but different groups. The reason for this is that Linux filesystems store the user and group information numerically, and this is translated to user and group names using the information in /etc/passwd and /etc/group.
So, even if you used the same username, the new distro may have allocated that to a different user ID (UID) and the same for groups. There's a further twist with groups: some distros put everyone in the users group, while others create a new group for each user, with the same name as the user.
As you only need to use the files from the old distribution with the new one now, you should change them all to match the new user. This needs a terminal and root access. If your username is jim, run su to become root and type:
chown -R jim: /home/jim-ubuntu