How to Upgrade Kubuntu 23.10 to 24.04#

Introduction#

The moment has arrived to upgrade my laptop from Kubuntu 23.10 to Kubuntu 24.04. When I received the notification about the new version, I decided it was time to take a big step. However, the upgrade process was not without its challenges, especially given my laptop’s unique configuration. As is often the case, the standard procedures didn’t quite work for me. In this post, I’ll share my experiences and solutions, hoping to make your upgrade journey smoother and more successful.

upgrade-kubuntu-23.10-to-24.04-plasma-info.jpeg

Some links which I’ve used during the upgrade process can be found in Resources section below:

  • Please check issues which I had during the upgrade process and how I’ve solved them.

  • I’ve you’re thinking that you won’t have those issues during the upgrade process, please try follow steps from Resources section.

Note

I have really hope that this post will be valuable for you during the upgrade process of your Kubuntu system.

Short Summary#

In this post, I will describe the steps I took to upgrade my laptop from Kubuntu 23.10 to Kubuntu 24.04.

You can expect the following:

  • Preparation steps before the upgrade.

  • How to move the snap folder to another partition (related with the challenges of not having enough free space on the root partition)

  • Suprises during working from terminal (no WIFI)

  • Some minor issues after the upgrade.

Challenges before the upgrade#

Before starting the upgrade process, I had to face with some challenges:

  • I knew that my root partition can have not enough free space.

I had root partition with 20GB and only 2GB free space. This was not enough for the upgrade process. Reason of so small root partition was that I have separate partition for major folders like /home, /usr.

Long time ago I’ve decided to have separate partitions for major folders based on my experience and recommendations from the internet. However, it looks like those days are long gone, as I can see that having a 20GB root partition today is not enough, which is really surprising to me.

Upgrade process - initial steps#

Fistly I wanted to check major details about my operating system, so following is a part of the output from the neofetch command:

# Details for ubuntu 23.10 (part of the output from the neofetch command)
OS       : Kubuntu 23.10 x86_64
Kernel   : 6.5.0-44-generic
Packages : 3446 (dpkg), 11 (snap)
Shell    : bash 5.2.15
DE       : Plasma 5.27.8

Secondly I decided that I want to do upgrade from terminal or console running under KDE Plasma.

Important

Finally commands below has been run on console in KDE Plasma (which means on GUI).

Intitial commands#

Following commands were used to start the upgrade process:

# Update the package list and prepare for upgrade
sudo apt-get update && sudo apt-get dist-upgrade

# Install the update-manager-core package
sudo apt install update-manager-core

Above commands worked without any issues.

Following command suprised me with many details about distribution.

Note

That was first time in my live when I’ve done distribution upgrade process on Ubuntu/Kubuntu.

# Start the upgrade process
sudo do-release-upgrade

And this displayed the following message:

Checking for a new Ubuntu release
Your Ubuntu release is not supported anymore.
For upgrade information, please visit:
http://www.ubuntu.com/releaseendoflife


= Welcome to Ubuntu 24.04 LTS 'Noble Numbat' =

The Ubuntu team is proud to announce Ubuntu 24.04 LTS 'Noble Numbat'.

To see what's new in this release, visit:
  https://wiki.ubuntu.com/NobleNumbat/ReleaseNotes

Ubuntu is a Linux distribution for your desktop or server, with a fast
and easy install, regular releases, a tight selection of excellent
applications installed by default, and almost any other software you
can imagine available through the network.

We hope you enjoy Ubuntu.

== Feedback and Helping ==

If you would like to help shape Ubuntu, take a look at the list of
ways you can participate at

  http://www.ubuntu.com/community/participate/

Your comments, bug reports, patches and suggestions will help ensure
that our next release is the best release of Ubuntu ever.  If you feel
that you have found a bug please read:

  http://help.ubuntu.com/community/ReportingBugs

Then report bugs using apport in Ubuntu.  For example:

  ubuntu-bug linux

will open a bug report in Launchpad regarding the linux package.

If you have a question, or if you think you may have found a bug but
aren't sure, first try asking on the #ubuntu or #ubuntu-bugs IRC
channels on Libera.Chat, on the Ubuntu Users mailing list, or on the
Ubuntu forums:

  http://help.ubuntu.com/community/InternetRelayChat
  http://lists.ubuntu.com/mailman/listinfo/ubuntu-users
  http://www.ubuntuforums.org/


== More Information ==

You can find out more about Ubuntu on our website, IRC channel and wiki.
If you're new to Ubuntu, please visit:

  http://www.ubuntu.com/


To sign up for future Ubuntu announcements, please subscribe to Ubuntu's
very low volume announcement list at:

  http://lists.ubuntu.com/mailman/listinfo/ubuntu-announce



Continue [yN] - y

Note

I liked that on above message there were clear informations about:

  • Links to release notes, feedback and helping, contributing to Ubuntu, how to raise a bug and more.

Upgrade process - Issues#

