Bug#665429: backup2l: restore with DRIVER_TAR_GPG not working
March 23rd, 2012 - 09:40 pm ET by Holger Segnitz | Report spam
Package: backup2l
Version: 1.5-3
Severity: normal
Tags: patch
When using backup2l with the bundled DRIVER_TAR_GPG (unmodified), archive
creation (backup2l -b) works fine and searching for files (backup2l -l <pattern>) as well.
Only restore gives some troubles:
- a full restore (backup2l -r) creates all files as empty directories inside the restore directory
- trying to restore files with a search pattern (backup2l -r <pattern> ) tells the user, the files cannot be found in any archive.
I could identify the parameter "-f $3" in the tar command to be causing the problem. Removing it fixed the problem.
see below...
Please note: The attached conf-file includes the fix, the faulty line was
commented but reportbug purged the line, I'll attach the differences below.
I already posted the fix on sourceforge (as fotograf81) a few hours ago and then stumbled
upon this method of bug reporting - this is my first! :)
/etc/backup2l.conf
DRIVER_TAR_GPG()
{
//[...]
-extract) # Arguments: $2 = BID, $3 = archive file name, $4 = file list file
/usr/bin/gpg --batch --no-tty -q --passphrase-fd 3 3</etc/backup2l.pass -d $3 2>/dev/null | lzip -d -c | tar -x --same-permission --same-owner -f $3 -T $4 2>&1
;;
replace with
-extract) # Arguments: $2 = BID, $3 = archive file name, $4 = file list file
/usr/bin/gpg --batch --no-tty -q --passphrase-fd 3 3</etc/backup2l.pass -d $3 2>/dev/null | lzip -d -c | tar -x --same-permission --same-owner -T $4 2>&1
;;
Debian Release: 6.0.4
APT prefers stable
APT policy: (500, 'stable')
Architecture: amd64 (x86_64)
Kernel: Linux 2.6.32-5-amd64 (SMP w/1 CPU core)
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
backup2l depends on no packages.
Versions of packages backup2l recommends:
pn afio <none> (no description available)
ii bzip2 1.0.5-6+squeeze1 high-quality block-sorting file co
Versions of packages backup2l suggests:
pn cdlabelgen <none> (no description available)
/etc/backup2l.conf changed:
FOR_VERSION=1.5
VOLNAME="all"
SRCLIST=(/etc)
SKIPCOND=(-path "*.nobackup*" -o -name "*.o")
BACKUP_DIR="/backup/whole"
MAX_LEVEL=3
MAX_PER_LEVEL=6
MAX_FULL=2
GENERATIONS=1
CREATE_CHECK_FILE=1
PRE_BACKUP ()
{
cd /backup
sh hotcopy-mysql.sh
dpkg --get-selections "*" > /backup/preliminary/dpkg-selections
echo " pre backup scripts completed"
}
POST_BACKUP ()
{
# e. g., restart some mail/db server if its files are to be backup'ed
echo " starting post backup scripts"
cd /backup
chown -R root:root /backup/preliminary/
chmod -R u=rw,go-rwx /backup/preliminary/*
echo " post backup scripts completed"
}
AUTORUN=0
SIZE_UNITS="" # set to "B", "K", "M" or "G" to obtain unified units in summary list
CREATE_DRIVER="DRIVER_TAR_GPG"
USER_DRIVER_LIST="DRIVER_MY_TAR_LZ_GPG DRIVER_TAR_GPG"
DRIVER_MY_AFIOZ ()
{
case $1 in
-test)
# This function should check whether all prerequisites are met, especially if all
# required tools are installed. This prevents backup2l to fail in inconvenient
# situations, e. g. during a backup or restore operation. If everything is ok, the
# string "ok" should be returned. Everything else is interpreted as a failure.
require_tools afio
# The function 'require_tools' checks for the existence of all tools passed as
# arguments. If one of the tools is not found by which(1), an error message is
# displayed and the function does not return.
echo "ok"
;;
-suffix)
# This function should return the suffix of backup archive files. If the driver
#�does not create a file (e. g. transfers the backup data immediately to a tape
# or network device), an empty string has to be returned. backup2l uses this suffix
# to select a driver for unpacking. If a user-configured driver supports the same
# suffix as a built-in driver, the user driver is preferred (as in this case).
echo "afioz"
;;
-create) # Arguments: $2 = BID, $3 = archive file name, $4 = file list file
# This function is called to create a backup file. The argument $3 is the full file
# name of the archive file including path and suffix. $4 contains an alphabetically
# sorted list of files (full pathname) to be backed up. Directories are not contained,
# they are handled by backup2l directly without using the driver.
# All output to stderr should be directed to stdout ("2>&1").
afio -Zo -G 9 -M 30m -T 2k $3 < $4 2>&1
# This line passes some additional options to afio (see afio(1)):
# '-G 9' maximizes the compression by gzip.
# '-M 30m' increases the size of the internal file buffer. Larger files have to
# be compressed twice.
# '-T 2k' prevents the compression of files smaller than 2k in order to save time.
;;
-toc) # Arguments: $2 = BID, $3 = archive file name
# This function is used to validate the correct generation of an archive file.
# The output is compared to the list file passed to the '-create' function.
# Any difference is reported as an error.
afio -Zt $3 | sed 's#^#/#'
# The sed command adds a leading slash to each entry.
;;
-extract) # Arguments: $2 = BID, $3 = archive file name, $4 = file list file
# This function is called by backup2l's restore procedure for each archive.
# It is extremely important that only those files contained in $4 are restored.
# Otherwise it may happen that files are overwritten by incorrect (e. g. older)
# versions of the same file.
afio -Zinw $4 $3 2>&1
;;
esac
}
DRIVER_TAR_GZ_SPLIT ()
{
case $1 in
-test)
require_tools tar split cat
echo "ok"
;;
-suffix)
echo "tgz_split"
;;
-create) # Arguments: $2 = BID, $3 = archive file name, $4 = file list file
mkdir -p ${3}
tar cz -T $4 --no-recursion | split --bytesr5100100 - ${3}/part_
;;
-toc) # Arguments: $2 = BID, $3 = archive file name
cat ${3}/part_* | tar tz | sed 's#^#/#'
;;
-extract) # Arguments: $2 = BID, $3 = archive file name, $4 = file list file
cat ${3}/part_* | tar xz --same-permission --same-owner -T $4 2>&1
;;
esac
}
DRIVER_MY_AFIOBZ2 ()
{
case $1 in
-test)
require_tools afio bzip2
echo "ok"
;;
-suffix)
echo "afio-bz2"
;;
-create) # Arguments: $2 = BID, $3 = archive file name, $4 = file list file
afio -z -1 m -P bzip2 -Q -9 -Z -M 50m -T 1k -o $3 <$4 2>&1
# This line passes some additional options to afio (see afio(1)):
# '-P bzip2' utilizes bzip2 as an external compressor
# '-Q 9' maximizes the compression by bzip2.
# '-M 50m' increases the size of the internal file buffer. Larger files have to
# be compressed twice.
# '-T 1k' prevents the compression of files smaller than 1k in order to save time.
;;
-toc) # Arguments: $2 = BID, $3 = archive file name
afio -t -Z -P bzip2 -Q -d - <$3 | sed 's#^#/#'
# The sed command adds a leading slash to each entry.
;;
-extract) # Arguments: $2 = BID, $3 = archive file name, $4 = file list file
afio -Zinw $4 -P bzip2 -Q -d - <$3 2>&1
;;
esac
}
DRIVER_MY_AFIO_BZ2 ()
{
case $1 in
-test)
require_tools afio bzip2
echo "ok"
;;
-suffix)
echo "afio.bz2"
;;
-create) # Arguments: $2 = BID, $3 = archive file name, $4 = file list file
afio -o - < $4 | bzip2 --best > $3 2>&1
;;
-toc) # Arguments: $2 = BID, $3 = archive file name
bzip2 -d < $3 | afio -t - | sed 's#^#/#'
# The sed command adds a leading slash to each entry.
;;
-extract) # Arguments: $2 = BID, $3 = archive file name, $4 = file list file
bzip2 -d < $3 | afio -inw $4 - 2>&1
;;
esac
}
DRIVER_ZIP ()
{
case $1 in
-test)
require_tools zip
echo "ok"
;;
-suffix)
echo "zip"
;;
-create) # Arguments: $2 = BID, $3 = archive file name, $4 = file list file
cat $4| zip -qy $3 -@
;;
-toc) # Arguments: $2 = BID, $3 = archive file name
zipinfo -1 $3| sed 's#^#/#'
;;
-extract) # Arguments: $2 = BID, $3 = archive file name, $4 = file list file
echo "Not implemented yet! Sorry."
#unzip $3
;;
esac
}
DRIVER_TAR_GPG ()
{
case $1 in
-test)
require_tools tar gpg
echo "ok"
;;
-suffix)
echo "tar.pgp"
;;
-create) # Arguments: $2 = BID, $3 = archive file name, $4 = file list file
tar -c -T $4 --no-recursion | /usr/bin/gpg --batch --no-tty -q --passphrase-fd 3 3</etc/backup2l.pass -c - > $3
;;
-toc) # Arguments: $2 = BID, $3 = archive file name
/usr/bin/gpg --batch --no-tty -q --passphrase-fd 3 3</etc/backup2l.pass -d $3 2>/dev/null | tar t | sed 's#^#/#'
;;
-extract) # Arguments: $2 = BID, $3 = archive file name, $4 = file list file
/usr/bin/gpg --batch --no-tty -q --passphrase-fd 3 3</etc/backup2l.pass -d $3 2>/dev/null | tar -x --same-permission --same-owner -T $4 2>&1
;;
esac
}
DRIVER_MY_TAR_LZ ()
{
case $1 in
-test)
require_tools tar lzip
echo "ok"
;;
-suffix)
echo "tar.lz"
;;
-create) # Arguments: $2 = BID, $3 = archive file name, $4 = file list file
(tar -c -C / -T $4 --no-recursion 2>&3 | lzip --best -c > $3 2>&3) 3>&1 | grep -v 'tar: Removing leading .*'
;;
-toc) # Arguments: $2 = BID, $3 = archive file name
lzip -d $3 -c | tar t | sed 's#^#/#'
;;
-extract) # Arguments: $2 = BID, $3 = archive file name, $4 = file list file
lzip -d $3 -c | tar -x --same-permission --same-owner -T $4 2>&1
;;
esac
}
DRIVER_MY_TAR_LZ_GPG ()
{
case $1 in
-test)
require_tools tar lzip gpg
echo "ok"
;;
-suffix)
echo "tar.lz.gpg"
;;
-create) # Arguments: $2 = BID, $3 = archive file name, $4 = file list file
(tar -c -C / -T $4 --no-recursion 2>&3 | lzip --best -c | /usr/bin/gpg --batch --no-tty -q --passphrase-fd 4 4</etc/backup2l.pass -c - > $3 2>&3) 3>&1 | grep -v 'tar: Removing leading .*'
;;
-toc) # Arguments: $2 = BID, $3 = archive file name
/usr/bin/gpg --batch --no-tty -q --passphrase-fd 3 3</etc/backup2l.pass -d $3 2>/dev/null | lzip -d -c | tar t | sed 's#^#/#'
;;
-extract) # Arguments: $2 = BID, $3 = archive file name, $4 = file list file
/usr/bin/gpg --batch --no-tty -q --passphrase-fd 3 3</etc/backup2l.pass -d $3 2>/dev/null | lzip -d -c | tar -x --same-permission --same-owner -T $4 2>&1
;;
esac
}
/etc/cron.daily/zz-backup2l changed:
! which backup2l > /dev/null || nice -n 19 backup2l -b
/backup/sync.sh
To UNSUBSCRIBE, email to debian-bugs-dist-REQUEST@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org
Version: 1.5-3
Severity: normal
Tags: patch
When using backup2l with the bundled DRIVER_TAR_GPG (unmodified), archive
creation (backup2l -b) works fine and searching for files (backup2l -l <pattern>) as well.
Only restore gives some troubles:
- a full restore (backup2l -r) creates all files as empty directories inside the restore directory
- trying to restore files with a search pattern (backup2l -r <pattern> ) tells the user, the files cannot be found in any archive.
I could identify the parameter "-f $3" in the tar command to be causing the problem. Removing it fixed the problem.
see below...
Please note: The attached conf-file includes the fix, the faulty line was
commented but reportbug purged the line, I'll attach the differences below.
I already posted the fix on sourceforge (as fotograf81) a few hours ago and then stumbled
upon this method of bug reporting - this is my first! :)
/etc/backup2l.conf
DRIVER_TAR_GPG()
{
//[...]
-extract) # Arguments: $2 = BID, $3 = archive file name, $4 = file list file
/usr/bin/gpg --batch --no-tty -q --passphrase-fd 3 3</etc/backup2l.pass -d $3 2>/dev/null | lzip -d -c | tar -x --same-permission --same-owner -f $3 -T $4 2>&1
;;
replace with
-extract) # Arguments: $2 = BID, $3 = archive file name, $4 = file list file
/usr/bin/gpg --batch --no-tty -q --passphrase-fd 3 3</etc/backup2l.pass -d $3 2>/dev/null | lzip -d -c | tar -x --same-permission --same-owner -T $4 2>&1
;;
Debian Release: 6.0.4
APT prefers stable
APT policy: (500, 'stable')
Architecture: amd64 (x86_64)
Kernel: Linux 2.6.32-5-amd64 (SMP w/1 CPU core)
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
backup2l depends on no packages.
Versions of packages backup2l recommends:
pn afio <none> (no description available)
ii bzip2 1.0.5-6+squeeze1 high-quality block-sorting file co
Versions of packages backup2l suggests:
pn cdlabelgen <none> (no description available)
/etc/backup2l.conf changed:
FOR_VERSION=1.5
VOLNAME="all"
SRCLIST=(/etc)
SKIPCOND=(-path "*.nobackup*" -o -name "*.o")
BACKUP_DIR="/backup/whole"
MAX_LEVEL=3
MAX_PER_LEVEL=6
MAX_FULL=2
GENERATIONS=1
CREATE_CHECK_FILE=1
PRE_BACKUP ()
{
cd /backup
sh hotcopy-mysql.sh
dpkg --get-selections "*" > /backup/preliminary/dpkg-selections
echo " pre backup scripts completed"
}
POST_BACKUP ()
{
# e. g., restart some mail/db server if its files are to be backup'ed
echo " starting post backup scripts"
cd /backup
chown -R root:root /backup/preliminary/
chmod -R u=rw,go-rwx /backup/preliminary/*
echo " post backup scripts completed"
}
AUTORUN=0
SIZE_UNITS="" # set to "B", "K", "M" or "G" to obtain unified units in summary list
CREATE_DRIVER="DRIVER_TAR_GPG"
USER_DRIVER_LIST="DRIVER_MY_TAR_LZ_GPG DRIVER_TAR_GPG"
DRIVER_MY_AFIOZ ()
{
case $1 in
-test)
# This function should check whether all prerequisites are met, especially if all
# required tools are installed. This prevents backup2l to fail in inconvenient
# situations, e. g. during a backup or restore operation. If everything is ok, the
# string "ok" should be returned. Everything else is interpreted as a failure.
require_tools afio
# The function 'require_tools' checks for the existence of all tools passed as
# arguments. If one of the tools is not found by which(1), an error message is
# displayed and the function does not return.
echo "ok"
;;
-suffix)
# This function should return the suffix of backup archive files. If the driver
#�does not create a file (e. g. transfers the backup data immediately to a tape
# or network device), an empty string has to be returned. backup2l uses this suffix
# to select a driver for unpacking. If a user-configured driver supports the same
# suffix as a built-in driver, the user driver is preferred (as in this case).
echo "afioz"
;;
-create) # Arguments: $2 = BID, $3 = archive file name, $4 = file list file
# This function is called to create a backup file. The argument $3 is the full file
# name of the archive file including path and suffix. $4 contains an alphabetically
# sorted list of files (full pathname) to be backed up. Directories are not contained,
# they are handled by backup2l directly without using the driver.
# All output to stderr should be directed to stdout ("2>&1").
afio -Zo -G 9 -M 30m -T 2k $3 < $4 2>&1
# This line passes some additional options to afio (see afio(1)):
# '-G 9' maximizes the compression by gzip.
# '-M 30m' increases the size of the internal file buffer. Larger files have to
# be compressed twice.
# '-T 2k' prevents the compression of files smaller than 2k in order to save time.
;;
-toc) # Arguments: $2 = BID, $3 = archive file name
# This function is used to validate the correct generation of an archive file.
# The output is compared to the list file passed to the '-create' function.
# Any difference is reported as an error.
afio -Zt $3 | sed 's#^#/#'
# The sed command adds a leading slash to each entry.
;;
-extract) # Arguments: $2 = BID, $3 = archive file name, $4 = file list file
# This function is called by backup2l's restore procedure for each archive.
# It is extremely important that only those files contained in $4 are restored.
# Otherwise it may happen that files are overwritten by incorrect (e. g. older)
# versions of the same file.
afio -Zinw $4 $3 2>&1
;;
esac
}
DRIVER_TAR_GZ_SPLIT ()
{
case $1 in
-test)
require_tools tar split cat
echo "ok"
;;
-suffix)
echo "tgz_split"
;;
-create) # Arguments: $2 = BID, $3 = archive file name, $4 = file list file
mkdir -p ${3}
tar cz -T $4 --no-recursion | split --bytesr5100100 - ${3}/part_
;;
-toc) # Arguments: $2 = BID, $3 = archive file name
cat ${3}/part_* | tar tz | sed 's#^#/#'
;;
-extract) # Arguments: $2 = BID, $3 = archive file name, $4 = file list file
cat ${3}/part_* | tar xz --same-permission --same-owner -T $4 2>&1
;;
esac
}
DRIVER_MY_AFIOBZ2 ()
{
case $1 in
-test)
require_tools afio bzip2
echo "ok"
;;
-suffix)
echo "afio-bz2"
;;
-create) # Arguments: $2 = BID, $3 = archive file name, $4 = file list file
afio -z -1 m -P bzip2 -Q -9 -Z -M 50m -T 1k -o $3 <$4 2>&1
# This line passes some additional options to afio (see afio(1)):
# '-P bzip2' utilizes bzip2 as an external compressor
# '-Q 9' maximizes the compression by bzip2.
# '-M 50m' increases the size of the internal file buffer. Larger files have to
# be compressed twice.
# '-T 1k' prevents the compression of files smaller than 1k in order to save time.
;;
-toc) # Arguments: $2 = BID, $3 = archive file name
afio -t -Z -P bzip2 -Q -d - <$3 | sed 's#^#/#'
# The sed command adds a leading slash to each entry.
;;
-extract) # Arguments: $2 = BID, $3 = archive file name, $4 = file list file
afio -Zinw $4 -P bzip2 -Q -d - <$3 2>&1
;;
esac
}
DRIVER_MY_AFIO_BZ2 ()
{
case $1 in
-test)
require_tools afio bzip2
echo "ok"
;;
-suffix)
echo "afio.bz2"
;;
-create) # Arguments: $2 = BID, $3 = archive file name, $4 = file list file
afio -o - < $4 | bzip2 --best > $3 2>&1
;;
-toc) # Arguments: $2 = BID, $3 = archive file name
bzip2 -d < $3 | afio -t - | sed 's#^#/#'
# The sed command adds a leading slash to each entry.
;;
-extract) # Arguments: $2 = BID, $3 = archive file name, $4 = file list file
bzip2 -d < $3 | afio -inw $4 - 2>&1
;;
esac
}
DRIVER_ZIP ()
{
case $1 in
-test)
require_tools zip
echo "ok"
;;
-suffix)
echo "zip"
;;
-create) # Arguments: $2 = BID, $3 = archive file name, $4 = file list file
cat $4| zip -qy $3 -@
;;
-toc) # Arguments: $2 = BID, $3 = archive file name
zipinfo -1 $3| sed 's#^#/#'
;;
-extract) # Arguments: $2 = BID, $3 = archive file name, $4 = file list file
echo "Not implemented yet! Sorry."
#unzip $3
;;
esac
}
DRIVER_TAR_GPG ()
{
case $1 in
-test)
require_tools tar gpg
echo "ok"
;;
-suffix)
echo "tar.pgp"
;;
-create) # Arguments: $2 = BID, $3 = archive file name, $4 = file list file
tar -c -T $4 --no-recursion | /usr/bin/gpg --batch --no-tty -q --passphrase-fd 3 3</etc/backup2l.pass -c - > $3
;;
-toc) # Arguments: $2 = BID, $3 = archive file name
/usr/bin/gpg --batch --no-tty -q --passphrase-fd 3 3</etc/backup2l.pass -d $3 2>/dev/null | tar t | sed 's#^#/#'
;;
-extract) # Arguments: $2 = BID, $3 = archive file name, $4 = file list file
/usr/bin/gpg --batch --no-tty -q --passphrase-fd 3 3</etc/backup2l.pass -d $3 2>/dev/null | tar -x --same-permission --same-owner -T $4 2>&1
;;
esac
}
DRIVER_MY_TAR_LZ ()
{
case $1 in
-test)
require_tools tar lzip
echo "ok"
;;
-suffix)
echo "tar.lz"
;;
-create) # Arguments: $2 = BID, $3 = archive file name, $4 = file list file
(tar -c -C / -T $4 --no-recursion 2>&3 | lzip --best -c > $3 2>&3) 3>&1 | grep -v 'tar: Removing leading .*'
;;
-toc) # Arguments: $2 = BID, $3 = archive file name
lzip -d $3 -c | tar t | sed 's#^#/#'
;;
-extract) # Arguments: $2 = BID, $3 = archive file name, $4 = file list file
lzip -d $3 -c | tar -x --same-permission --same-owner -T $4 2>&1
;;
esac
}
DRIVER_MY_TAR_LZ_GPG ()
{
case $1 in
-test)
require_tools tar lzip gpg
echo "ok"
;;
-suffix)
echo "tar.lz.gpg"
;;
-create) # Arguments: $2 = BID, $3 = archive file name, $4 = file list file
(tar -c -C / -T $4 --no-recursion 2>&3 | lzip --best -c | /usr/bin/gpg --batch --no-tty -q --passphrase-fd 4 4</etc/backup2l.pass -c - > $3 2>&3) 3>&1 | grep -v 'tar: Removing leading .*'
;;
-toc) # Arguments: $2 = BID, $3 = archive file name
/usr/bin/gpg --batch --no-tty -q --passphrase-fd 3 3</etc/backup2l.pass -d $3 2>/dev/null | lzip -d -c | tar t | sed 's#^#/#'
;;
-extract) # Arguments: $2 = BID, $3 = archive file name, $4 = file list file
/usr/bin/gpg --batch --no-tty -q --passphrase-fd 3 3</etc/backup2l.pass -d $3 2>/dev/null | lzip -d -c | tar -x --same-permission --same-owner -T $4 2>&1
;;
esac
}
/etc/cron.daily/zz-backup2l changed:
! which backup2l > /dev/null || nice -n 19 backup2l -b
/backup/sync.sh
To UNSUBSCRIBE, email to debian-bugs-dist-REQUEST@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org
Similar topics
- Bug#682074: texmaker: Restore session does not work after fresh boot
- Bug#692959: ntfs-3g: Support resize on clone restore
- Bug#682612: /sbin/ip6tables-multi: Cannot restore ip6tables, fails at Commit line
- Bug#691057: xul-ext-tabmixplus: Does not restore sessions on Iceweasel 16.0.1
- Bug#678499: iptables: iptables-restore messes with --log-prefix
- Bug#676800: [pkg-octave/master] restore-locale.patch: new patch, restores locale after initializing the JVM
- Bug#687602: retext: should restore the window position and size at startup
- Bug#687602: retext: should restore the window position and size at startup
Make your own search
Tags
Create a new topic
Follow the discussion
1 reply
Make a reply
May 19th, 2013 - 6:16 AM ET
Join now


Replies