Recommended way for upgrading old nextcloud instances on dietpi?

For a Nextcloud instance which has not been updated in a while, I attempted an update. First I ran sudo dietpi-update which updated a lot of apt-based packages and also dietpi it self (now on version 8.24.1).

It did not update nextcloud, but this is expected as it is not apt-based, correct?

So I did research and found this here:

phpenmod phar # The PHP Phar module is required
sudo -u www-data php /var/www/nextcloud/updater/updater.phar

First of all, phpenmod phar result in “phpenmod: command not found” → is it supposed to be sudo phpenmod phar (which returns nothing)?

Anyways, the second line sudo -u www-data php /var/www/nextcloud/updater/updater.phar updated nextcloud from 22.2.0.2 to 22.2.10.2.

And update to newer major version seems not be possible this way. Is this intended? What is the recommended way to update Nextcloud when one or several major release versions are jumped, e.g. 22 → 27 or 28?

Also I looked at this NC guideline for manual upgrades. However, looking at what is described as critical changes, I see for example php ≥8.3 is required (currently php is 7.4). Would I need to update php manually, and if so, before or after NC upgrade? Would I also need to upgrade something else? The web server, or the DB system perhaps? I got both through the dietpi software package 82: LLMP: Lighttpd + MariaDB + PHP

try using NC web interface to perform updates. You need to update to each of the NC releases one by one. This is a behaviour of NC.

What is you current NC release? And can you share some more system details?

Required

  • DietPi version | cat /boot/dietpi/.version
  • Distro version | echo $G_DISTRO_NAME $G_RASPBIAN
  • Kernel version | uname -a
  • Architecture | dpkg --print-architecture
  • SBC model | echo $G_HW_MODEL_NAME or (EG: RPi3)

First, update to latest NC release available on your current OS release. Don’t try to install PHP8 manually as this will lead to issues with NC

Normally you do system maintenance as root user, so no sudo is needed. But you are right, the phpenmod only returns a message if the module you wanna try to activate does not exist.
And it’s a manual update, not an upgrade. If you wanna manually upgrade to a newer major version, you can follow the Nextcloud docs, but it’s less a hassle with the web updater.

But let’s see what the additional system info will show, maybe you are not able to upgrade to a newer major version causes of some system limitation.

Would be quite a reasonable task to add sudo to all commands in the docs. It does not hurt when you are root already. Also not everyone knows how to use sudo correctly in all cases, e.g. when aiming to write to a file:

echo 'another line' > /path/to/file

=> this does not work:

sudo echo 'another line' > /path/to/file

The way to upgrade via

sudo -u www-data php /var/www/nextcloud/updater/updater.phar

IMO is best, as it is not hard aborted when e.g. the network connection between browser and server is lost, or just the tab closed accidentally. The phar module should be enabled OOTB so that phpenmod should not be required (but failsafe).

The NC currently is 22.2.10.2

here is the output:

dietpi@pipi:~$ cat /boot/dietpi/.version
G_DIETPI_VERSION_CORE=8
G_DIETPI_VERSION_SUB=24
G_DIETPI_VERSION_RC=1
G_GITBRANCH='master'
G_GITOWNER='MichaIng'
dietpi@pipi:~$ echo $G_DISTRO_NAME $G_RASPBIAN
bullseye 0
dietpi@pipi:~$ uname -a
Linux pipi 6.1.21-v8+ #1642 SMP PREEMPT Mon Apr  3 17:24:16 BST 2023 aarch64 GNU/Linux
dietpi@pipi:~$ dpkg --print-architecture
arm64
dietpi@pipi:~$ echo $G_HW_MODEL_NAME
RPi 4 Model B (aarch64)

You need to update step by step. NC release by NC release. You can’t jump from 22 to 27 in a single step.

Following is not offering further updates anymore?

I didn’t know about this step by step procedure. I only ran the command once and it updated from 22.2.0.2 to 22.2.10.2
So, I will try again and let you know.

Thanks for the tip! I now ran sudo -u www-data php /var/www/nextcloud/updater/updater.phar again, and again, etc.

There were more updates being installed:

22.2.10.2 → 23.0.12 → 24.0.12 → 25.0.13

Repeating the command after the last update results in

Nextcloud Updater - version: v25.0.11-5-g06c1bad
Current version is 25.0.13.
No update available.
Nothing to do.

Does this mean the 26.x.x… and the 27.x.x… versions are only beta versions as of now?

As next, you should update your system to bookworm.
See Debian Bookworm has been released – DietPi Blog for a description of the procedure.

1 Like

Nextcloud 26 needs PHP 8.0 or newer, which debian bullseye does not provide.

Yes upgrade to Bookworm would be next step.