In the end of the year 2022 I decided that I would like to upgrade Ubuntu OS on my laptop. The previous version on it was Ubuntu 20.04. The current version is Ubuntu 22.04.1 LTS. During the prerequisite checks done, I got the warning message that there is not enough free space on the root filesystem. I have an older laptop with 20 GB of SSD, which I use for root filesystem to get good experience of OS performance. The message was, that there is only 900 MB left on the filesystem and for successful upgrade I have to have at least 3 GB of free space on the root filesystem.
I performed all traditional checks to see where the space on the file system is not optimally used and found nothing. I started to think that new version of OS is simply larger than the previous one and it will require more space for the root file system, which will not longer fit on my laptop’s SSD..
Luckily later I found out that some software on Ubuntu OS uses technology called snaps to be installed and managed. It appeared that this technology leaves older versions behind which should be cleaned out manually. Bellow you can find commands with which you can remove older revisions of software products and libraries. I managed to gain that way the free space necessary for the upgrade of Ubuntu OS.
#
Current version of Ubuntu
#
cat /etc/lsb-release
DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=22.04
DISTRIB_CODENAME=jammy
DISTRIB_DESCRIPTION=“Ubuntu 22.04.1 LTS”
#
Commands return an error if there are dependencies
#
sudo snap list –all
sudo snap remove –purge 2632
sudo snap remove –revision=2632 core18
sudo snap remove –revision=1738 core20
sudo snap remove –revision=599 snap-store
sudo snap remove –revision=211 opera
sudo snap remove –revision=2154 firefox
sudo snap remove –purge gnome-3-28-1804
sudo snap remove –purge core18
#
Software using snap technology
#
sudo snap list –all
Name Version Rev Tracking Publisher Notes
bare 1.0 5 latest/stable canonical✓ base
chromium-ffmpeg 0.1 30 latest/stable canonical✓ –
core 16-2.57.6 14399 latest/stable canonical✓ core
core18 20221212 2667 latest/stable canonical✓ base
core20 20221212 1778 latest/stable canonical✓ base
firefox 108.0.1-1 2211 latest/stable mozilla✓ –
gnome-3-38-2004 0+git.6f39565 119 latest/stable canonical✓ –
gtk-common-themes 0.1-81-g442e511 1535 latest/stable canonical✓ –
opera 94.0.4606.38 213 latest/stable opera-software✓ –
snap-store 41.3-66-gfe1e325 638 latest/stable/… canonical✓ –
snapd 2.57.6 17883 latest/stable canonical✓ snapd
teams-for-linux 1.0.45 269 latest/stable ismaelmartinez –