Can't restore from older NCP backup to newer NC version - PHP version incompatible

Support intro

Sorry to hear you’re facing problems. :slightly_frowning_face:

The community help forum (help.nextcloud.com) is for home and non-enterprise users. Support is provided by other community members on a best effort / “as available” basis. All of those responding are volunteering their time to help you.

If you’re using Nextcloud in a business/critical setting, paid and SLA-based support services can be accessed via portal.nextcloud.com where Nextcloud engineers can help ensure your business keeps running smoothly.

Getting help

In order to help you as efficiently (and quickly!) as possible, please fill in as much of the below requested information as you can.

Before clicking submit: Please check if your query is already addressed via the following resources:

(Utilizing these existing resources is typically faster. It also helps reduce the load on our generous volunteers while elevating the signal to noise ratio of the forums otherwise arising from the same queries being posted repeatedly).

Some or all of the below information will be requested if it isn’t supplied; for fastest response please provide as much as you can. :heart:

The Basics

  • Nextcloud Server version (e.g., 29.x.x):
    • restoring from 26.? to 30.0.1
  • Operating system and version (e.g., Ubuntu 24.04):
    • Debian 12
  • Web server and version (e.g, Apache 2.4.25):
    • replace me
  • Reverse proxy and version _(e.g. nginx 1.27.2)
    • replace me
  • PHP version (e.g, 8.3):
    • 8.3, but error says This version of Nextcloud is not compatible with PHP>=8.3. You are currently running 8.3.16.
  • Is this the first time you’ve seen this error? (Yes / No):
    • yes
  • When did this problem seem to first start?
    • power outage killed the VM so restoring from new Debian image, using curl installer
  • Installation method (e.g. AlO, NCP, Bare Metal/Archive, etc.)
    • NCP curl
  • Are you using CloudfIare, mod_security, or similar? (Yes / No)
    • no

Summary of the issue you are facing:

NCP installs and runs fine from curl installer, then PHP error upon restoring from older NCP backup

Secondary but noteworthy is that the data directory seems to be moved to:
/var/www/nextcloud/data/data

Steps to replicate it (hint: details matter!):

  1. I do a clean install of Debian 12, then make a new NextCloud instance using the curl installer from the GitHub. It installs NCP 1.55.3 and NextCloud 30.0.1 without issue.

  2. Mount the host share backups folder, copy it to the guest’s local storage. Restore using the backup .tar.gz. Doesn’t seem to matter if it’s through the web interface or ncp-config

  3. After the restore finishes, it ends with error:
    “This version of Nextcloud is not compatible with PHP>=8.3.
    You are currently running 8.3.16.”

  4. Then I can’t reinitialise, upgrade or downgrade NCP from web or the ncp-config via Terminal due to PHP version errors. I tried downgrading PHP to 8.2 following instructions online, but it only seems to apply to the command line and not the actual website.

Log entries

Nextcloud

Please provide the log entries from your Nextcloud log that are generated during the time of problem (via the Copy raw option from Administration settings->Logging screen or from your nextcloud.log located in your data directory). Feel free to use a pastebin/gist service if necessary.

 nc-restore ] (Sun 02 Feb 2025 14:51:12 AEDT)
check free space...
extracting backup file /home/graeme/nextcloud-bkp_20250129_1738152002.tar.gz...
restore files...
restore database...
backing up existing /var/www/nextcloud/data/data to /var/www/nextcloud/data/data-2025-02-02T1738469895...
restore datadir to /var/www/nextcloud/data/data...
This version of Nextcloud is not compatible with PHP>=8.3.<br/>You are currently running 8.3.16.Cleanup...

[ nc-update-nextcloud ] (Sun 02 Feb 2025 16:46:50 AEDT)
Running as unit: ncp-update-nc.service
Failed to start ncp-update-nc
Nextcloud is currently down
× ncp-update-nc.service - /usr/bin/bash -c set -o pipefail; DBG='' /usr/local/bin/ncp-update-nc.d/update-nc.sh '0' |& tee /var/log/ncp-update-nc.log
     Loaded: loaded (/run/systemd/transient/ncp-update-nc.service; transient)
  Transient: yes
     Active: failed (Result: exit-code) since Sun 2025-02-02 16:46:50 AEDT; 844ms ago
    Process: 110224 ExecStart=/usr/bin/bash -c set -o pipefail; DBG='' /usr/local/bin/ncp-update-nc.d/update-nc.sh '0' |& tee /var/log/ncp-update-nc.log (code=exited, status=1/FAILURE)
   Main PID: 110224 (code=exited, status=1/FAILURE)
        CPU: 164ms

