nextcloudpi icon indicating copy to clipboard operation
nextcloudpi copied to clipboard

Restore broken ncp-restore MariaDB Dump 999999 sandbox invalid command / at line 1

Open marco-aa opened this issue 1 year ago • 1 comments

Hello,

restoring my full ncp-backup from NextcloudPi 1.55.3 on arm32 bulleseye on NextcloudPi v1.55.3 - v24.11.1 for Raspberry Pi 4 running Armbian Linux 6.6.63-current-bcm2711 stopped.

My files had been restored. The backup was broken while restoring db-dump with "... invalid command at line 1".

If found Compatibility Change the current Armbian with Bookworm is running mariadb 10.11.6-0+deb12u1, as wirtten in the link, the client does not know the 1st line "/999999.*sandbox", my old arm32 version had this security feature implemented, the version 10.11.6 is missing it.

My workaround was patching /usr/local/bin/ncp-restore with as suggested in the link comments.

sed -i '1{/999999.sandbox/d}' "$TEMPDIR"/nextcloud-sqlbkp_.bak

sed -i '1{/999999.*sandbox/d}' "$TEMPDIR"/nextcloud-sqlbkp_*.bak
mysql -u root nextcloud <  "$TEMPDIR"/nextcloud-sqlbkp_*.bak || { echo "Error restoring nextcloud database"; exit 1; }

## RESTORE DATADIR 

I'll leave this information here, if some one has the same problem. For me we can close this issue ;-)

I'm not sure (it's a rare case) if it's worth to be fixed.

marco-aa avatar Jan 18 '25 15:01 marco-aa

Hello, I think this should be fixed as I also ran into this error using ncp-restore (see here).

ncp-backup with RPI 4 and NextcloudPi v1.55.3. ncp-restore with RPI 5 and image NextcloudPi_RaspberryPi5_v1.55.3.zip. Log: Running nc-restore Cannot load Zend OPcache - it was already loaded check free space... extracting backup file /media/myCloudDrive/ncpexports/nextcloud-bkp_20250222_1740189605.tar.gz... restore files... Restoring old '/var/www/nextcloud/data' to '/var/www/nextcloud/data'... restore database... ERROR at line 1: Unknown command '-'. Error restoring nextcloud database Cleanup... Done. Press any key...

First two lines of nextcloud-sqlbkp_20250222.bak: /*M!999999- enable the sandbox mode */ -- MariaDB dump 10.19 Distrib 10.5.26-MariaDB, for debian-linux-gnu (aarch64)

schuck23 avatar Apr 16 '25 18:04 schuck23