Steps to upgrade from Ubuntu 22.04 to Ubuntu 24.04: Solution

SYSTEM INFORMATION
OS type and version Ubuntu 22.04
Webmin version 2.202
Virtualmin version 7.20.2
Webserver version apache 2.4.62
Related packages Ondrej (PHP and Apache)

I had a really hard time upgrading a Virtualmin server from Ubuntu 22.04 to Ubuntu 24.04. In the end, I managed to do it, so I want to share the steps I followed to succeed.

The problem was that if I used sudo do-release-upgrade (choosing to keep the previous configuration files), the system would boot, but Virtualmin would end up without Apache installed. Even if I reinstalled Apache from within Virtualmin, it would install, but no websites would work.

Regarding repositories, besides the ones from Ubuntu and Virtualmin, I had two from Ondrej (one for the different PHP versions and one for Apache!). It seemed that this was the root of the problem.

Fortunately, I have the system virtualized, so by using snapshots, I could test and roll back to the previous state repeatedly.

After several tests (and carefully reviewing this thread), I found a solution that doesnā€™t align with the ones Iā€™ve seen on the forum. Hereā€™s what I did:

  1. Before starting the upgrade, I modified the Ondrej repositories to point to ā€œnobleā€ with this command:

sudo sed -i ā€˜s/jammy/noble/gā€™ /etc/apt/sources.list.d/ondrej-*.list

VERY IMPORTANT: After running that command, I did not run sudo apt-get update or sudo apt-get dist-upgrade. I only executed that command to change the repositories.

  1. I ran sudo do-release-upgrade. When prompted to update any configuration files to the current version, I chose no.

  2. After doing this, the system booted without errors, and the websites worked right away! Everything seemed to work fine, but if I ran sudo apt-get update at that point, I encountered errors with the Ondrej repositories again due to encryption keys.

  3. So, after trying several options again, I decided to remove the Ondrej repositories and re-add them (without doing updates in between). The command sequence went something like this:

sudo add-apt-repository --remove ppa:ondrej/php
sudo add-apt-repository ppa:ondrej/php
sudo add-apt-repository ppa:ondrej/apache2
sudo apt update

Now I could run sudo apt-get update and sudo apt-get dist-upgrade, and everything was perfectly installed (at least in my case).

I tested the websites and the mail server, and everything works without issues.

2 Likes

A small clarification (when I reread what I posted I realized that it was not entirely clear): After doing everything I told you in the previous post, what you should do is what is indicated in this thread for the Cyrus SASL authentication server to work correctly. Donā€™t forget to check that thread. The big problem (for which the web pages didnā€™t even load) is solved with what I told you above, but the problems with SASL must be solved with the solution in that thread (Create the symbolic link, change the permissions of the saslauthd folder and recompose the virtualmin repositories).

1 Like