User Tools

Site Tools

unix:linux:debian:devuan_sury breaks Devuan


In February 2020, the “go to” place to do multiple PHP installations on Debian based servers decided to create a dependency for system-d to the package. Installing or upgrading a Devuan system that used this site would result in an unusable web server. The package maintainer, who has been doing this work faithfully for almost a decade and whom the community owes a debt of gratitude to for his hard work, determined that the package for Debian based systems would not be changed; systemd would be required for any packages installed with his site as a source.

One of the users at Devuan has taken the original packages, modified them so they do not need systemd, and created a secondary location where the packages can be installed from. If you are using a non-systemd system, you will want to convert to this new site before you perform your new update. I will update this page for more details, but the following code will do this. Basically, change /etc/apt/sources.list.d/php.list to hold the packages form See links at the bottom of this article for more information.

These instructions were written for devuan ascii and php 7.4, but are applicable for more recent versions of Devuan and PHP. NOTE: you can also downgrade if you want; you can install versions as far back as PHP 5.6.

Set up PHP repository

To verify sury is being used for PHP, execute the following. If it returns any values, you have it set up and need to fix it. If not, you may be using it but not have used the default setup.

grep sury  /etc/apt/sources.list.d/php.list

If the above returns any lines, you are currently set up to use, and need to convert to The following script will work for new installs or existing installs. It assumes any existing additional php installations are defined in /etc/apt/sources.list.d/php.list, and renames if it exists.

# get apt-transport-https if it is not installed
apt install apt-transport-https gnupg
# download key using wget and sending to stdout, then add using apt-key
wget -qO - | apt-key add -
# If php.list exists, move it to php.list.disabled
if [ -e /etc/apt/sources.list.d/php.list ] ; then mv /etc/apt/sources.list.d/php.list  /etc/apt/sources.list.d/php.list.disabled ; fi
# create new list file. Change lsb_release -sc gets the code name to whatever your release is
echo deb `lsb_release -sc` main > /etc/apt/sources.list.d/php.list
echo deb-src `lsb_release -sc` main >> /etc/apt/sources.list.d/php.list
# update
apt update

The following will install various versions of PHP. This is taken from the excellent article at


PHP 7.4

apt -y install php7.4 php7.4-cli php7.4-cgi php7.4-fpm php7.4-gd php7.4-mysql php7.4-imap php7.4-curl php7.4-intl php7.4-pspell php7.4-sqlite3 php7.4-tidy php7.4-xmlrpc php7.4-xsl php7.4-zip php7.4-mbstring php7.4-soap php7.4-opcache libonig5 php7.4-common php7.4-json php7.4-readline php7.4-xml

PHP 8.0

apt -y install php8.0 php8.0-cli php8.0-cgi php8.0-fpm php8.0-gd php8.0-mysql php8.0-imap php8.0-curl php8.0-intl php8.0-pspell php8.0-sqlite3 php8.0-tidy php8.0-xsl php8.0-zip php8.0-mbstring php8.0-soap php8.0-opcache libonig5 php8.0-common php8.0-readline php8.0-xml

PHP 8.1

apt -y install php8.1 php8.1-cli php8.1-cgi php8.1-fpm php8.1-gd php8.1-mysql php8.1-imap php8.1-curl php8.1-intl php8.1-pspell php8.1-sqlite3 php8.1-tidy php8.1-xsl php8.1-zip php8.1-mbstring php8.1-soap php8.1-opcache libonig5 php8.1-common php8.1-readline php8.1-xml

Clean Up

After installing, the newest version of PHP will be set as default for many things. This will break some applications, specifically ISPConfig3 and older versions of Nextcloud.

To allow you to reset the defaults, issue the following commands and choose the appropriate version of PHP.

update-alternatives --config php
update-alternatives --config php-cgi

Finally, restart all of the fpm packages you installed.

service php7.4-fpm restart
service php8.0-fpm restart
service php8.1-fpm restart


Invalid Key

tdrnetworks sometimes does not update their gpg key, causing the upgrades to fail. The quick and dirty way around it is to set that entry as “trusted.”

edit /etc/apt/sources.list.d/php.list

deb [trusted=yes] beowulf main

This will turn off https, and set the domain to be trusted, so it will give a warning, but not an error.

If you have used this entry before with apt. a cache will be stored on the system, and must be removed with.

rm /var/lib/apt/lists/*

The next time you apt update, it will rebuild that. missing

I found that when the new repository is used, it will have more recent versions of some of the existing php modules and will update them. Occasionally, I've found that, on Debian/Devuan systems, the library does not appear to be installed, and I end up with an error message like:

PHP Warning: PHP Startup: Unable to load dynamic library '' (tried: /usr/lib/php/20180731/ (/usr/lib/php/20180731/ undefined symbol: zif_apcu_store), /usr/lib/php/20180731/ (/usr/lib/php/20180731/ cannot open shared object file: No such file or directory)) in Unknown on line 0

The solution is to find which PHP version does not have the apcu module installed, then install it. The following BASH script will look for all versions of PHP and try to run them (using the -v, or version flag). Look for the one that gives you an error. This can be copied and pasted directly into the command line.

#! /usr/bin/env bash
for version in $(/usr/sbin/phpquery -V)
   echo ========
   echo Testing Version ${version}
   php${version} -v

In my case, PHP 7.3 gave an error message, and 7.4 and 8.0 did not. So

apt install php7.3-apcu

fixed the problem.


unix/linux/debian/devuan_sury.txt · Last modified: 2023/03/14 21:13 by rodolico