Ticket #5021 (closed Bugs: fixed)

Opened 2 years ago

Last modified 2 years ago

Remote Backup fails: No such file or directory

Reported by: imcdona Assigned to:
Priority: major Milestone: 2.9
Component: Backup & Restore Version: 2.9-branch
Keywords: backup sync restore Cc:
Confirmation: Need testing Distro:
Backend Engine: All Distro Ver:
Backend Ver: SVN Revision (if applicable):

Description (Last modified by p_lindheimer)

I was able to synchronize two of my servers prior to updating to 2.9. When I try and sync the two servers via the backup module the data from the primary servers is not synced to the backup server. It looks like a path is /backups/Sync when it should be /var/lib/asterisk/backups/Sync

/var/log/httpd/error_log has the following:

scp: /backups/Sync/10.120.5.22.20110329.00.33.49.tar.gz: No such file or directory
/bin/tar: /var/lib/asterisk/backups/Sync/10.120.5.22.20110329.00.33.49.tar.gz: Cannot open: No such file or directory
/bin/tar: Error is not recoverable: exiting now
/bin/tar: Child returned status 2
/bin/tar: /tmp/ampbackups.10.120.5.22.20110329.00.33.49/voicemail.tar.gz: Not found in archive
/bin/tar: Error exit delayed from previous errors

gzip: stdin: unexpected end of file
/bin/tar: Child returned status 1
/bin/tar: Error exit delayed from previous errors
/bin/tar: /var/lib/asterisk/backups/Sync/10.120.5.22.20110329.00.33.49.tar.gz: Cannot open: No such file or directory
/bin/tar: Error is not recoverable: exiting now
/bin/tar: Child returned status 2
/bin/tar: /tmp/ampbackups.10.120.5.22.20110329.00.33.49/recordings.tar.gz: Not found in archive
/bin/tar: Error exit delayed from previous errors

gzip: stdin: unexpected end of file
/bin/tar: Child returned status 1
/bin/tar: Error exit delayed from previous errors
/bin/tar: /var/lib/asterisk/backups/Sync/10.120.5.22.20110329.00.33.49.tar.gz: Cannot open: No such file or directory
/bin/tar: Error is not recoverable: exiting now
/bin/tar: Child returned status 2
/bin/tar: /tmp/ampbackups.10.120.5.22.20110329.00.33.49/configurations.tar.gz: Not found in archive
/bin/tar: Error exit delayed from previous errors

gzip: stdin: unexpected end of file
/bin/tar: Child returned status 1
/bin/tar: Error exit delayed from previous errors
/bin/tar: /var/lib/asterisk/backups/Sync/10.120.5.22.20110329.00.33.49.tar.gz: Cannot open: No such file or directory
/bin/tar: Error is not recoverable: exiting now
/bin/tar: Child returned status 2
/bin/tar: /tmp/ampbackups.10.120.5.22.20110329.00.33.49/fop.tar.gz: Not found in archive
/bin/tar: /tmp/ampbackups.10.120.5.22.20110329.00.33.49/cdr.tar.gz: Not found in archive
/bin/tar: Error exit delayed from previous errors

gzip: stdin: unexpected end of file
/bin/tar: Child returned status 1
/bin/tar: Error exit delayed from previous errors
/bin/tar: /var/lib/asterisk/backups/Sync/10.120.5.22.20110329.00.33.49.tar.gz: Cannot open: No such file or directory
/bin/tar: Error is not recoverable: exiting now
/bin/tar: Child returned status 2
/bin/tar: /tmp/ampbackups.10.120.5.22.20110329.00.33.49/asterisk.sql: Not found in archive
/bin/tar: /tmp/ampbackups.10.120.5.22.20110329.00.33.49/asteriskcdr.sql: Not found in archive
/bin/tar: /tmp/ampbackups.10.120.5.22.20110329.00.33.49/astdb.dump: Not found in archive
/bin/tar: Error exit delayed from previous errors
sh: /tmp/ampbackups.10.120.5.22.20110329.00.33.49/asterisk.sql: No such file or directory
sh: /tmp/ampbackups.10.120.5.22.20110329.00.33.49/asteriskcdr.sql: No such file or directory
/bin/tar: /var/lib/asterisk/backups/Sync/10.120.5.22.20110329.00.33.49.tar.gz: Cannot open: No such file or directory
/bin/tar: Error is not recoverable: exiting now
/bin/tar: Child returned status 2
/bin/tar: /tmp/ampbackups.10.120.5.22.20110329.00.33.49/phoneconfig.tar.gz: Not found in archive
/bin/tar: Error exit delayed from previous errors

