Downgrade Ubuntu to previous version? [100% Working]

Ubuntu releases receive a development codename ("Kinetic Kudu") and are organized by release year and month. For example, Ubuntu 22.10 was released in October 2022, and 21.04 (Hirsute Hippo) was released in April 2011.

LTS or "Long Term Support" versions are released every two years in April. LTS releases are "enterprise grade" versions of Ubuntu, with 95% of them being LTS releases.

Advertisement

A temporary version of Ubuntu is released every six months between LTS releases, and the latest example is 22.10. These are production quality releases and are supported for 9 months, providing enough time for users to update. These releases do not take the long-term commitment of LTS releases.

There are 3 different version commits in Ubuntu:

  • Hardware and maintenance updates
  • Interim release Standard Support
  • Extended Security Maintenance (ESM)

In this article, we will explain the steps to downgrade from Ubuntu 21.04 to 20.04 released with the Interim release Standard Support.

 

How to downgrade Ubuntu 21.04 to 20.04?

IMPORTANT NOTE:

It is recommended to take backup of your existing data to avoid any unforeseen events. Please test the steps in lab environment before trying it out in production.

Sometimes the upgrade is done on purpose, sometimes the operating system is upgraded unconsciously. In this case, downgrade is required if there is no new LTS version.

As in version upgrade, root authorized user should be used in version downgrade or operations should be performed with sudo.

Advertisement
foc@foc-ubuntu21:~$ sudo su
[sudo] password for foc:
root@foc-ubuntu21:/home/foc#

Current version information:

root@foc-ubuntu21:/home/foc# cat /etc/os-release
NAME="Ubuntu"
VERSION="21.04 (Hirsute Hippo)"
ID=ubuntu
ID_LIKE=debian
PRETTY_NAME="Ubuntu 21.04"
VERSION_ID="21.04"
HOME_URL="https://www.ubuntu.com/"
SUPPORT_URL="https://help.ubuntu.com/"
BUG_REPORT_URL="https://bugs.launchpad.net/ubuntu/"
PRIVACY_POLICY_URL="https://www.ubuntu.com/legal/terms-and-policies/privacy-policy"
VERSION_CODENAME=hirsute
UBUNTU_CODENAME=hirsute

Current kernel information:

root@foc-ubuntu21:/home/foc# uname -a
Linux foc-ubuntu21 5.11.0-49-generic #55-Ubuntu SMP Wed Jan 12 17:36:34 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux

Current repository information:

root@foc-ubuntu21:/# grep -wv "#" /etc/apt/sources.list

#deb cdrom:[Ubuntu 21.04 _Hirsute Hippo_ - Release amd64 (20210420)]/ hirsute main restricted
deb http://us.archive.ubuntu.com/ubuntu/ hirsute main restricted
deb http://us.archive.ubuntu.com/ubuntu/ hirsute-updates main restricted
deb http://us.archive.ubuntu.com/ubuntu/ hirsute universe
deb http://us.archive.ubuntu.com/ubuntu/ hirsute-updates universe
deb http://us.archive.ubuntu.com/ubuntu/ hirsute multiverse
deb http://us.archive.ubuntu.com/ubuntu/ hirsute-updates multiverse
deb http://us.archive.ubuntu.com/ubuntu/ hirsute-backports main restricted universe multiverse
deb http://security.ubuntu.com/ubuntu hirsute-security main restricted
deb http://security.ubuntu.com/ubuntu hirsute-security universe
deb http://security.ubuntu.com/ubuntu hirsute-security multiverse

If you cannot get updates with the current repository, edit the sources.list file with the following command:

root@foc-ubuntu21:/ sed -i -e 's/us.archive/old-releases/g' /etc/apt/sources.list

Then update the package list and get an upgrade:

root@foc-ubuntu21:/ apt update -y &&  apt upgrade -y

We are no longer dealing with the previous version. Actions after this step include downgrading.

 

Step-1: Backup the old sources.list file

Back up the old sources.list file with the following commands:

root@foc-ubuntu21:~# cd /etc/apt/
root@foc-ubuntu21:/etc/apt# mv sources.list sources.list-old

 

Step-2: Add Ubuntu 20.04 LTS (Focal Fossa) repository

Now add the official Ubuntu 20.04 LTS (Focal Fossa) repository information:

root@foc-ubuntu21:/etc/apt# nano sources.list

deb http://tr.archive.ubuntu.com/ubuntu focal main restricted
#deb-src http://tr.archive.ubuntu.com/ubuntu focal main restricted
deb http://tr.archive.ubuntu.com/ubuntu focal-updates main restricted
#deb-src http://tr.archive.ubuntu.com/ubuntu focal-updates main restricted
deb http://tr.archive.ubuntu.com/ubuntu focal universe
#deb-src http://tr.archive.ubuntu.com/ubuntu focal universe
deb http://tr.archive.ubuntu.com/ubuntu focal-updates universe
#deb-src http://tr.archive.ubuntu.com/ubuntu focal-updates universe
deb http://tr.archive.ubuntu.com/ubuntu focal multiverse
#deb-src http://tr.archive.ubuntu.com/ubuntu focal multiverse
deb http://tr.archive.ubuntu.com/ubuntu focal-updates multiverse
#deb-src http://tr.archive.ubuntu.com/ubuntu focal-updates multiverse
deb http://tr.archive.ubuntu.com/ubuntu focal-backports main restricted universe multiverse
#deb-src http://tr.archive.ubuntu.com/ubuntu focal-backports main restricted universe multiverse
deb http://tr.archive.ubuntu.com/ubuntu focal-security main restricted
#deb-src http://tr.archive.ubuntu.com/ubuntu focal-security main restricted
deb http://tr.archive.ubuntu.com/ubuntu focal-security universe
#deb-src http://tr.archive.ubuntu.com/ubuntu focal-security universe
deb http://tr.archive.ubuntu.com/ubuntu focal-security multiverse
#deb-src http://tr.archive.ubuntu.com/ubuntu focal-security multiverse

 

