RetroCode UK

Published Date May 7, 2021 Reading Time ~2 minutes RSS Feed Linux Nextcloud

NextCloud - Failing to Update News

I recently had an issue following an update on my Debian installation of NextCloud.

Attempting to run the crontab task from the command line revealed the problem (info about crontab for NextCloud):

sudo -u www-data php -f /var/www/nextcloud/cron.php

This version of Nextcloud is not compatible with > PHP 7.4.<br/>You are currently running 8.0.5.

The first thing I attempted was to remove PHP 8:

sudo apt remove php*
sudo apt remove libapache2-mod-php

Then I re-installed all the necessary PHP 7.4 modules:

sudo apt install libapache2-mod-php7.4 php7.4-gd php7.4-mysql php7.4-curl php7.4-mbstring php7.4-intl php7.4-gmp php7.4-bcmath php-imagick php7.4-xml php7.4-zip

This next step wasn’t necessary, but in case of any potential conflicts, I also removed the PHP8 configurations from Apache:

# Check for HTTP configurations
find /etc/apache2/ -name '*php*'
sudo rm /etc/apache2/mods-available/php8.0.*

Following all this, and a reboot, I ended up with a NextCloud instance that was now failing with an “Internal Server Error” which prompted to check the logs. One way to check what logs are affected is to:

  1. Run sudo touch /tmp/foobar
  2. Reload the NextCloud page to trigger any error again
  3. sudo find / -regextype posix-extended -regex "/(sys|srv|proc|dev)" -prune -o -newer /tmp/foobar

Unfortunately this did not list any error logs, and attempting to update the loglevel to 0 (for most verbose) by editing the file /var/www/nextcloud/config/config.php did not reveal anything either.

My next thought was that perhaps there was a problem with the Let’s Encrypt certificate, as it needs to be periodically updated.

The warning message in the logs read AH01909: server certificate does NOT include an ID which matches the server name.

To update the certificate run sudo certbot renew. However in my case the certificate was still valid, and the warning wasn’t something that I needed to be concerned about.

Finally, after some digging, I recalled that I had enabled memcache. This meant that there was another PHP module that I needed to re-install:

sudo apt install php7.4-apcu
sudo systemctl restart apache2

Finally it’s working again, and the newsfeeds are again working correctly! It’s a little frustrating that there didn’t appear to be any meaningful error messages to go on, but it was solved reasonably quickly.