Operations 9 min read

How to Seamlessly Upgrade WSL Ubuntu from 22.04 to 24.04 LTS

This step‑by‑step guide shows WSL users how to back up their Ubuntu 22.04 instance, prepare the system, configure the release upgrader, run the upgrade to Ubuntu 24.04 LTS, and verify the new environment while avoiding common pitfalls.

Ops Development & AI Practice
Ops Development & AI Practice
Ops Development & AI Practice
How to Seamlessly Upgrade WSL Ubuntu from 22.04 to 24.04 LTS

Why upgrade to Ubuntu 24.04 LTS

Linux kernel 6.8 – improved hardware support, performance gains and new system‑call features.

Default .NET 8 – ready for .NET development without extra configuration.

Updated toolchain – GCC 14, glibc 2.39, Python 3.12, OpenJDK 21 and other libraries.

Enhanced security – stricter kernel security defaults and application restrictions.

Enterprise‑grade management – new tools and policies for large‑scale deployment.

Upgrade process overview

High‑level flow of the upgrade steps.

Upgrade flowchart
Upgrade flowchart

Step 1: Backup the WSL instance

Shut down WSL to guarantee filesystem consistency: wsl --shutdown Export the Ubuntu 22.04 instance to a tar file. Replace the placeholders with the actual instance name (shown by wsl -l -v) and a directory that has enough free space:

# Format: wsl --export <instance-name> <backup-path>.tar
wsl --export Ubuntu-22.04 "D:\wsl-backups\Ubuntu-22.04-backup-$(Get-Date -Format 'yyyyMMdd').tar"

If the upgrade fails, restore the backup with wsl --import after unregistering the broken instance.

Step 2: Update the current installation

Run these commands inside the Ubuntu 22.04 WSL instance:

# Update package list
sudo apt update

# Upgrade all installed packages
sudo apt upgrade -y

# Handle possible dependency changes
sudo apt dist-upgrade -y

# Remove obsolete packages
sudo apt autoremove -y

# Clean the package cache
sudo apt autoclean

Step 3: Configure the release upgrader for LTS

Edit /etc/update-manager/release-upgrades (e.g., with nano) and ensure the Prompt line reads lts: sudo nano /etc/update-manager/release-upgrades Set Prompt=lts, save and exit (Ctrl+X, Y, Enter).

Step 4: Run the upgrade

Start the upgrade from the Ubuntu terminal: sudo do-release-upgrade Follow the on‑screen prompts – confirm the new release, accept default actions for configuration files, and answer “Yes” when asked to restart core services such as libc6.

The process will download hundreds of packages; the duration depends on network speed.

Step 5: Post‑upgrade cleanup and verification

Restart WSL to apply the new kernel: wsl --shutdown Then start the Ubuntu instance again.

Verify the upgrade by running: lsb_release -a Expected output includes Description: Ubuntu 24.04 LTS and Codename: noble .

Final cleanup – run the usual update and autoremove commands to remove leftover packages:

sudo apt update
sudo apt upgrade -y
sudo apt autoremove -y
sudo apt autoclean

FAQ

WSL version is too old. Update WSL first: wsl --update.

The upgrade failed. Unregister the failed instance with wsl --unregister <InstanceName> and restore the backup using wsl --import.

Third‑party PPAs are disabled. After a successful upgrade, re‑enable needed PPAs by editing files under /etc/apt/sources.list.d/.

Insufficient disk space. Ensure the virtual disk has at least 15–20 GB of free space before starting.

LinuxUpgradetutorialWSLUbuntu
Ops Development & AI Practice
Written by

Ops Development & AI Practice

DevSecOps engineer sharing experiences and insights on AI, Web3, and Claude code development. Aims to help solve technical challenges, improve development efficiency, and grow through community interaction. Feel free to comment and discuss.

0 followers
Reader feedback

How this landed with the community

Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.