gzip: stdin: unexpected end of file
/bin/tar: Child returned status 1
/bin/tar: Error exit delayed from previous errors

Change History

03/29/11 02:24:29 changed by imcdona

Properly formatted log entry:

scp: /backups/Sync/10.120.5.22.20110329.00.33.49.tar.gz: No such file or directory
/bin/tar: /var/lib/asterisk/backups/Sync/10.120.5.22.20110329.00.33.49.tar.gz: Cannot open: No such file or directory
/bin/tar: Error is not recoverable: exiting now
/bin/tar: Child returned status 2
/bin/tar: /tmp/ampbackups.10.120.5.22.20110329.00.33.49/voicemail.tar.gz: Not found in archive
/bin/tar: Error exit delayed from previous errors

gzip: stdin: unexpected end of file
/bin/tar: Child returned status 1
/bin/tar: Error exit delayed from previous errors
/bin/tar: /var/lib/asterisk/backups/Sync/10.120.5.22.20110329.00.33.49.tar.gz: Cannot open: No such file or directory
/bin/tar: Error is not recoverable: exiting now
/bin/tar: Child returned status 2
/bin/tar: /tmp/ampbackups.10.120.5.22.20110329.00.33.49/recordings.tar.gz: Not found in archive
/bin/tar: Error exit delayed from previous errors

gzip: stdin: unexpected end of file
/bin/tar: Child returned status 1
/bin/tar: Error exit delayed from previous errors
/bin/tar: /var/lib/asterisk/backups/Sync/10.120.5.22.20110329.00.33.49.tar.gz: Cannot open: No such file or directory
/bin/tar: Error is not recoverable: exiting now
/bin/tar: Child returned status 2
/bin/tar: /tmp/ampbackups.10.120.5.22.20110329.00.33.49/configurations.tar.gz: Not found in archive
/bin/tar: Error exit delayed from previous errors

gzip: stdin: unexpected end of file
/bin/tar: Child returned status 1
/bin/tar: Error exit delayed from previous errors
/bin/tar: /var/lib/asterisk/backups/Sync/10.120.5.22.20110329.00.33.49.tar.gz: Cannot open: No such file or directory
/bin/tar: Error is not recoverable: exiting now
/bin/tar: Child returned status 2
/bin/tar: /tmp/ampbackups.10.120.5.22.20110329.00.33.49/fop.tar.gz: Not found in archive
/bin/tar: /tmp/ampbackups.10.120.5.22.20110329.00.33.49/cdr.tar.gz: Not found in archive
/bin/tar: Error exit delayed from previous errors

gzip: stdin: unexpected end of file
/bin/tar: Child returned status 1
/bin/tar: Error exit delayed from previous errors
/bin/tar: /var/lib/asterisk/backups/Sync/10.120.5.22.20110329.00.33.49.tar.gz: Cannot open: No such file or directory
/bin/tar: Error is not recoverable: exiting now
/bin/tar: Child returned status 2
/bin/tar: /tmp/ampbackups.10.120.5.22.20110329.00.33.49/asterisk.sql: Not found in archive
/bin/tar: /tmp/ampbackups.10.120.5.22.20110329.00.33.49/asteriskcdr.sql: Not found in archive
/bin/tar: /tmp/ampbackups.10.120.5.22.20110329.00.33.49/astdb.dump: Not found in archive
/bin/tar: Error exit delayed from previous errors
sh: /tmp/ampbackups.10.120.5.22.20110329.00.33.49/asterisk.sql: No such file or directory
sh: /tmp/ampbackups.10.120.5.22.20110329.00.33.49/asteriskcdr.sql: No such file or directory
/bin/tar: /var/lib/asterisk/backups/Sync/10.120.5.22.20110329.00.33.49.tar.gz: Cannot open: No such file or directory
/bin/tar: Error is not recoverable: exiting now
/bin/tar: Child returned status 2
/bin/tar: /tmp/ampbackups.10.120.5.22.20110329.00.33.49/phoneconfig.tar.gz: Not found in archive
/bin/tar: Error exit delayed from previous errors