Step-3: Create preferences file

The part files /etc/apt/preferences.d/ in the APT preferences file can be used to control which package versions are selected for installation.
APT assigns a priority to each available version, and subject to dependency restrictions, apt-get selects the version with the highest priority for installation.
APT preferences override the priorities that APT assigns to package versions by default, thus giving the user control over which one is selected for installation.

Create a file for focal under the /etc/apt/preferences.d directory and write the following information:

root@foc-ubuntu21:/etc/apt# nano /etc/apt/preferences.d/focal

Package: *
Pin: release n=focal
Pin-Priority: 1001

Package: *
Pin: release n=focal-updates
Pin-Priority: 1002

Package: *
Pin: release n=focal-security
Pin-Priority: 1003

 

Step-4: Start Downgrade

Now we start downgrading with the new repository:

root@foc-ubuntu21:/etc/apt# apt update -y

Install the aptitude package for downgrade:

Advertisement
root@foc-ubuntu21:/etc/apt# apt install aptitude -y

Then start the downgrade:

root@foc-ubuntu21:/etc/apt# aptitude dist-upgrade -y

During the downgrade, the downgrade process may be interrupted:

...
Processing triggers for libgdk-pixbuf-2.0-0:amd64 (2.42.2+dfsg-1build1) ...
Errors were encountered while processing:
cups-ipp-utils
systemd-sysv
gir1.2-freedesktop:amd64
gir1.2-gtk-3.0:amd64
cups-filters-core-drivers
libcupsimage2:amd64
gir1.2-pango-1.0:amd64
gir1.2-gnomedesktop-3.0:amd64
gnome-shell
ubuntu-session
gdm3
libpam-systemd:amd64
cups-filters
gir1.2-vte-2.91:amd64
gir1.2-gnomebluetooth-1.0:amd64
xserver-xorg-legacy
gnome-settings-daemon
gjs
dbus-user-session
printer-driver-foo2zjs
cups

Current status: 8 (+8) broken, 47 (-2) upgradable.

In this case, the downgrade process is repeated:

root@foc-ubuntu21:/etc/apt# aptitude dist-upgrade -y

Fix bad packages in package downgrade with the following command:

root@foc-ubuntu21:/etc/apt# apt --fix-broken install

Depending on the packages installed on Ubuntu 21.04 and their dependencies, you may receive errors in the installation. Here is an example error and its solution:

dpkg: error processing archive /var/cache/apt/archives/libgamemode0_1.5.
1-0ubuntu3.1_amd64.deb (--unpack):
trying to overwrite '/usr/libexec/cpugovctl', which is also in package
gamemode-daemon 1.6.1-1

Solution:

Advertisement
root@foc-ubuntu21:/etc/apt# dpkg -i --force-overwrite /var/cache/apt/archives/libgamemode0_1.5.1-0ubuntu3.1_amd64.deb

Then the downgrade process is repeated:

root@foc-ubuntu21:/etc/apt# aptitude dist-upgrade -y

The downgrade continues until you see the following message:

No packages will be installed, upgraded, or removed.
0 packages upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
Need to get 0 B of archives. After unpacking 0 B will be used.

Downgrade completed successfully, release version:

root@foc-ubuntu21:/etc/apt# cat /etc/os-release
NAME="Ubuntu"
VERSION="20.04.5 LTS (Focal Fossa)"
ID=ubuntu
ID_LIKE=debian
PRETTY_NAME="Ubuntu 20.04.5 LTS"
VERSION_ID="20.04"
HOME_URL="https://www.ubuntu.com/"
SUPPORT_URL="https://help.ubuntu.com/"
BUG_REPORT_URL="https://bugs.launchpad.net/ubuntu/"
PRIVACY_POLICY_URL="https://www.ubuntu.com/legal/terms-and-policies/privacy-policy"
VERSION_CODENAME=focal
UBUNTU_CODENAME=focal

The operating system became Ubuntu 20.04.5 LTS (Focal Fossa).

 

Step-5: Delete unnecessary packages

Finally after installation the unused packages are deleted:

root@foc-ubuntu21:/etc/apt# apt autoremove -y

 

Summary

Upgrade is a difficult process, but downgrade is more difficult. If you want to downgrade your Ubuntu 21.04 operating system to 20.04, this article will do the trick. But you should know that you will encounter errors and problems.

Advertisement

Reinstallation is recommended if possible.

 

References

askubuntu.com - How to roll back Ubuntu to a previous version?
askubuntu.com - dpkg: error processing

 

Didn't find what you were looking for? Perform a quick search across GoLinuxCloud

If my articles on GoLinuxCloud has helped you, kindly consider buying me a coffee as a token of appreciation.

Buy GoLinuxCloud a Coffee

For any other feedbacks or questions you can either use the comments section or contact me form.

Thank You for your support!!

Leave a Comment

X