Restore Fails with timeout

Running the latest ISO install, then from existing PBX (also latest everything ) I execute a full backup.
From the new install restore option I upload the 1.6GB backup file to the new server, at 98.88% uploaded every time I get an http 500 or I got an error code screen once and it said time out ( 30 seconds ).
I never make it to the restore info about the file and to continue with restore or legacy restore.

I need to move this server to its new hardware, but this has me stuck in place.

Any assistance appreciated.

Thanks for the response.
I see the backup & restore has changed slightly, in this case the install did not create a default backup job, so I tried to add it.
In the process I can’t pick a storage location, so that stopped me in my tracks.
I then built the folder structure, assigned security and uploaded the backup job, but it simply doesn’t understand the default folder is there.

Now this was a fresh install and I did NOT activate it, because I know the restore will overwrite everything, and then I would move the previous old hardware activation to this box.

Any ideas?

Note:
On my previous and other systems, I still see Backups/Restore/Servers/Templates options but no on this box.
I also uninstalled backup & restore, then re-installed it with the same results.

When I connected to the server I wiped out the upload folder, and it allowed me to get to the choice of regular or legacy restore, I executed legacy because it identified my brand new backup from a current system as legacy.

The restore process starts, but then fails, which this exact error happened previously.

Running with: /usr/sbin/fwconsole backup --restore='/var/spool/asterisk/backup/uploads/20191108-043035-1573205435-14.0.13.6-1496267766.tgz' --restorelegacycdr --transaction='5b6fdecb-8126-44a0-acea-20f26ff0ad70'

Determining backup file type…type is legacy
Legacy CDR Restore Option: 1
Starting restore job with file: /var/spool/asterisk/backup/uploads/20191108-043035-1573205435-14.0.13.6-1496267766.tgz
Extracting backup…
Backup extracted to /tmp/backup/5b6fdecb-8126-44a0-acea-20f26ff0ad70. These files will remain until a new restore is run or until cleaned manually.
Loading manifest to memory
Loading astdb to memory
Parsing out SQL tables. This may take a moment depending on backup size.
Found 2 database files in the backup.
Legacy CDR Restore Opted. we are processing , It may take long time to process /tmp/backup/5b6fdecb-8126-44a0-acea-20f26ff0ad70/mysql-4.sql.gz
Processing processLegacyCdr ’ zcat /tmp/backup/5b6fdecb-8126-44a0-acea-20f26ff0ad70/mysql-4.sql.gz | mysql -u freepbxuser -piv/KcQb1VbY8 asteriskcdrdb ’ Command is Running now
Processing processLegacyCdr SQL Done…
Installing cdr
Checking if field cnum is present in cdr table…OK!
Checking if field cnam is present in cdr table…OK!
Checking if field outbound_cnum is present in cdr table…OK!
Checking if field outbound_cnam is present in cdr table…OK!
Checking if field dst_cnam is present in cdr table…OK!
Checking if field linkedid is present in cdr table…OK!
Checking if field peeraccount is present in cdr table…OK!
Checking if field sequence is present in cdr table…OK!
Generating CSS…Done
Restored module cdr [FreePBX\modules\Backup\RestoreBase]
Installing cel
Creating cel if needed…OK
checking for extra field…already exists
Checking for userfield field to remove…already removed
Checking for src field to remove…already removed
Checking for dst field to remove…already removed
Checking for channel field to remove…already removed
Checking for dstchannel field to remove…already removed
Checking for context index…already indexed
Generating CSS…Done
Restored module cel [FreePBX\modules\Backup\RestoreBase]
File named: /tmp/backup/5b6fdecb-8126-44a0-acea-20f26ff0ad70/mysql-3.sql.gz
Detected file /tmp/backup/5b6fdecb-8126-44a0-acea-20f26ff0ad70/mysql-3.sql.gz as the PBX (Asterisk) database. Attempting restore
Extracting supplied database file mysql-3.sql.gz
Loading supplied database file mysql-3.sql
SQLSTATE[HY000]: General error: 1 near “COMMENT”: syntax error

