Problem restore backup

Problems with the Linux version of XAMPP, questions, comments, and anything related.

Problem restore backup

Postby offboard » 07. July 2015 22:09

I am unable to restore my backup tried all versions of xampp and unsuccessful

then to prove that the problem is xampp installed the latest version and did a backup :

Code: Select all
sudo /opt/lampp/xampp backup
alien backup # sh /opt/lampp/backup/xampp-backup-07-07-15.sh
/opt/lampp/backup/xampp-backup-07-07-15.sh: 58: /opt/lampp/backup/xampp-backup-07-07-15.sh: function: not found
egrep: md5sums: No such file or directory
^C
alien backup # bash /opt/lampp/backup/xampp-backup-07-07-15.sh
tar: This does not look like a tar archive
tar: Exiting with failure status due to previous errors
Checking integrity of files...
egrep: md5sums: No such file or directory
md5sum: *: No such file or directory
Restoring configuration, log and htdocs files...
tar (child): data.tar.gz: Cannot open: No such file or directory
tar (child): Error is not recoverable: exiting now
tar: Child returned status 2
tar: Error is not recoverable: exiting now
Checking versions...
cat: VERSION: No such file or directory
Installed:   XAMPP 5.6.8-0
Backup from: XAMPP
The backup sofware is not able to handle different XAMPP versions.
Your backuped configuration from  may not work with 5.6.8-0 and may need manually corrections.
XAMPP: Do you want to continue [nein] y
Let's try...
Restoring MySQL databases...
/opt/lampp/backup/xampp-backup-07-07-15.sh: line 184: *.sql: No such file or directory
* FAILED: cat: output: No such file or directory
Restoring MySQL user databases...
/opt/lampp/backup/xampp-backup-07-07-15.sh: line 193: mysql.sql: No such file or directory
MySQL user FAILED: cat: output: No such file or directory
Backup complete. Have fun!
You may need to restart XAMPP to complete the restore.
alien backup #



my file /opt/lampp/share/lampp/backup.head
I tried to change the line "skip" to 206 but does not work

Code: Select all
#!/bin/bash
# Copyright 2003-2004 by Kai 'Oswald' Seidler, oswald@apachefriends.org, GPL-licensed

skip=203

osguess() {
   if test -f /etc/redhat-release
   then
      if egrep "9 " /etc/redhat-release > /dev/null
      then
         echo "rh9"
         return 0
      else
              echo "linux"
         return 0
      fi
   elif test "$(uname)" = "Darwin"
   then
      echo "macosx"
      return 0
   else
      if test -f /etc/vfstab
      then
         echo "solaris"
         return 0
      else
         echo "linux"
         return 0
      fi
   fi
}

case $(osguess) in
   solaris)
      XAMPP_OS="Solaris"
      XAMPP_ROOT="/opt/xampp"
      ;;
   linux|rh9)
      XAMPP_OS="Linux"
      XAMPP_ROOT="/opt/lampp"
      ;;
   macosx)
      XAMPP_OS="Mac OS X"
      XAMPP_ROOT="/Applications/XAMPP/xamppfiles/"
      ;;
esac

export XAMPP_OS
export XAMPP_ROOT

if test "$(osguess)" = "macosx"; then
    md5sum=md5
else
    md5sum=md5sum
fi

# check the md5sum of a singe file
function checksum
{
   origsum=`egrep " $1$" md5sums`
   mysum=`$md5sum $1`

   if test -z "$origsum"
   then   
      return
   fi

   if test "$origsum" = "$mysum"
   then
      :
   else
      echo "$i: FAILED."
      echo "Sorry, your backup file is corrupt."
      echo "Please email to oswald@apachefriends.org for help."
      exit
   fi
}

backupdir="$XAMPP_ROOT/backup"

if test "`whoami`" != "root"
then
   echo "Please run me as root."
   exit
fi

