Posts – how-tos

The saga: updating a home server running Ubuntu 23.11 Mantic Minotaur to 24.04 Noble Numbat from the command terminal using the do-release-upgrade command

Pretty well all the commands that follow need to be run as root so either prefix each command with sudo (you’ll be asked for your password the first time and again after any reboot) or, as I did, use sudo bash to get a root shell prompt.

First snag: I use Unison to two-way synchronise files with my laptop. Unison is great but its biggest failing is complete lack of compatibility between versions. For some reason that I can’t remember now, the laptop version is stuck on 2.48 and I had downgraded the server version to match and used apt-mark hold unison to prevent it being updated. But do-release-upgrade requires all packages to be up to date before upgrading so apt-mark unhold unison then apt update then apt upgrade then do-release-upgrade. Obviously unison needed to be downgraded to 2.48 and held again once the update was done.

Second bigger snag: the upgrade went fine but after it was complete, the apache web server wasn’t serving up any web pages. You could skip to the end of the post to see the fix that worked for me but your problem might be different. So, to troubleshoot:

root@xxxx:/# systemctl stop apache2
root@xxxx:/# systemctl start apache2 produced the following error message:
Job for apache2.service failed because the control process exited with error code.
See “systemctl status apache2.service” and “journalctl -xeu apache2.service” for details.

I tried
root@xxxx:/# systemctl status apache2.service
and got the following:
× apache2.service – The Apache HTTP Server
Loaded: loaded (/usr/lib/systemd/system/apache2.service; enabled; preset: enabled)
Active: failed (Result: exit-code) since Sun 2024-06-02 06:21:43 BST; 31s ago
Duration: 23h 26min 21.791s
Docs: https://httpd.apache.org/docs/2.4/
Process: 93878 ExecStart=/usr/sbin/apachectl start (code=exited, status=1/FAILURE)
CPU: 22ms

Jun 02 06:21:43 xxxx systemd[1]: Starting apache2.service – The Apache HTTP Server…
Jun 02 06:21:43 xxxx apachectl[93881]: apache2: Syntax error on line 146 of /etc/apache2/apache2.co>
Jun 02 06:21:43 xxxx systemd[1]: apache2.service: Control process exited, code=exited, status=1/FAI>
Jun 02 06:21:43 xxxx systemd[1]: apache2.service: Failed with result ‘exit-code’.
Jun 02 06:21:43 xxxx systemd[1]: Failed to start apache2.service – The Apache HTTP Server.

Now here’s where things went a bit wrong. Line 146 of /etc/apache2/apache2.conf reads IncludeOptional mods-enabled/*.load. Not much sign of a syntax error there and I was off on wild goose chases. Notice the > at the end of that line. What I should have done was press the right arrow on the keyboard to see the rest of the error message. It ended:

ules/libphp8.2.so into server: /usr/lib/apache2/modules/libphp8.2.so: cannot open shared object fil>

(Now press q to quit the command.)

root@xxxx:/# ls /usr/lib/apache2/modules lists libphp8.3.so but not libphp8.2.so. No wonder it was failing. The upgrade had installed one version of PHP but configured apache to try to load a different one. So here’s the cure:
root@xxxx:/# a2dismod php8.2
Module php8.2 disabled.
To activate the new configuration, you need to run:
systemctl restart apache2

root@xxxx:/# a2enmod php8.3
Considering dependency mpm_prefork for php8.3:
Considering conflict mpm_event for mpm_prefork:
Considering conflict mpm_worker for mpm_prefork:
Module mpm_prefork already enabled
Considering conflict php5 for php8.3:
Enabling module php8.3.
To activate the new configuration, you need to run:
systemctl restart apache2

root@xxxx:/# systemctl stop apache2
root@xxxx:/# systemctl start apache2
No error messages and webpages are now served.