Physical Address
Metro Manila, Philippines
Physical Address
Metro Manila, Philippines
Upgrading an Ubuntu server from 22.04 LTS to 24.04 LTS is normally straightforward using do-release-upgrade. However, the upgrade can fail when the server has third-party repositories, old package sources, or a DigitalOcean mirror configuration that the Ubuntu release upgrader cannot process correctly.
I encountered this problem on a DigitalOcean Droplet where I needed to upgrade Ubuntu 22.04 while keeping the existing public IP address.
Creating a new Droplet was not an ideal option because a normal DigitalOcean Droplet IP cannot simply be transferred to another Droplet. The better approach was to repair the repository configuration and perform an in-place upgrade.
This guide documents the working process.
Running:
sudo do-release-upgrade
failed during the repository update stage with the following message:
After updating your package information, the essential package
'ubuntu-minimal' could not be located. This may be because you have
no official mirrors listed in your software sources, or because of
excessive load on the mirror you are using.
See /etc/apt/sources.list for the current list of configured software
sources.
The important clue is:
ubuntu-minimal could not be located
ubuntu-minimal is an official Ubuntu package. If APT cannot find it, the problem is normally not the package itself. It usually means the release upgrader cannot see a valid Ubuntu main repository.
The solution was to temporarily remove third-party repositories and use Canonical’s Ubuntu repositories during the operating system upgrade.
After Ubuntu 24.04 was successfully installed, the system was switched back to DigitalOcean’s package mirror.
Before performing an operating system upgrade, create a snapshot of the Droplet.
This gives you a recovery point if the upgrade fails or the server becomes unbootable.
From the DigitalOcean Control Panel:
Droplet
↓
Backups & Snapshots
↓
Take Snapshot
For important servers, consider shutting down applications or the Droplet before taking the snapshot to maintain data consistency.
Check the current operating system:
cat /etc/os-release
Before the upgrade, the server should report something similar to:
VERSION_ID="22.04"
VERSION_CODENAME=jammy
Also check the system architecture:
dpkg --print-architecture
For most DigitalOcean Ubuntu Droplets, this will be:
amd64
Before changing repositories, save the complete APT configuration.
sudo mkdir -p /root/ubuntu-22-repo-backup
sudo cp -a /etc/apt /root/ubuntu-22-repo-backup/
This saves important files such as:
/etc/apt/sources.list
/etc/apt/sources.list.d/
/etc/apt/keyrings/
/etc/apt/trusted.gpg.d/
You can confirm the backup with:
ls -lah /root/ubuntu-22-repo-backup/apt
List the repositories currently configured on the server:
grep -RhnE \
'^[[:space:]]*(deb |deb-src |Types:|URIs:|Suites:)' \
/etc/apt/sources.list \
/etc/apt/sources.list.d/ 2>/dev/null
On a long-running server, you may find third-party repositories for software such as:
Docker
NodeSource
NGINX
BitNinja
MariaDB
MySQL
PostgreSQL
PHP
Grafana
Elastic
HashiCorp
DigitalOcean agents
These repositories can interfere with the Ubuntu release upgrade.
Create a directory where the repository definitions can be stored safely:
sudo mkdir -p /root/repos-disabled-for-upgrade
Move traditional .list repositories:
sudo find /etc/apt/sources.list.d \
-maxdepth 1 \
-type f \
-name '*.list' \
-exec mv -t /root/repos-disabled-for-upgrade/ {} +
Move Deb822 .sources repositories:
sudo find /etc/apt/sources.list.d \
-maxdepth 1 \
-type f \
-name '*.sources' \
-exec mv -t /root/repos-disabled-for-upgrade/ {} +
Confirm:
ls -lah /etc/apt/sources.list.d/
There should now be no active third-party .list or .sources files.
The original repository configurations are still available under:
ls -lah /root/repos-disabled-for-upgrade/
Do not delete them.
The next step is important.
Instead of using the DigitalOcean mirror during the release upgrade, temporarily use Canonical’s Ubuntu repositories.
Back up the current source file:
sudo cp -a /etc/apt/sources.list \
/etc/apt/sources.list.before-upgrade
Then replace it:
sudo tee /etc/apt/sources.list >/dev/null <<'EOF'
deb http://archive.ubuntu.com/ubuntu jammy main restricted universe multiverse
deb http://archive.ubuntu.com/ubuntu jammy-updates main restricted universe multiverse
deb http://archive.ubuntu.com/ubuntu jammy-backports main restricted universe multiverse
deb http://security.ubuntu.com/ubuntu jammy-security main restricted universe multiverse
EOF
Verify:
cat /etc/apt/sources.list
At this stage, all repositories should still reference:
jammy
Do not manually replace jammy with noble.
The Ubuntu release upgrader will perform that change itself.
Check that there are no Noble repositories active:
grep -Rni noble \
/etc/apt/sources.list \
/etc/apt/sources.list.d/ 2>/dev/null
There should be no output.
Remove the existing package indexes:
sudo apt clean
sudo rm -rf /var/lib/apt/lists/*
sudo mkdir -p /var/lib/apt/lists/partial
Then download fresh package information:
sudo apt update
This command must complete without repository errors before continuing.
ubuntu-minimal Can Be FoundBecause ubuntu-minimal was the package causing the upgrade failure, verify it directly:
apt-cache policy ubuntu-minimal
You should see a valid candidate version.
For example:
ubuntu-minimal:
Installed: <version>
Candidate: <version>
You should not see:
Candidate: (none)
You can also verify the package metadata:
apt-cache show ubuntu-minimal | head -20
And confirm whether it is installed:
dpkg -l ubuntu-minimal
The installed package should normally appear with:
ii
If necessary:
sudo apt install ubuntu-minimal
I also recommend reinstalling the important upgrade packages:
sudo apt install --reinstall \
ubuntu-minimal \
ubuntu-keyring \
ca-certificates \
update-manager-core
Before attempting the release upgrade again, make sure the Ubuntu 22.04 installation is healthy.
Run:
sudo dpkg --configure -a
Then:
sudo apt --fix-broken install
Update the package index:
sudo apt update
Install all available Ubuntu 22.04 updates:
sudo apt full-upgrade
Check for held packages:
apt-mark showhold
If packages are listed, investigate them before continuing.
Do not automatically remove package holds unless you know why the packages were held.
Check:
cat /etc/update-manager/release-upgrades
You should have:
Prompt=lts
If necessary:
sudo sed -i \
's/^Prompt=.*/Prompt=lts/' \
/etc/update-manager/release-upgrades
Verify:
grep '^Prompt=' /etc/update-manager/release-upgrades
Reboot the Droplet before starting the major release upgrade:
sudo reboot
Reconnect through SSH.
Then verify:
cat /etc/os-release
The server should still be running Ubuntu 22.04 at this point.
Run another repository check:
sudo apt update
And verify ubuntu-minimal again:
apt-cache policy ubuntu-minimal
Run:
sudo do-release-upgrade -c
The system should report that Ubuntu 24.04 LTS is available.
Start the supported release upgrade:
sudo do-release-upgrade
Do not manually change the operating system repositories from jammy to noble.
Do not use:
do-release-upgrade -d
for a normal production upgrade.
The release upgrader will change the Ubuntu repositories itself.
Read the prompts carefully, especially when the upgrader asks whether to replace configuration files.
For customized files such as:
/etc/ssh/sshd_config
/etc/nginx/nginx.conf
I normally keep the existing configuration during the upgrade and compare it with the package maintainer’s new configuration afterward.
After the upgrade completes:
sudo reboot
Reconnect to the Droplet.
Verify:
cat /etc/os-release
You should now see:
VERSION_ID="24.04"
VERSION_CODENAME=noble
Also check:
lsb_release -a
uname -r
In my case, the upgraded DigitalOcean Droplet successfully reached the current Ubuntu 24.04 LTS point release installed through the package repositories.
Check for failed systemd services:
systemctl --failed
Check serious errors from the current boot:
sudo journalctl -p err -b
If the server runs NGINX:
sudo nginx -t
sudo systemctl status nginx
Check listening services:
sudo ss -lntup
If Docker is installed:
sudo systemctl status docker
docker ps
For Node.js:
node -v
npm -v
For PM2:
pm2 status
Ubuntu 24.04 normally uses the newer Deb822 repository format.
Check:
ls -lah /etc/apt/sources.list /etc/apt/sources.list.d/
After the upgrade, you may find:
/etc/apt/sources.list.d/ubuntu.sources
Inspect it:
cat /etc/apt/sources.list.d/ubuntu.sources
The main Ubuntu repository may contain:
URIs: http://archive.ubuntu.com/ubuntu
Suites: noble noble-updates noble-backports
To return to DigitalOcean’s package mirror, first create a backup:
sudo cp /etc/apt/sources.list.d/ubuntu.sources \
/etc/apt/sources.list.d/ubuntu.sources.backup
Change only the main archive URL:
sudo sed -i \
's#http://archive.ubuntu.com/ubuntu#http://mirrors.digitalocean.com/ubuntu#g' \
/etc/apt/sources.list.d/ubuntu.sources
Leave the security repository pointing to:
http://security.ubuntu.com/ubuntu
The final configuration should look similar to:
Types: deb
URIs: http://mirrors.digitalocean.com/ubuntu
Suites: noble noble-updates noble-backports
Components: main restricted universe multiverse
Signed-By: /usr/share/keyrings/ubuntu-archive-keyring.gpg
Types: deb
URIs: http://security.ubuntu.com/ubuntu
Suites: noble-security
Components: main restricted universe multiverse
Signed-By: /usr/share/keyrings/ubuntu-archive-keyring.gpg
Refresh APT:
sudo apt clean
sudo apt update
A successful result should end with:
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
All packages are up to date.
ubuntu.sources.backup APT NoticeBecause the backup was stored inside /etc/apt/sources.list.d/, APT may display:
N: Ignoring file 'ubuntu.sources.backup' in directory
'/etc/apt/sources.list.d/' as it has an invalid filename extension
This is only a notice. It does not mean APT is broken.
Move the backup outside the active repository directory:
sudo mkdir -p /root/apt-backups
Then:
sudo mv /etc/apt/sources.list.d/ubuntu.sources.backup \
/root/apt-backups/
Run:
sudo apt update
The notice should disappear.
.distUpgrade?After the release upgrade, you may see files such as:
bitninja.list.distUpgrade
droplet-agent.list.distUpgrade
These are repositories that were disabled during the Ubuntu release upgrade.
APT does not treat .distUpgrade files as active repositories.
Do not simply rename every file back to .list.
For example:
bitninja.list.distUpgrade
may contain an Ubuntu 22.04 repository that is not appropriate for Ubuntu 24.04.
Before restoring a third-party repository, check the software vendor’s documentation and confirm that it supports Ubuntu 24.04 Noble.
Do this individually for:
Docker
BitNinja
NodeSource
NGINX
MariaDB
MySQL
PostgreSQL
PHP
Grafana
Elastic
other third-party software
The original configuration effectively had too many variables involved:
Ubuntu repositories
+
DigitalOcean mirror
+
Third-party repositories
+
Ubuntu release upgrader
When the release upgrader attempted to prepare Ubuntu 24.04, it could no longer find the essential ubuntu-minimal package.
The working upgrade process reduced the environment to:
Ubuntu 22.04
↓
Canonical official repositories only
↓
Repair APT
↓
Verify ubuntu-minimal
↓
do-release-upgrade
↓
Ubuntu 24.04
After the operating system upgrade was complete:
Ubuntu 24.04
↓
DigitalOcean mirror restored
↓
Third-party repositories reviewed individually
This avoids changing too many things at the same time and makes repository problems much easier to troubleshoot.
jammy With nobleYou may find guides suggesting commands that replace every occurrence of:
jammy
with:
noble
inside APT repository files.
Avoid this approach for a normal Ubuntu LTS upgrade.
Use:
sudo do-release-upgrade
and allow Ubuntu’s release upgrader to perform the operating system transition.
This gives the upgrader an opportunity to check package dependencies, disable incompatible third-party repositories, handle configuration changes, and prepare the system for the new Ubuntu release.
After the successful upgrade, the important repository configuration was:
Ubuntu 24.04 Noble
│
├── DigitalOcean Mirror
│ ├── noble
│ ├── noble-updates
│ └── noble-backports
│
└── Ubuntu Security
└── noble-security
Using:
http://mirrors.digitalocean.com/ubuntu
for the primary Ubuntu package archive and:
http://security.ubuntu.com/ubuntu
for security updates.
Run:
cat /etc/os-release
Then:
sudo apt update
Then:
apt-cache policy ubuntu-minimal
Finally:
systemctl --failed
A healthy upgraded server should report Ubuntu 24.04, retrieve packages normally from the configured repositories, find ubuntu-minimal, and have no unexpected failed services.
If an Ubuntu 22.04 to 24.04 upgrade on DigitalOcean fails because ubuntu-minimal cannot be located, do not immediately rebuild or destroy the Droplet.
If keeping the existing IP address matters, first repair the repository configuration.
Temporarily disable third-party repositories, switch to Canonical’s official Ubuntu repositories, verify that ubuntu-minimal is available, fully update Ubuntu 22.04, and run do-release-upgrade again.
After the upgrade succeeds, switch the primary Ubuntu repository back to DigitalOcean’s mirror and restore compatible third-party repositories individually.
This approach allowed the existing DigitalOcean Droplet to move from Ubuntu 22.04 to Ubuntu 24.04 without replacing the Droplet or losing its existing IP address.