And as expected … first error appeared.

First error - not enough free space#

As expected :). After confirming the upgrade process (by pressing Y) I got the following error:

Error

Not enough free disk space

The upgrade has aborted. The upgrade needs a total of 5 170 M free
space on disk '/'. Please free at least an additional 4 994 M of disk
space on '/'. Empty your trash and remove temporary packages of
former installations using 'sudo apt-get clean'.

Checking free space#

First step was to check what is taking up space on my root partition. This can be done with the following command:

# Show disk usage of the root partition
ncdu -x /

This command will show the disk usage of the root partition in nice and interactive way.

In command above:

  • -x - is used to exclude other filesystems. This is important as I have separate partitions for major folders.

What was a suprise for me that the /var/lib/snapd/ folder was using more than 5GB (5.1GB) of space.

Hint

  • Snap is a software deployment and package management system for Linux. It allows you to install and manage applications in a sandboxed environment called a snap.

  • Snap packages are self-contained and work across a range of Linux distributions. They are easy to install, secure, and up-to-date.

  • Snap packages are stored in the /var/lib/snapd/ folder (Default location).

  • More details about snap can be found in the Resources section.

Note

  • I belive that snap is a great tool, however it is consuming so much space.

  • And not sure why it is not using /usr/local or /opt partition only /var/lib.

Increasing free space - moving snap folder#

Investigation showed that from my 20GB root partition, the /var/lib/snapd/ folder was taking more than 5GB of space, which is 25% of the total space. This was a lot of space for me.

5,1G    /var/lib/snapd/

More suprising was that I am not using snap that much. I have only few applications installed via snap.

# Command snap list
Name               Rev    Tracking         Publisher   Notes
bare               5      latest/stable    canonical✓  base
code               164    latest/stable    vscode✓     classic
codium             394    latest/stable    vscodium    classic
core18             2829   latest/stable    canonical✓  base
core20             2318   latest/stable    canonical✓  base
core22             1380   latest/stable    canonical✓  base
firefox            4539   latest/stable/…  mozilla✓    -
gnome-42-2204      176    latest/stable/…  canonical✓  -
gtk-common-themes  1535   latest/stable/…  canonical✓  -
snapd              21759  latest/stable    canonical✓  snapd

Finding partition with free space#

Lucky for me I got free space on another partition - however this required preparation and moving files to another partition.

Filesystem                          Size  Used Avail Use% Mounted on
/dev/mapper/vg_data-lv_data         331G  270G   45G  86% /mnt/myworkspace

Important

  • I had to move the /var/lib/snapd/ folder to another partition.

  • I had to be sure to do that properly, as snap is used by GUI applications (for example Firefox).

Creating initial plan for moving snap folder#

Initially I was thinking that this needs to be done from terminal (no GUI), so that was a plan.

  • Find documents how to move snap folder to another partition (including stopping services). Save this in text file - as working on terminal without GUI has some limitations (like using Links as a web browser).

  • Install terminal web browser (like Links) - to have option to search internet.

  • Go to terminal run-level - without GUI

  • Stop snap services and unmount snap folders

  • Move snap folder to another partition

  • Run upgrade process again

  • Check if everything is working fine after upgrade

  • After distro upgrade - reboot is recommended

Second error - no WIFI in terminal#

After collecting enough documents and installing required software, I was ready to start the process.

  1. I’ve switched to terminal (without GUI) - run-level 3.

# Check current run-level
$ who -r
# >> run-level 5

# Switch to run-level 3
sudo systemctl isolate multi-user.target

# ...
# When got console - I've login with my account
who -r
# >> run-level 3
  1. Tried to check whether connection with Internet works (good practice from my old days as sysadmin)

I wanted be sure that working with Links is possible, so I’ve tried to open some website by running links, and …

Error

  • Got message that links is not able to open website

  • I’ve checked others commands curl, wget, dig and all of them were not working.

  • Suprised - no WIFI in terminal !!

Important

  • That was really suprise for me - I was not able to use Internet easily in terminal.

  • On my old days as sysadmin WIFI (networking) was runing on multi-user mode (run-level 3) and not on GUI.

Tip

multi-user.target - This is a systemd target that sets up a non-graphical multi-user environment. It is similar to runlevel 3 in SysV init systems, where the system operates in a multi-user mode with networking but without a graphical interface.

  • Above information comes from Chat GPT when asked about multi-user.target.

That was too much errors for me - had no time to try setup WIFI on console. I’ve decided to move /var/lib/snapd/ folder from GUI (with WIFI working).

# Switch back to GUI
sudo systemctl isolate graphical.target

Adjust plan - moving snap folder from GUI#

After logging back into the GUI, I’ve created new plan:

  • Stop snap services and unmount snap folders

  • Move snap folder to another partition

  • Run upgrade process again

  • After distro upgrade - reboot is recommended

  • Check if everything is working fine after upgrade and reboot

Moving snap folder - in GUI#