gzip: stdin: unexpected end of file
/bin/tar: Child returned status 1
/bin/tar: Error exit delayed from previous errors


04/06/11 17:38:24 changed by p_lindheimer

not sure if the following is really related but if you get a chance, try the following patch and see if it makes a difference:

Index: ampbackup.php
===================================================================
--- ampbackup.php	(revision 11958)
+++ ampbackup.php	(working copy)
@@ -77,8 +77,7 @@
 	chmod($opts['remotesshkey'],0400);
 	$user=(isset($opts['remotesshuser']) && $opts['remotesshuser']!='')?$opts['remotesshuser'].'\@':'';
 	$exec='/usr/bin/ssh -o StrictHostKeyChecking=no -i '.$opts['remotesshkey'].' '.$user.$opts['remotesshhost'];
-	$exec.=' \'. /usr/sbin/amportal;';
-	$exec.='$ASTVARLIBDIR/bin/ampbackup.php cli ';
+	$exec.=$amp_conf['$ASTVARLIBDIR'] . '/bin/ampbackup.php cli ';
 	foreach($opts as $key => $val){
 		switch($key){
 			case 'remotesshhost':
@@ -99,7 +98,7 @@
 				break;
 		}
 	}
-	$exec.='; echo $ASTVARLIBDIR';
+	$exec.='; echo '. $amp_conf['ASTVARLIBDIR'];
 	$exec.='\'';
 	exec($exec,$rbudir,$execok);
 	//if the ssh completed with exit code 0, copy backup over to this server

04/07/11 01:17:35 changed by jmordica

This patch did not work for me. 2.9rc1.1 on both servers. Before the patch the backup would be created on the primary server but not restore the secondary server. After the patch, nothing happens.

04/08/11 13:30:24 changed by p_lindheimer

  • description changed.

04/08/11 13:37:12 changed by p_lindheimer

is that error log from the primary server or from the backup server?

04/08/11 13:39:20 changed by imcdona

The log entry I posted was from the backup server.

04/08/11 14:30:34 changed by p_lindheimer

  • confirmation changed from Unreviewed to Need testing.

ok take two, can you try this patch, there was an obvious bug in the above:

Index: ampbackup.php
===================================================================
--- ampbackup.php	(revision 11975)
+++ ampbackup.php	(working copy)
@@ -77,8 +77,7 @@
 	chmod($opts['remotesshkey'],0400);
 	$user=(isset($opts['remotesshuser']) && $opts['remotesshuser']!='')?$opts['remotesshuser'].'\@':'';
 	$exec='/usr/bin/ssh -o StrictHostKeyChecking=no -i '.$opts['remotesshkey'].' '.$user.$opts['remotesshhost'];
-	$exec.=' \'. /usr/sbin/amportal;';
-	$exec.='$ASTVARLIBDIR/bin/ampbackup.php cli ';
+	$exec.=' \'' . $amp_conf['$ASTVARLIBDIR'] . '/bin/ampbackup.php cli ';
 	foreach($opts as $key => $val){
 		switch($key){
 			case 'remotesshhost':
@@ -99,7 +98,7 @@
 				break;
 		}
 	}