Feb 02 16:46:50 nextcloudpi sudo[110245]:     root : PWD=/var/www ; USER=www-data ; COMMAND=/usr/bin/php -r 'include("/var/www/nextcloud/config/config.php"); echo($CONFIG["datadirectory"]);'
Feb 02 16:46:50 nextcloudpi sudo[110245]: pam_unix(sudo:session): session opened for user www-data(uid=33) by (uid=0)
Feb 02 16:46:50 nextcloudpi sudo[110245]: pam_unix(sudo:session): session closed for user www-data
Feb 02 16:46:50 nextcloudpi sudo[110248]:     root : PWD=/var/www ; USER=www-data ; COMMAND=/usr/bin/php /var/www/nextcloud/occ status
Feb 02 16:46:50 nextcloudpi sudo[110248]: pam_unix(sudo:session): session opened for user www-data(uid=33) by (uid=0)
Feb 02 16:46:50 nextcloudpi sudo[110248]: pam_unix(sudo:session): session closed for user www-data
Feb 02 16:46:50 nextcloudpi bash[110226]: Nextcloud is currently down
Feb 02 16:46:50 nextcloudpi systemd[1]: ncp-update-nc.service: Main process exited, code=exited, status=1/FAILURE
Feb 02 16:46:50 nextcloudpi systemd[1]: ncp-update-nc.service: Failed with result 'exit-code'.
Feb 02 16:46:50 nextcloudpi systemd[1]: Failed to start ncp-update-nc.service - /usr/bin/bash -c set -o pipefail; DBG='' /usr/local/bin/ncp-update-nc.d/update-nc.sh '0' |& tee /var/log/ncp-update-nc.log.

[ nc-init ] (Sun 02 Feb 2025 16:51:48 AEDT)
Setting up a clean Nextcloud instance... wait until message 'NC init done'
Setting up database...
Setting up Nextcloud...
This version of Nextcloud is not compatible with PHP>=8.3.<br/>You are currently running 8.3.16.This version of Nextcloud is not compatible with PHP>=8.3.<br/>You are currently running 8.3.16.sed: can't >
This version of Nextcloud is not compatible with PHP>=8.3.<br/>You are currently running 8.3.16.This version of Nextcloud is not compatible with PHP>=8.3.<br/>You are currently running 8.3.16.This versio>


Web Browser

If the problem is related to the Web interface, open your browser inspector Console and Network tabs while refreshing (reloading) and reproducing the problem. Provide any relevant output/errors here that appear.

PASTE

Web server / Reverse Proxy

The output of your Apache/nginx/system log in /var/log/____:

PASTE HERE

Configuration

Nextcloud

The output of occ config:list system or similar is best, but, if not possible, the contents of your config.php file from /path/to/nextcloud is fine (make sure to remove any identifiable information!):

Gathering information...
PHP Warning:  Undefined variable $CONFIG in Command line code on line 1
PHP Warning:  Trying to access array offset on null in Command line code on line 1
NextcloudPi version  v1.55.3
NextcloudPi image    NextcloudPi_02-02-25
OS                   Debian GNU/Linux 12. 6.1.0-30-arm64 (aarch64)
automount            no
USB devices          sr0 
datadir               (doesn't exist)
rootfs usage         284G/884G
swapfile             /var/swap
dbdir                /var/lib/mysql
Nextcloud check      error
HTTPD service        up
PHP service          up
MariaDB service      up
Redis service        up
HPB service          down
Postfix service      up
Internet check       ok
Public IPv4          xxx.xxx.xxx.xxx
Public IPv6          not found
Port 80              open
Port 443             open
IP                   192.168.xxx.xxx
Gateway              192.168.xxx.xxx
Interface            enp0s1
Certificates         none
NAT loopback         no
Uptime               5:44

PHP Warning:  Undefined variable $CONFIG in Command line code on line 1
PHP Warning:  Trying to access array offset on null in Command line code on line 1

You should run Lets Encrypt for trusted encrypted access

You should enable automount to use your plugged in USB drive
Done. Press any key...

Apps

The output of occ app:list (if possible).

Tips for increasing the likelihood of a response

  • Use the preformatted text formatting option in the editor for all log entries and configuration output.
  • If screenshots are useful, feel free to include them.
    • If possible, also include key error output in text form so it can be searched for.
  • Try to edit log output only minimally (if at all) so that it can be ran through analyzers / formatters by those trying to help you.

You could try thje following:
get rid of the hanging update process

sudo systemctl restart ncp-update-nc.service

then try to update again:

sudo ncp-update-nc

That didn’t work either - I got an error about the ncp-update-nc.service not being able to start. Sorry I don’t have the actual error at the moment.

Would it be worth trying to install an older version like 27 before attempting the restore?

Yes, I think it is worth a trial.

See NCP - Restoring across Nextcloud-Versions

Solved it. Before restoring, I installed and enabled PHP8.2 by adapting the instructions here:
https://www.reddit.com/r/NextCloud/comments/13cqdr1/comment/jjinnp8/

After that, I ran into update issues with /var/www/nextcloud/data/data/tmp not being writable that wouldn’t resolve by chown or chmod. I think that’s why I gave up trying to upgrade from NC26. Thankfully, it still let me move the data-dir through nc-datadir. After that, I was able to update to 26.0.13.1 and then progressively from 26.0.13 to 27 to 28, etc, up to the latest 30.0.5.1.

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