Tried a few more things:
I registered the box, restore does the same thing.
I saw the new file store function created a folder and picked that to backup to.
Created a full backup.
Uploaded my backup to the folder and it didn’t even recognize it ( yes owned by asterisk ).
No refresh etc would show the uploaded backup, so I renamed the backup I uploaded to the default backup that was created and got the following error on restore:
FreePBX
Admin
Applications
Connectivity
Dashboard
Reports
Settings
UCP

Search
Backup & Restore
Backup
Restore
Global Settings
Upload your restore files
Backup File
Click to upload a backup file.
0.00%
Restore from local cache
Search

Backup Name
Backup Date
Framework
Actions
default Fri, Nov 8, 2019 8:21 PM 15.0.16.22
Showing 1 to 1 of 1 rows
Restore from the cloud
This feature requires filestore be setup and may not be availible on a clean install
Search

Backup Name
Backup Date
Backup Type
Backup Instance
Actions
20191108-202118-1573262478-15.0.16.22-1289424838.tar.gz Fri, Nov 8, 2019 8:21 PM Local Backup
Showing 1 to 1 of 1 rows
×
Running Local Restore
Running with: /usr/sbin/fwconsole backup --restore=’/var/spool/asterisk/backup/default/20191108-202118-1573262478-15.0.16.22-1289424838.tar.gz’ --transaction=‘da548e54-b399-4ae5-b120-4c9ad399fe32’
Determining backup file type…type is legacy
Legacy CDR Restore Option: 0
Starting restore job with file: /var/spool/asterisk/backup/default/20191108-202118-1573262478-15.0.16.22-1289424838.tar.gz
Extracting backup…
Backup extracted to /tmp/backup/da548e54-b399-4ae5-b120-4c9ad399fe32. These files will remain until a new restore is run or until cleaned manually.
Loading manifest to memory
Loading astdb to memory
Parsing out SQL tables. This may take a moment depending on backup size.
Found 2 database files in the backup.
File named: /tmp/backup/da548e54-b399-4ae5-b120-4c9ad399fe32/mysql-3.sql.gz
Detected file /tmp/backup/da548e54-b399-4ae5-b120-4c9ad399fe32/mysql-3.sql.gz as the PBX (Asterisk) database. Attempting restore
Extracting supplied database file mysql-3.sql.gz
Loading supplied database file mysql-3.sql
SQLSTATE[HY000]: General error: 1 near “COMMENT”: syntax error
FreePBX®FreePBX is a registered trademark of
Sangoma Technologies Inc.
FreePBX 15.0.16.22 is licensed under the GPL
Copyright© 2007-2019www.sangoma.com
Your restore has finished

Not one to shy away from trying multiple things to learn, I went ahead, and erased the uploaded files.
I then did a new backup without CDR’s so it reduced the size of the backup, uploaded and tried to restore again, but it looks like the same result…

Running with: /usr/sbin/fwconsole backup --restore=’/var/spool/asterisk/backup/uploads/20191108-212947-1573266587-14.0.13.6-410927916.tgz’ --restorelegacycdr --transaction=‘19919da0-24e9-4e0c-9e89-e2d9ea8a6e3a’
Determining backup file type…type is legacy
Legacy CDR Restore Option: 1
Starting restore job with file: /var/spool/asterisk/backup/uploads/20191108-212947-1573266587-14.0.13.6-410927916.tgz
Extracting backup…
Backup extracted to /tmp/backup/19919da0-24e9-4e0c-9e89-e2d9ea8a6e3a. These files will remain until a new restore is run or until cleaned manually.
Loading manifest to memory
Loading astdb to memory
Parsing out SQL tables. This may take a moment depending on backup size.
Found 1 database files in the backup.
File named: /tmp/backup/19919da0-24e9-4e0c-9e89-e2d9ea8a6e3a/mysql-3.sql.gz
Detected file /tmp/backup/19919da0-24e9-4e0c-9e89-e2d9ea8a6e3a/mysql-3.sql.gz as the PBX (Asterisk) database. Attempting restore
Extracting supplied database file mysql-3.sql.gz
Loading supplied database file mysql-3.sql
SQLSTATE[HY000]: General error: 1 near “COMMENT”: syntax error

Extract the mysql-3.sql raw file and try

against it

The only sql files I can find in the backup file are as follows.

