Third party cookies may be stored when visiting this site. Please see the cookie information.

PenguinTutor YouTube Channel

When it's time to re-install Ubuntu / Kubuntu Linux

One of the benefits of a Debian based Linux operating system is how easy it is to upgrade. In the case of Ubuntu and the KDE version Kubuntu then there is a new release every 6 months providing. This provides a way to get the latest versions of all the software with minimal fuss. For those that prefer a more stable system there are long term support (LTS) versions that just need the usual security updates to be applied, but I prefer to be a little closer to the cutting edge with new software updates.

I first got my current Dell laptop during 2013 and installed Ubuntu 13.10. Since then I have successfully upgraded the operating system 3 times including a change from the Unity desktop to KDE window manager. Unfortunately the 4th time was not so successful. The operating system appeared to be working at first, but the touchpad became erratic and the system slowed considerably.

The latest upgrade included the update to systemd based operating system. This is perhaps one of the most significant changes to Linux in the past few years (and arguably one of the most controversial). I believe systemd does bring many benefits, but it may have been a contributing factor to the problems that occurred after the upgrade.

I therefore took the non-trivial decision to re-install the operating system from scratch, and it now performs so much better. Not only that, but the clickpad (soft touchpad) that caused me many problems before was properly detected and configured by the operating system and the same with the power indicator which had also been a problem when the laptop was new. Whilst in theory it should have been possible to upgrade all the appropriate components, it looks like it was a good time to re-install rather than upgrade.

Screenshot Kubuntu 15.10

Upgrade steps

There are several things that can be done to make upgrades go more smoothly. Although one of these depends upon certain choices being made during the initial install of Linux.

Create a separate home folder

If you follow the default install for most Linux distributions then you will end up with a single filesystem which contains the programs and data. This is similar to Windows having a single C: drive for both data and applications.

If however you choose custom network partitioning during the install then you can split the physical disk into one partition for the programs and system configuration files which is the root filesystem (/); then add a separate file system called /home where user data is stored.
This means that you can upgrade the operating system and reformat the root filesystem without deleting your user data.

If you haven't done this already then you may want to look at performing a backup and restore to manage the upgrade, but it's a useful thing to consider during the re-install.

Create a backup

Hopefully you have a backup of your important data already, but it's especially important that you have your backup when you are performing a re-install. All going well then you shouldn't need the backups, but if you choose the wrong option or if there is a power cut during the install then there is a risk of data loss, so make sure that you have an up-to-date backup before starting.

How to make the backup is personal preference, but I bought a 5TB external disk drive so that I can backup all my data. I formatted my external disk drive as a Ext4 Linux file system, this has the advantage of preserving all file permissions, but does prevent accessing the data from a non-Linux computer (not a problem in my house). I used a file manager to drag and drop the contents of my home directory onto a directory on the external disk drive.

As well as creating the backup it's also important to validate that the backup was performed correctly. How this is done depends upon the risk you are will to take vs the time to validate the data. Ideally you would want to run a full checksum across all the files and compare them with the local disk, but as it already took about 12 hours to copy the data (left running overnight) the time to validate that would be too long. I therefore made a simple check using du. The du command reports on "disk usage" and so gives me an idea if the backup copy is approximately the same size as the original.

du -h --max-depth=0 /home/stewart
compared with
du -h --max-depth=0 /media/diskname/stewart-backup

At first it came up that the backup was significantly smaller - which I realised was due to it not copying hidden files and directories. Lucky that I checked as this includes my email archives etc., although fortunately the upgrade went successfully anyway.

I therefore used Konqueror to copy the hidden files by enabling view hidden / system files first.

Move the home folder

Although it would be possible to use the same home folder I wanted this to be a clean install without any of my old configuration options. I therefore renamed my home folder prior to the upgrade so that I could then selectively copy the data into the new folder. I did this by booting into a Live USB stick (running Kubuntu 15.10), mounted the home file system (though the file manager) and then renamed the folder to add ".old" to the end. I then moved the appropriate data into the /home/stewart folder that is created by the installer.

Don't format the home drive

To ensure that I kept my old data on the home folder I chose the custom partition open. I chose to use the old home directory and entered /home as the mount-point but ensured that the format option was NOT checked before starting the install.

Adding applications back

There is plenty of software installed by default, including LibreOffice (free Office Suite), Firefox web browser and various KDE applications. But there's also lots more than can be installed for free which typically involves a few clicks of the mouse or running a command in the terminal. The following is a partial list of some of the most useful applications that I installed after the re-install or plan to do soon.

GIMP (advanced image editor)
Konqueror (Web browser, which I mainly for ftp and ssh transfers)
Thunderbird (my personal preference for email client)
KeepassX (password safe application)
Epson printer drivers
JEdit (portable Java based text editor)
OpenBox (virtual machine software)
Steam (Games platform)
Dropbox (sync files across computers)
Scratch (programming language used for teaching programming to children)
Openssh server (allows secure remote connection, control and file transfer)
Kdenlive (Advanced non-linear editor for creating videos)
Mixxx (DJ music software)
Terminator (split window terminal application)
vim (Hardcore shell text editor)
kubuntu-restricted-extras followed by running sudo /usr/share/doc/libdvdread4/ (restricted audio and video codecs required for playing DVDs etc.)
Handbrake (Use for converting DVDs for Kodi)*

Summary - when to re-install vs upgrade

Normally I perform a live upgrade whenever a new version of Ubuntu / Kubuntu comes out, which is every 6 months. This mostly works, but is not infallible. My own stance is that whenever a new version comes out I find a convenient time to upgrade (sometime I'm not going to be hitting a deadline on an assignment where I need my laptop working) and try a regular system update. If that should fail, or result in a poorly performing system (as in this case) then it's time to re-install. Whilst a re-install is very time consuming with the proper backups it should be possible to do so without any loss of data.

* Note in some countries it is illegal to copy DVDs, whereas other countries permit copying for backups and to allow it to be played on a different media player (eg. Kodi / XBMC). Please check you local country laws before copying copyright DVDs.