-	$exec.='; echo $ASTVARLIBDIR';
+	$exec.='; echo '. $amp_conf['ASTVARLIBDIR'];
 	$exec.='\'';
 	exec($exec,$rbudir,$execok);
 	//if the ssh completed with exit code 0, copy backup over to this server

04/08/11 15:36:19 changed by imcdona

I copied the patch to a file called "patch.diff" and did a "patch -p0 < patch.diff" and for the file to patch I specified "modules/backup/bin/ampbackup.php". When I open the backup job that syncs the server and click submit changes to run the job it immediately takes me back to the backup module without doing anything.

Did I apply the patch correctly?

04/08/11 15:38:46 changed by imcdona

Forgot to include error_log

gzip: stdin: unexpected end of file
/bin/tar: Child returned status 1
/bin/tar: Error exit delayed from previous errors
/bin/tar: /var/lib/asterisk/backups/Sync/10.120.5.22.20110408.14.37.57.tar.gz: Cannot open: No such file or directory
/bin/tar: Error is not recoverable: exiting now
/bin/tar: Child returned status 2
/bin/tar: /tmp/ampbackups.10.120.5.22.20110408.14.37.57/asterisk.sql: Not found in archive
/bin/tar: /tmp/ampbackups.10.120.5.22.20110408.14.37.57/asteriskcdr.sql: Not found in archive
/bin/tar: /tmp/ampbackups.10.120.5.22.20110408.14.37.57/astdb.dump: Not found in archive
/bin/tar: Error exit delayed from previous errors
sh: /tmp/ampbackups.10.120.5.22.20110408.14.37.57/asterisk.sql: No such file or directory
sh: /tmp/ampbackups.10.120.5.22.20110408.14.37.57/asteriskcdr.sql: No such file or directory
/bin/tar: /var/lib/asterisk/backups/Sync/10.120.5.22.20110408.14.37.57.tar.gz: Cannot open: No such file or directory
/bin/tar: Error is not recoverable: exiting now
/bin/tar: Child returned status 2
/bin/tar: /tmp/ampbackups.10.120.5.22.20110408.14.37.57/phoneconfig.tar.gz: Not found in archive
/bin/tar: Error exit delayed from previous errors

gzip: stdin: unexpected end of file
/bin/tar: Child returned status 1
/bin/tar: Error exit delayed from previous errors

04/08/11 16:08:18 changed by p_lindheimer

don't know, just try grabbing the whole file from svn and replace yours with it.

04/12/11 03:50:27 changed by mbrevda

(In [11991]) re #5021 - edit ampbackup.php so that it uses know dur paths, as there is no need to guess anymore. UNTESTED!

04/12/11 04:01:45 changed by mbrevda

imcdona, please grab the latest revision of the backup script, it should have the above patch (in a working form :-) ) plus a bit more, and put it in your asterisk/bin directory (generally /var/lib/asterisk/bin). Run amportal chown, then try running your backup again.

04/12/11 13:49:21 changed by jmordica

mbrevda, The latest revision actually worked! Somewhat.. The backup file got copied over to the secondary server but the secondary server didn't actually restore. You have to click restore from backup and select the file that was copied over.

04/12/11 17:59:30 changed by mbrevda

jmordica, Please run the backup from the cli and see if there are any error messages. To do so, go to the backup page in FreePBX, select the backup set and then note the id number - its the part after &id= in the url. Then from the cli, run:

/var/lib/asterisk/bin/ampbackup.php ID_NUM

04/28/11 07:01:56 changed by mbrevda

(In [12059]) re #5021 - mostly cosmetic and sanity changes

05/02/11 01:24:44 changed by imcdona

I updated both servers with the latest code (2.9.0.2) and am still having the same issue. A tail of: /var/log/httpd/error_log

scp: /backups/Sync/10.120.5.22.20110502.00.10.58.tar.gz: No such file or directory
/bin/tar: /var/lib/asterisk/backups/Sync/10.120.5.22.20110502.00.10.58.tar.gz: Cannot open: No such file or directory
/bin/tar: Error is not recoverable: exiting now
/bin/tar: Child returned status 2
/bin/tar: /tmp/ampbackups.10.120.5.22.20110502.00.10.58/voicemail.tar.gz: Not found in archive
/bin/tar: Error exit delayed from previous errors