./var/www/html/admin/modules/callback/install.sql
./var/www/html/admin/modules/conferences/uninstall.sql
./var/www/html/admin/modules/ttsengines/install.sql
./var/www/html/admin/modules/ttsengines/uninstall.sql
./var/www/html/admin/modules/manager/uninstall.sql
./var/www/html/admin/modules/superfecta/includes/oauth-php/library/store/postgresql/pgsql.sql
./var/www/html/admin/modules/superfecta/includes/oauth-php/library/store/mysql/mysql.sql
./var/www/html/admin/modules/superfecta/includes/oauth-php/library/store/oracle/OracleDB/2_Sequences/SEQUENCES.sql
./var/www/html/admin/modules/superfecta/includes/oauth-php/library/store/oracle/OracleDB/1_Tables/TABLES.sql
./var/www/html/admin/modules/ringgroups/uninstall.sql
./var/www/html/admin/modules/phpagiconf/uninstall.sql
./var/www/html/admin/modules/_cache/upload56315da9195ed/fop2/html/admin/install.sql
./var/www/html/admin/modules/_cache/upload56315da9195ed/fop2/html/admin/uninstall.sql
./var/www/html/admin/modules/_cache/upload56315d1b6041f/fop2/html/admin/install.sql
./var/www/html/admin/modules/_cache/upload56315d1b6041f/fop2/html/admin/uninstall.sql
./var/www/html/admin/libraries/Composer/vendor/simplepie/simplepie/db.sql
./var/www/html/admin/libraries/Composer/vendor/symfony/security/Symfony/Component/Security/Acl/Resources/schema/postgresql.sql
./var/www/html/admin/libraries/Composer/vendor/symfony/security/Symfony/Component/Security/Acl/Resources/schema/db2.sql
./var/www/html/admin/libraries/Composer/vendor/symfony/security/Symfony/Component/Security/Acl/Resources/schema/sqlite.sql
./var/www/html/admin/libraries/Composer/vendor/symfony/security/Symfony/Component/Security/Acl/Resources/schema/oracle.sql
./var/www/html/admin/libraries/Composer/vendor/symfony/security/Symfony/Component/Security/Acl/Resources/schema/mssql.sql
./var/www/html/admin/libraries/Composer/vendor/symfony/security/Symfony/Component/Security/Acl/Resources/schema/drizzle.sql
./var/www/html/admin/libraries/Composer/vendor/symfony/security/Symfony/Component/Security/Acl/Resources/schema/mysql.sql
./var/www/html/fop2/admin/install.sql
./var/www/html/fop2/admin/uninstall.sql

This is a bug in backup with COMMENT being inside the MySQL legacy backup file. The MYSQL backup file is correct. FreePBX Backup in 15 just needs to ignore the comment.

1 Like

Thanks Andrew,

How can I proceed / Fix it or bypass it?
I need to restore for a client so time is not on my side…

Taking what @dicko said you need to look in the backup file for the mysql backup file. The files you listed above aren’t any of them. You’d then have to edit that backup file and remove the comment lines.

Alternatively the only module that added comment lines to SQL is Endpoint manager (the OSS one). So you can go back to your old machine and uninstall endpoint manager and make a new backup and it will import successfully.

OSS EPM is NOT installed on the old machine. ( there may be tables from when that was used a long time ago )
by thew way those were the only SQL files.
Thanks!

Not being familiar with the backup file, I do see the reference to mysql-3.sql

:{i:3;a:6:{s:4:“file”;s:14:“mysql-3.sql.gz”;

Should I remove this whole section:
s:4:“file”;s:14:“mysql-3.sql.gz”;

No because then your backup would be 100% useless. You need to drop the endpoint manager tables on the old machine and rebackup. (or any tables with COMMENT)

The SQL file is gzipped (oops sorry for not remembering that). You’ve shown that it exists here:

ANSWER/RESOLUTION:

Thanks for your help @tm1000, @lgaetz, @dicko

So the legacy OSS EPM, was to blame here and while the application was deleted some time ago when it was replaced by EPM, it left 3 tables in the DB.

By deleting those old tables and executing a new backup and restore, everything worked as expected.

It’s an edge case. Please open a bug ticket so backup 15 can deal with it more elegantly.

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