Upgrading from Ubuntu 22.04 to Ubuntu 24.04: Full & Easy Steps

Posted on

Upgrading from Ubuntu 22.04 to Ubuntu 24.04: Full & Easy Steps

Upgrading from Ubuntu 22.04 to Ubuntu 24.04: Full & Easy Steps

This guide details the process of Upgrading from Ubuntu 22.04 to Ubuntu 24.04 Noble Numbat. Ubuntu 22.04, a Long Term Support (LTS) version released on April 25th, 2024, boasts a support lifespan of five years, extending until June 2029. It features the Gnome 46 desktop environment and improved default applications.

Further information can be found on the Ubuntu 24.04 Noble Numbat Future LTS Release page.

This article offers a step-by-step guide for Upgrading from Ubuntu 22.04 to Ubuntu 24.04 using the command-line terminal.

Note: While Ubuntu 23.10 offers a direct upgrade path to 24.04, Ubuntu 22.04 users will only receive the automatic upgrade prompt upon the release of 24.04.1 LTS, scheduled for August 15th. However, the upgrade can be initiated manually by following the instructions provided below.

Level Up your Ubuntu: Upgrading from Ubuntu 22.04 to Ubuntu 24.04 Noble Numbat

Before starting the upgrade, ensure you are logged into your Ubuntu 22.04 system as a non-root user with sudo privileges and that a basic firewall is configured. Refer to the Ubuntu 22.04 Initial Setup Guide for guidance on these prerequisites.

The following steps outline the process of Upgrading from Ubuntu 22.04 to Ubuntu 24.04.

Step 1 – Backup Ubuntu 22.04 System

Prior to any system-altering operation, backing up your data is paramount. Unexpected issues can arise during the upgrade, potentially leading to data loss. Employ a backup tool such as restic backup and restore data tools.

Once the backup is complete, proceed to the next step.

Step 2 – Update Ubuntu 22.04 System For Upgrading Process To Ubuntu 24.04

Ensure all installed packages are up-to-date by running the following commands:

# sudo apt update
# sudo apt upgrade

Confirm the upgrade process by pressing yes when prompted.

Update Ubuntu 22.04 System For Upgrading Process To Ubuntu 24.04

After the upgrade, a system reboot may be required:

Reboot Ubuntu 22.04 for new kernel

Reboot the system using the following command:

sudo reboot

Step 3 – Prepare the Migration Process from Ubuntu 22.04 to 24.04

Install the ubuntu-release-upgrader-core package:

sudo apt install ubuntu-release-upgrader-core -y

Verify that the prompt line in /etc/update-manager/release-upgrades is set to LTS.

# grep 'lts' /etc/update-manager/release-upgrades
# cat /etc/update-manager/release-upgrades

The output should resemble:

prompt line in the /etc/update-manager/release-upgrades is set to LTS
Upgrading from Ubuntu 22.04 to Ubuntu 24.04

Open TCP port 1022 in your firewall. This port serves as a fallback during upgrades if the default SSH port becomes unavailable.

For UFW users:

# sudo ufw allow 1022/tcp
# sudo ufw reload

TIPS: For comprehensive UFW firewall rule management, consult the guide on Essential UFW Firewall Commands and Rules with Examples.

For iptables users:

sudo /sbin/iptables -I INPUT -p tcp --dport 1022 -j ACCEPT

TIPS: To learn more about iptables rules, see the guide on Install and Use Iptables on Ubuntu 22.04.

Step 4 – Migrate From Ubuntu 22.04 to Ubuntu 24.04

Initiate the upgrade process:

sudo do-release-upgrade -d

An error message like the following may appear:

Upgrading From Ubuntu 22.04 to Ubuntu 24.04 - There is no development version of an LTS available
Upgrading from Ubuntu 22.04 to Ubuntu 24.04

There is no development version of an LTS available – Ubuntu 22.04 To Ubuntu 24.04

To resolve this, modify the /etc/update-manager/release-upgrades file, setting Prompt to normal. Open the file using a text editor such as Vi editor or Nano Editor:

sudo vi /etc/update-manager/release-upgrades
set Prompt to normal

Save and close the file.

Then, run the following command:

sudo do-release-upgrade

Follow the on-screen prompts to upgrade to Ubuntu 23.10. Reboot the system:

sudo reboot

After rebooting, reopen /etc/update-manager/release-upgrades and set Prompt back to LTS:

sudo vi /etc/update-manager/release-upgrades

Save and close the file.

Finally, initiate the upgrade to Ubuntu 24.04:

sudo do-release-upgrade -d

Note: After August 15th, the "development version" error should be resolved automatically.

Verify the successful upgrade using:

# cat /etc/os-release
# lsb_release -a
**<mark>Example Output</mark>**
PRETTY_NAME="Ubuntu 24.04 LTS"
NAME="Ubuntu"
VERSION_ID="24.04"
VERSION="24.04 LTS (Noble Numbat)"
VERSION_CODENAME=noble
ID=ubuntu
ID_LIKE=debian
...