Note

  • I have hope that one day I will write some tutorial about safe process of moving snap folder to another partition.

  • For this post I will describe only steps which I’ve done which worked for me.

  • I was not familiar with snap configuration, however I trusted my experience and knowledge that I can manage this … (Dealing with advance configuration for Linux filesystem, partitions and folders was something which I was done a lot in past)

So I’ve started with following steps:

  1. Close all GUI applications (like Firefox) which has been installed via snap (command snap list can help).

  2. Leave open only console

  3. Stop snap services

sudo systemctl stop snapd
sudo systemctl stop snapd.socket
  1. Unmount snap folders

for mount in $(mount | grep /snap | awk '{print $3}'); do
    sudo umount $mount
done
  1. Stop snapd-ns.mount

sudo systemctl stop run-snapd-ns.mount
  1. Verify that snap folders are unmounted

mount | grep snap
# Should not return anything
  1. Create folder on another partition

# Create folder on another partition
sudo mkdir -vp /mnt/myworkspace/system-mounts-temporary/var-lib-snapd
  1. Copy snap folder to another partition

  • Below command will make sure to preserve all attributes of files and directories.

# Rsync - copy files from one location to another
rsync -aAX --info=progress2 /var/lib/snapd/ /mnt/myworkspace/system-mounts-temporary/var-lib-snapd/

# Force sync (dump data to disks) - to be sure that everything is copied
sync
  1. Temporary rename snap folder

  • Following steps allows revert changes if something goes wrong.

# Rename old snap folder (Moving to another partition)
sudo mv -v /var/lib/snapd/ /mnt/myworkspace/system-mounts-temporary/var-lib-snapd-old

# Create new snap folder
sudo mkdir -vp /var/lib/snapd/
  1. Add new entry to /etc/fstab

# 2024-07-28 - Moved /var/lib/snapd to /mnt/myworkspace/system-mounts-temporary/var-lib-snapd
/mnt/myworkspace/system-mounts-temporary/var-lib-snapd  /var/lib/snapd  none    auto,bind       0       2
  • Above entry will make sure that snap folder will be mounted with bind option.

  1. Mount snap folder

# Make sure that sytem is aware of new entry in /etc/fstab
sudo systemctl daemon-reload

# Mount snap folder
sudo mount /var/lib/snapd/
  1. Start snapd services

Warning

  • I’ve tried to run following commands - however this failed with errors during mount.

  • Not sure why - didn’t try to investigate this.

sudo systemctl start snapd
sudo systemctl start snapd.socket
  1. Reboot system

  • So I’ve decided to reboot the system. And was wondering whether my system will boot and run…

Upgrade process - final steps#

After rebooting the system, everything was working fine for me:

  • Linux started

  • GUI started

  • Snap services started and were working fine

  • Snap applications were working fine

Re-runnig upgrade process

# Start the upgrade process
sudo do-release-upgrade

Note

  • This time upgrade process started without any issues.

  • I’ve been informed that upgrade can take some time to finish

And after some time, the upgrade process was completed successfully. (This took around 2 hours on my laptop)

So now.. that was the most scary part - rebooting the system after upgrade (no easy rollback)

System upgraded - welcome to Kubuntu 24.04#

Lucky for me - after rebooting the system, everything was working fine. :)

And following is result from the neofetch command:

# Details for ubuntu 24.04 (part of the output from the neofetch command)
OS       : Kubuntu 24.04 (LTS x86_64)
Kernel   : 6.8.0-39-generic
Packages : 3670 (dpkg), 12 (snap)
Shell    : bash 5.2.21
DE       : Plasma 5.27.11

Removal of old snapd data#

Once system was up and running, I’ve decided to remove old snapd data, no longer needed as snap was working with new location.

# Remove old snapd data
sudo rm -Rf /mnt/myworkspace/system-mounts-temporary/var-lib-snapd-old

Noticable issues after upgrade#

Mostly everything was working fine and I started working on my laptop as usual. However following are minor issues which I’ve noticed:

  • Python venv stopped working

    • In some projects I needed to recreate python virutal environments (venv)

      • they stopped working

      • re-sourcing venv source venv/bin/activate - not worked

  • Running Emacs fist time after upgrade

    • Emacs started consuming a lot of CPU

    • That was related with recompliation of packages during first run

    • This was resolved after above task was completed

Summary#

In this post, I’ve described the steps I took to upgrade my laptop from Kubuntu 23.10 to Kubuntu 24.04. There were some challenges along the way, but I was able to overcome them and complete the upgrade successfully.

I’ve learned:

  • Linux (Kubuntu in this case) changed a lot in last years comparing with my past experience.

  • Snap is a great tool, but it can consume a lot of space.

  • Snap design doesn’t work with symlinks to another partition - mount with bind worked for me.

I have really hope that this post helped you during the upgrade process of your Kubuntu system.

Resources#

Ubuntu / Kubuntu#

Following links are related with the upgrade process to Kubuntu 24.04:

Others#