The Jellyfish stings: Note to upgrading servers from Ubuntu 20.04 to 22.04

date: Feb 10, 2023
- Web
- Docker
- VirtualEnv
- apache2
language: English
This post is more than a year old. If this is a technical post, please check if it is still valid.


After upgrading my main server from Ubuntu 20.04 to 22.04, I had to fix a few things related to PHP, Apache2, Docker and VirtualEnv. Here are some notes to myself for the next time I need to do these.

The Jellyfish stings my fossa

I recently decided to upgrade my server from Ubuntu 20.04 to 22.04, after seeing the notification asking me to upgrade the server for months. I thought it will be smooth as upgrading my laptop (wait, what am I saying, Ubuntu upgrade broke my firefox and that’s why I switch my desktop to Fedora), but it turns out it was a painful process. After investigating each service, I finally got everything working again. Here are some notes to myself for the next time I need to do these.

PHP unfriended apache2

I have a few PHP projects running on my server, and I use apache2 as the web server. One thing I upgrade my machine is to, of course, use the latest PHP 8.1 to replace the unsupported PHP 7.4. But after upgrading, the apache2 service failed to start, complaining about a file not being found in a configuration file.

After some investigation, I found out that apparently, apache2 won’t automatically disable the old PHP module. I had to manually disable the old PHP module and enable the new one:

a2dismod php7.4
a2enmod php8.1

After that, I restarted the apache2 service, but it still failed to start. I checked the apache2 error log and found out that it was complaining about connecting to the PHP-FPM socket: AH02454: FCGI: attempt to connect to Unix domain socket /run/php/php7.4-fpm.sock (*) failed.

After some more investigation, I realized that it was the same issue as the previous one: it’s not using the new PHP-FPM service. I had to remove the old PHP-FPM service and install the new one:

sudo apt remove php7.4-fpm
sudo apt install php8.1-fpm

After that, reenable several modules and configurations and restart apache2:

sudo a2enmod proxy_fcgi setenvif
sudo a2enconf php8.1-fpm

then restart apache2, and it should be working again.

Docker containers sinking to the bottom of the ocean

I have a few docker containers running on my server, some of them are running using one-line Docker command, and some of them are running using docker compose. After upgrading, I found that several services are not running.

After some investigation, I realised that these docker containers are not running automatically after the server is rebooted since I didn’t use the --restart=always flag.

Afterward, I checked all my one-line docker commands and added the --restart=always flag to them. For the docker compose, Also make sure I added the restart: always flag in the docker-compose.yml file.

Where is ma Python?

I have a few python projects running on my server, and I use virtualenv to manage the python environment. After upgrading, I found out that all the services related to Python failed to start. After some investigation, I found out that Python got upgraded to 3.9, and the virtualenv I created was using Python 3.8. I had to recreate all of the virtualenv using Python 3.9 to make the work again.