Step 5 – Enable 3rd Party Repositories and Mirrors After Upgrading to Ubuntu 24.04

Re-enable any disabled 3rd party repositories and mirrors to ensure you receive updates. Navigate to the repositories directory:

# cd /etc/apt/sources.list.d
# ls -l

Remove the # comment from any disabled repository lines to re-enable them.

Update the package lists, upgrade installed packages, and remove obsolete packages:

# sudo apt update && sudo apt upgrade
# sudo apt autoremove --purge

Remove the temporary firewall rule added for SSH port 1022:

# sudo ufw show added
# sudo ufw delete allow 1022/tcp

Waiting for the LTS release is a recommended practice before Upgrading from Ubuntu 22.04 to Ubuntu 24.04.

Conclusion

This guide has demonstrated the process of Upgrading from Ubuntu 22.04 to Ubuntu 24.04. The process involves an intermediate step of upgrading to Ubuntu 23.10 before reaching Ubuntu 24.04. Alternatively, waiting until August 15th for a direct migration path is advised.

Alternative Solutions for Upgrading to Ubuntu 24.04

While the above command-line method is effective, alternative approaches can be considered. Here are two different methods:

1. Using a Clean Installation:

The most reliable, though arguably more involved, method is to perform a clean installation of Ubuntu 24.04. This eliminates the risk of encountering issues arising from residual configurations or incompatible packages from the previous installation.

  • Explanation: A clean install involves downloading the Ubuntu 24.04 ISO image, creating a bootable USB drive or DVD, and booting your system from this media. The installer will guide you through the process of formatting your hard drive (or a partition) and installing the operating system. This method provides a fresh start, ensuring compatibility and optimal performance.
  • Steps:
    1. Backup Your Data: This is crucial as the installation process will erase the selected partition or entire drive.
    2. Download the Ubuntu 24.04 ISO: Obtain the latest ISO image from the official Ubuntu website.
    3. Create Bootable Media: Use tools like Rufus (Windows), Etcher (cross-platform), or dd (Linux) to create a bootable USB drive.
    4. Boot from the USB/DVD: Restart your computer and enter the BIOS/UEFI settings (usually by pressing Delete, F2, F12, or Esc during startup) to select the USB drive or DVD as the boot device.
    5. Follow the Installation Wizard: The Ubuntu installer will guide you through the process of partitioning your drive, setting up your user account, and installing the operating system. Choose the "Erase disk and install Ubuntu" option for a truly clean install, or select "Something else" to manually partition the drive if you have specific requirements.
    6. Install and Restore your apps: Install all your apps and restore your files

2. Using a Virtual Machine (VM) for Testing:

Before committing to an upgrade on your primary system, you can create a virtual machine (VM) running Ubuntu 22.04 and perform the upgrade within the VM. This allows you to identify potential issues and test compatibility without risking your existing setup.

  • Explanation: Virtualization software, such as VirtualBox or VMware, allows you to run a guest operating system (in this case, Ubuntu 24.04) within your existing operating system. You can then perform the upgrade within the VM, observing the process and troubleshooting any problems that arise. If the upgrade is successful in the VM, you can proceed with the upgrade on your main system with greater confidence.
  • Steps:
    1. Install Virtualization Software: Download and install VirtualBox or VMware on your host operating system.
    2. Create a New VM: Configure the VM with sufficient resources (RAM, disk space) and select the Ubuntu 22.04 ISO image as the installation source.
    3. Install Ubuntu 22.04 in the VM: Follow the on-screen instructions to install Ubuntu 22.04 within the VM.
    4. Snapshot the VM: After installing Ubuntu 22.04, create a snapshot of the VM. This allows you to revert to the original state if the upgrade fails.
    5. Perform the Upgrade in the VM: Follow the steps outlined in the original article to upgrade Ubuntu 22.04 to Ubuntu 24.04 within the VM.
    6. Test and Troubleshoot: Once the upgrade is complete, thoroughly test the VM to identify any issues or incompatibilities.
    7. If needed, revert and try again. If the upgrade is succesful you can proceed to upgrade your real OS.
  • Code Example (not applicable, but configuration is important):
    • When configuring the VM, ensure that you allocate sufficient resources (RAM, CPU cores, disk space) to allow the upgrade process to run smoothly. A minimum of 4GB of RAM and 2 CPU cores is recommended.
    • Enable network access for the VM so that it can download updates and packages during the upgrade.
    • Create a snapshot before starting the upgrade, as it will allow you to revert to the previous state if something goes wrong.

These alternative methods provide different approaches to Upgrading from Ubuntu 22.04 to Ubuntu 24.04, offering options for both risk mitigation and a clean start.

Leave a Reply

Your email address will not be published. Required fields are marked *