Upgrading Ubuntu 20 to Ubuntu 22 and PHP 8.1


I am currently running ubuntu 20, can I use the ubuntu upgrade commands to upgrade to ubuntu 22 which I assume will also upgrade PHP to the latest stable version or is this not the proper way to upgrade to a compatible PHP version?

My ubuntu install is on a VM, I’ll be taking a snapshot before any upgrade is attempted, but I wanted to ask, first.


Yes, take a snapshot first then upgrade to 22.04 should be enough. Run validate after to make sure :slight_smile:

1 Like

Thank you, starting that process now.

Upgrade completed and server has been rebooted. However, it appears something has broken in the process.

I see librenms as the user and running ‘ls’ shows me all the librenms files, I see validate.php in the list.

When I type ./validate.php and press enter, it returns

/usr/bin/env: ‘php’ : No such file or directory.

When I attempt to launch the web gui, I see ‘502 Bad Gateway
nginx/1.18.0 (Ubuntu)’


I just ran do-release-upgrade on one of my 20.04 servers. Some things were missing after, so I ran the apt install line from the install docs:

apt install acl curl fping git graphviz imagemagick mariadb-client mariadb-server mtr-tiny nginx-full nmap php-cli php-curl php-fpm php-gd php-gmp php-json php-mbstring php-mysql php-snmp php-xml php-zip rrdtool snmp snmpd whois unzip python3-pymysql python3-dotenv python3-redis python3-setuptools python3-systemd python3-pip

I also had to configure the php-fpm pool from the docs, since it already exists, I just copied it:

cp /etc/php/7.4/fpm/pool.d/librenms.conf /etc/php/8.1/fpm/pool.d/librenms.conf
systemctl restart php8.1-fpm

Then run ./daily.sh to switch back to the main release from the support branch (or wait for it to run)

su - librenms

Double check validate for other known issues. I had to fix php timezone too.

If you have any issues compare against the install documentation. I am using nginx+php-fpm.


After running the above two commands, the librenms GUI now loads, big thank you for that!

Running the daily.sh put librenms back to the correct branch and updated the codebase. I ran validate.php and the issue it found was the time being off. Before I edit that I’m going to take another snapshot of this VM because the upgrade took quite some time and I want a new restore point. After that I will correct the time issue.

Thanks again.

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.