gzip: stdin: unexpected end of file
/bin/tar: Child returned status 1
/bin/tar: Error exit delayed from previous errors
/bin/tar: /var/lib/asterisk/backups/Sync/10.120.5.22.20110502.00.10.58.tar.gz: Cannot open: No such file or directory
/bin/tar: Error is not recoverable: exiting now
/bin/tar: Child returned status 2
/bin/tar: /tmp/ampbackups.10.120.5.22.20110502.00.10.58/recordings.tar.gz: Not found in archive
/bin/tar: Error exit delayed from previous errors

gzip: stdin: unexpected end of file
/bin/tar: Child returned status 1
/bin/tar: Error exit delayed from previous errors
/bin/tar: /var/lib/asterisk/backups/Sync/10.120.5.22.20110502.00.10.58.tar.gz: Cannot open: No such file or directory
/bin/tar: Error is not recoverable: exiting now
/bin/tar: Child returned status 2
/bin/tar: /tmp/ampbackups.10.120.5.22.20110502.00.10.58/configurations.tar.gz: Not found in archive
/bin/tar: Error exit delayed from previous errors

gzip: stdin: unexpected end of file
/bin/tar: Child returned status 1
/bin/tar: Error exit delayed from previous errors
/bin/tar: /var/lib/asterisk/backups/Sync/10.120.5.22.20110502.00.10.58.tar.gz: Cannot open: No such file or directory
/bin/tar: Error is not recoverable: exiting now
/bin/tar: Child returned status 2
/bin/tar: /tmp/ampbackups.10.120.5.22.20110502.00.10.58/fop.tar.gz: Not found in archive
/bin/tar: /tmp/ampbackups.10.120.5.22.20110502.00.10.58/cdr.tar.gz: Not found in archive
/bin/tar: Error exit delayed from previous errors

gzip: stdin: unexpected end of file
/bin/tar: Child returned status 1
/bin/tar: Error exit delayed from previous errors
/bin/tar: /var/lib/asterisk/backups/Sync/10.120.5.22.20110502.00.10.58.tar.gz: Cannot open: No such file or directory
/bin/tar: Error is not recoverable: exiting now
/bin/tar: Child returned status 2
/bin/tar: /tmp/ampbackups.10.120.5.22.20110502.00.10.58/asterisk.sql: Not found in archive
/bin/tar: /tmp/ampbackups.10.120.5.22.20110502.00.10.58/asteriskcdr.sql: Not found in archive
/bin/tar: /tmp/ampbackups.10.120.5.22.20110502.00.10.58/astdb.dump: Not found in archive
/bin/tar: Error exit delayed from previous errors
sh: /tmp/ampbackups.10.120.5.22.20110502.00.10.58/asterisk.sql: No such file or directory
sh: /tmp/ampbackups.10.120.5.22.20110502.00.10.58/asteriskcdr.sql: No such file or directory
/bin/tar: /var/lib/asterisk/backups/Sync/10.120.5.22.20110502.00.10.58.tar.gz: Cannot open: No such file or directory
/bin/tar: Error is not recoverable: exiting now
/bin/tar: Child returned status 2
/bin/tar: /tmp/ampbackups.10.120.5.22.20110502.00.10.58/phoneconfig.tar.gz: Not found in archive
/bin/tar: Error exit delayed from previous errors

gzip: stdin: unexpected end of file
/bin/tar: Child returned status 1
/bin/tar: Error exit delayed from previous errors

05/02/11 02:42:54 changed by mbrevda

2.9.0.2 is the latest PUBLISHED version - yet its 4 months old. The changes from last week can be manually downloaded here

05/04/11 17:54:49 changed by mbrevda

  • status changed from new to closed.
  • resolution set to fixed.

Closing as fixed, reopen only if you can show a bug. Otherwise, the forums are you friend!