[SOLVED] Restoring Nextcloud from backup fails

What type of hardware are you using: VPS bought online
What YunoHost version are you running: 12.0.11
What app is this about: Nextcloud 29.0.10~ynh2

Describe your issue

Uninstalled Nextcloud prior to migration to hopefully avoid MySQL issues encountered in a different migration I did. Migration completed with some issues. Now attempting to restore Nextcloud from backup and getting an error message almost immediately, as shown below.

Here’s the full log report: https://paste.yunohost.org/raw/ucofivacul

I’ll include the good bits below.

The resolution was the same as that described in this entry: I accessed the backup tar file using vim and deleted the first line of the db.sql file. Once I did that, the restoration succeeded without issue. (I don’t actually need to post this entry but just in case someone else has this issue…)

Share relevant logs or error messages

Warning: Here's an extract of the logs before the crash. It might help debugging the error:                                                                                                 
Info: DEBUG - + [[ 4096  -le 500000000 ]]                                                                                                                                                   
Info: DEBUG - ++ date +%Y%m%d.%H%M%S                                                                                                                                                        
Info: DEBUG - + local backup_file=/var/cache/yunohost/appconfbackup//var/www/nextcloud.backup.20250302.073739                                                                               
Info: DEBUG - ++ dirname /var/cache/yunohost/appconfbackup//var/www/nextcloud.backup.20250302.073739                                                                                        
Info: DEBUG - + mkdir --parents /var/cache/yunohost/appconfbackup//var/www                                                                                                                  
Info: DEBUG - + mv /var/www/nextcloud /var/cache/yunohost/appconfbackup//var/www/nextcloud.backup.20250302.073739                                                                           
Info: DEBUG - ++ dirname /var/www/nextcloud                                                                                                                                                 
Info: DEBUG - + mkdir --parents /var/www                                                                                                                                                    
Info: DEBUG - + mountpoint --quiet /home/yunohost.backup/tmp/20250222-060352                                                                                                                
Info: DEBUG - + mv /home/yunohost.backup/tmp/20250222-060352/apps/nextcloud/backup/var/www/nextcloud /var/www/nextcloud                                                                     
Info: DEBUG - + [[ /var/www/nextcloud == \/\e\t\c\/\n\g\i\n\x\/\c\o\n\f\.\d\/* ]]                                                                                                           
Info: INFO - [++..................] > Restoring the MySQL database...                                                                                                                       
Info: DEBUG - + ynh_mysql_connect_as --user=nextcloud --password=********** --database=nextcloud --default_character_set=utf8mb4                                                            
Info: DEBUG - + database=nextcloud                                                                                                                                                          
Info: DEBUG - + default_character_set=utf8mb4
Info: DEBUG - + '[' -n utf8mb4 ']'
Info: DEBUG - + default_character_set=--default-character-set=utf8mb4
Info: DEBUG - + mysql --user=nextcloud --password=********** --default-character-set=utf8mb4 --batch nextcloud
Info: WARNING - ERROR at line 1: Unknown command '\-'.
Info: DEBUG - + ynh_exit_properly
Info: Removing nextcloud…
2 Likes

Hi wraidd,

Good that you found a solution!

I delved a bit into the cause for that first line. There was a security patch on MariaDB a while back, which adds the mentioned sandbox mode. The client needs to be new enough to have the patch incorperated, or it will break on the unknown command.

More details in a MariaDB blogpost.

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