Upgrading an End of Life (EOL) Ubuntu OS to LTS version
Published: 2022-10-26 10:55:23


## Table of Contents
- [Why we need to upgrade](#why-we-need-to-upgrade)
- [Ubuntu OS versioning Info](#ubuntu-os-versioning-info)
- [Ubuntu Official Upgrade Guides](#ubuntu-official-upgrade-guides)
- [Steps for upgrading EOL Ubuntu releases](#steps-for-upgrading-eol-ubuntu-releases)
- [References](#references)


## Why do we need to upgrade?
There are two life cycles in Ubuntu OS versions, EOL (End of life) version and LTS (Long term support) version. 

LTS versions get the OS updates and security patches from release date + 5 years. So it is always better to keep our Ubuntu OS running on a LTS version.

Once OS versions are entered into EOL, we will stop getting the updates and OS security patches, hence our system becomes vulnerable.

Ubuntu OS upgrades are a bit tricky to do the update from EOL (End of life) version to LTS (Long term support) version. 

This article captures my recent experience of upgrading one such Ubuntu EOL release 21.04(Hirsute Hippo) to 22.04 (Jammy Jellyfish)

---

## Ubuntu OS versioning Info
Ubuntu OS version numbering consists of "year + month of the release". It is a tradition in Ubuntu for having an LTS version in “April release of even numbered year” 
For example: OS version `20.04` and `22.04` are LTS versions.

Please check the [Ubuntu OS releases page](https://wiki.ubuntu.com/Releases) to know more about the supported versions and EOL dates

## Ubuntu Official Upgrade Guides 
Generally, upgrading the OS before the end of life period can be done using the regular update method mentioned in [Upgrades guide](https://help.ubuntu.com/community/Upgrades). 

But after the EOL period we need to tweak some files to do the update. So I followed the [EOLUpgrades guide](https://help.ubuntu.com/community/EOLUpgrades) and was able to upgrade successfully from 21.04 (EOL version) to 22.04(LTS version) directly.

---

## Steps for upgrading EOL Ubuntu releases

> Before proceeding the update:
- Turn off - `auto suspend` and disable `screen blank` from `Ubuntu Power settings`
- Push any WIP code into GIT and save the ongoing work
- Upload your important work/personal files backup to Google drive or any storage for safety backup

### Step 1: Update /etc/apt/sources.list

In the `sources.list` file, debian package URL points to `in.archive.ubuntu.com`. Since the version is EOL, we can't use this URL, and hence we need to change it to `old-releases.ubuntu.com`

```
To begin the upgrade, make sure you have a /etc/apt/sources.list like the following, with CODENAME being your release, e.g. hirsute. Do *not* change your CODENAME, though, just the domain name in.archive.ubuntu.com (to "old-releases.ubuntu.com").
```

So change the domain name in `sources.list` file, from `in.archive.ubuntu.com` to `old-releases.ubuntu.com`

For example:
```
## EOL upgrade sources.list
# Required
deb http://old-releases.ubuntu.com/ubuntu/ hirsute main restricted universe multiverse
deb http://old-releases.ubuntu.com/ubuntu/ hirsute-updates main restricted universe multiverse
deb http://old-releases.ubuntu.com/ubuntu/ hirsute-security main restricted universe multiverse
```

Similarly, we need to update the `deb-src http://security.ubuntu.com/ubuntu` as `deb http://security.ubuntu.com/ubuntu` in `sources.list` file.

For example:
```
deb http://security.ubuntu.com/ubuntu hirsute-security main restricted
# deb-src http://security.ubuntu.com/ubuntu hirsute-security main restricted
deb http://security.ubuntu.com/ubuntu hirsute-security universe
# deb-src http://security.ubuntu.com/ubuntu hirsute-security universe
deb http://security.ubuntu.com/ubuntu hirsute-security multiverse
# deb-src http://security.ubuntu.com/ubuntu hirsute-security multiverse
```

### Step 2: Un-check Update URLs in system settings
Then, open `Software and Updates` from system menu and go to tab `Other software`, and un-check all the tick boxes.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ilstupq5g6fvl58okdqf.png)

## Step 3: Download upgrade tool and Run the upgrade 
You need to download the `upgrade tool` for the version of Ubuntu OS you are upgrading to. 

For example, if you are upgrading to Ubuntu 22.04 (Jammy), you'll see the download link for the specific version [on this page](https://changelogs.ubuntu.com/meta-release) as follows,
```
UpgradeTool: http://archive.ubuntu.com/ubuntu/dists/jammy-updates/main/dist-upgrader-all/current/jammy.tar.gz
```

- Pick the `upgrade tool` from the link and download the tarball to perform the upgrade for Ubuntu 22.04 (Jammy).
```
# Downloads the Jammy upgrader tool, check the link above for the URL of the file for your release
wget http://archive.ubuntu.com/ubuntu/dists/jammy-updates/main/dist-upgrader-all/current/jammy.tar.gz

# Extract it into a new upgrader directory
mkdir upgrader
tar -xaf jammy.tar.gz -C upgrader

# Run the executable, the name changes based on the release
cd upgrader
sudo ./jammy
```

---

After executing the upgrade installation command, it will take 30 mins to 1 hour depending on network connectivity for the upgrade to complete.

We need to make sure watch the upgrade progress, as there might be confirmation diaglog boxes in-between waiting for our inputs.

## References
- [OS Releases Info](https://wiki.ubuntu.com/Releases)
- [Regular upgrade guide](https://help.ubuntu.com/community/Upgrades)
- [EOL upgrade guide](https://help.ubuntu.com/community/EOLUpgrades)