case $0 in
   /*) this=$0;;
   *) this=`pwd`/$0;;
esac

if test -e "$this"
then
   :
else
   echo "Something went wrong."
   echo "Can you call me in a different way?"
   exit
fi


if test -d $backupdir
then   
        :
else   
   (
        mkdir $backupdir
        if test "$(osguess)" = "macosx"; then
            chown root:wheel $backupdir
        else
            chown root.root $backupdir
        fi
        chmod 700 $backupdir
   ) 2> /dev/null
fi

restoredir="$XAMPP_ROOT/backup/$$"

mkdir $restoredir 2> /dev/null

cd $restoredir 2> /dev/null || (echo "Please install a vanilla XAMPP first"; exit)

. $XAMPP_ROOT/share/xampp/xampplib

if test "$1" != ""
then   
        passwd="-p$1"
else   
        passwd=""
fi

if $XAMPP_ROOT/bin/mysqladmin -uroot reload $passwd 2>/dev/null
then
   :
else
   echo "Can't access your MySQL database."
   echo "a) Did you start it?"
   echo "b) Add the MySQL root password to end of command line"
   exit
fi

tail -n +$skip "$this" | gzip -dc - 2>/dev/null | tar xf -

echo "Checking integrity of files..."

for i in *
do
   checksum $i
done

echo "Restoring configuration, log and htdocs files..."

tar xfz data.tar.gz -C /

echo "Checking versions..."

iam=`cat VERSION`
installed=`cat $XAMPP_ROOT/lib/VERSION`

echo "Installed:   XAMPP $installed"
echo "Backup from: XAMPP $iam"

if test "$installed" != "$iam"
then
   echo "The backup sofware is not able to handle different XAMPP versions."
   echo "Your backuped configuration from $iam may not work with $installed and may need manually corrections."
   if askn "Do you want to continue"
   then
      echo "Let's try..."
   else
      echo "Good choice."
      exit
   fi
fi

echo "Restoring MySQL databases..."

for i in *.sql
do
   if test "$i" = "mysql.sql"
   then
      continue
   fi
   $XAMPP_ROOT/bin/mysql -uroot $passwd < $i 2> output
   if test $? != 0
   then
      echo -n "`basename $i .sql` FAILED: "
      cat output
   fi
done

echo "Restoring MySQL user databases..."
$XAMPP_ROOT/bin/mysql -uroot $passwd < mysql.sql 2> output
if test $? != 0
then
   echo -n "MySQL user FAILED: "
   cat output
fi

echo "Backup complete. Have fun!"
echo "You may need to restart XAMPP to complete the restore."

rm -rf $restoredir
exit
##BACKUPDATA##

is there any possibility to extract the files manually?
Last edited by offboard on 11. July 2015 22:52, edited 1 time in total.
offboard
 
Posts: 2
Joined: 07. July 2015 22:03
Operating System: linux mint

Re: Problem restore backup

Postby Nobbie » 08. July 2015 14:38

I already had a similar thread a couple of weeks ago, Xampp backup does not work correctly (as stated in the readme!!), i found out, that the skip command (skip=203) is wrongly calculated. It must be 206 or more (i do not remember exactly). This leads to falls data.

The main problem is, that the baclup file is a mix of text (shell script in the beginning) and followed by binary data. If you have sufficient linux skills, you can split the backup file into the shell part (this is not needed) and the binary part, if you edit the backup file, you will see a line which indicates where the binary part starts. You can split that file with the head or tail command with the proper offset (i.e. that is how it is designed to run, but 203 is the wrong number).

If you succeed to store the binary part into a separate file, this file is a gzipped tar file. You can unzip it, then untar it, this results in many other files (you will see, what these files are meant for). I succeeded to do so for another user, but in the moment i am not at home cannot help you on that issue any further.
Nobbie
 
Posts: 13179
Joined: 09. March 2008 13:04

Re: Problem restore backup

Postby offboard » 11. July 2015 22:50

Nobbie wrote:I already had a similar thread a couple of weeks ago, Xampp backup does not work correctly (as stated in the readme!!), i found out, that the skip command (skip=203) is wrongly calculated. It must be 206 or more (i do not remember exactly). This leads to falls data.

The main problem is, that the baclup file is a mix of text (shell script in the beginning) and followed by binary data. If you have sufficient linux skills, you can split the backup file into the shell part (this is not needed) and the binary part, if you edit the backup file, you will see a line which indicates where the binary part starts. You can split that file with the head or tail command with the proper offset (i.e. that is how it is designed to run, but 203 is the wrong number).

If you succeed to store the binary part into a separate file, this file is a gzipped tar file. You can unzip it, then untar it, this results in many other files (you will see, what these files are meant for). I succeeded to do so for another user, but in the moment i am not at home cannot help you on that issue any further.

I could recover my data successfully !
I opened the file backup ... sh with vim editor and deleted all up to ##backupdata## and then rename it to data.tar.gz and managed to extract all files.
offboard
 
Posts: 2
Joined: 07. July 2015 22:03
Operating System: linux mint


Return to XAMPP for Linux

Who is online

Users browsing this forum: No registered users and 77 guests