#1545 Issue closed: "rear mkrescue" destroys existing backup on multiple ISOs

Labels: documentation, fixed / solved / done, critical / security / legal

jsmeix opened issue at 2017-10-25 13:34:

Current ReaR master code:

Summary:
When I do a backup on multiple ISOs via "rear mkbackup"
then recovery via "rear recover" works.
But when I do after the "rear mkbackup" a "rear mkrescue"
then a recovery via "rear recover works" fails with

RESCUE e205:~ # rear -d -D recover
...
ERROR: Backup archive 'backup.tar.gz' not found.
Aborting due to an error, check /var/log/rear/rear-e205.log for details

I assume the reason is that in the first ISO
that is named "rear-HOSTNAME.iso"
there is in case of "rear mkbackup" both
the (bootable) ReaR recovery system
plus the first part of the splitted backup.

But a subsequent "rear mkrescue" overwrites that first ISO
with one that contains only the new recovery system but
no longer the first part of the splitted backup which leads
to "Backup archive 'backup.tar.gz' not found."

I do backup on multiple ISOs via this initial /etc/rear/local.conf

OUTPUT=ISO
OUTPUT_URL=nfs://10.160.4.244/nfs
BACKUP=NETFS
BACKUP_OPTIONS="nfsvers=3,nolock"
BACKUP_URL="iso:///mybackup"
ISO_MAX_SIZE=500

jsmeix commented at 2017-10-25 13:50:

Proof:

On the original system

e205:~/rear.master # usr/sbin/rear -d -D mkbackup
Relax-and-Recover 2.2 / Git
Using log file: /root/rear.master/var/log/rear/rear-e205.log
Using backup archive '/tmp/rear.m7Og1d7PvtwpRSf/tmp/isofs/mybackup/backup.tar.gz'
Creating disk layout
Using sysconfig bootloader 'grub2'
Creating root filesystem layout
Saving file capabilities (NETFS_RESTORE_CAPABILITIES)
Copying logfile /root/rear.master/var/log/rear/rear-e205.log into initramfs as '/tmp/rear-e205-partial-2017-10-25T15:32:07+02:00.log'
Copying files and directories
Copying binaries and libraries
Copying all kernel modules in /lib/modules/4.4.21-69-default (MODULES contains 'all_modules')
Copying all files in /lib*/firmware/
Creating recovery/rescue system initramfs/initrd initrd.cgz with gzip default compression
Created initrd.cgz with gzip default compression (169699891 bytes) in 21 seconds
Creating tar archive '/tmp/rear.m7Og1d7PvtwpRSf/tmp/isofs/mybackup/backup.tar.gz'
Preparing archive operation
Archived 24 MiB [avg 6168 KiB/sec] 
Archived 50 MiB [avg 7417 KiB/sec] 
...
Archived 1184 MiB [avg 8921 KiB/sec] 
OK
Archived 1184 MiB in 139 seconds [avg 8729 KiB/sec]
Preparing 4 ISO images
Initial (bootable) ISO image will be rear-e205.iso labelled RELAXRECOVER containing backup.tar.gz.00 (333447168 bytes)
Making additional ISO image: rear-e205_01.iso labelled RELAXRECOVER_01 containing backup.tar.gz.01 (333447168 bytes)
Wrote ISO image: /root/rear.master/var/lib/rear/output/rear-e205_01.iso (319M)
Making additional ISO image: rear-e205_02.iso labelled RELAXRECOVER_02 containing backup.tar.gz.02 (333447168 bytes)
Wrote ISO image: /root/rear.master/var/lib/rear/output/rear-e205_02.iso (319M)
Making additional ISO image: rear-e205_03.iso labelled RELAXRECOVER_03 containing backup.tar.gz.03 (255732110 bytes)
Wrote ISO image: /root/rear.master/var/lib/rear/output/rear-e205_03.iso (245M)
Making ISO image
Wrote ISO image: /root/rear.master/var/lib/rear/output/rear-e205.iso (498M)
Copying resulting files to nfs location
Saving /root/rear.master/var/log/rear/rear-e205.log as rear-e205.log to nfs location

results on the NFS server

nfs/e205 # ls -ltr
total 1416164
-rw-rw-rw- 1 nobody nogroup 333821952 Oct 25 15:35 rear-e205_01.iso
-rw-rw-rw- 1 nobody nogroup 333821952 Oct 25 15:35 rear-e205_02.iso
-rw-rw-rw- 1 nobody nogroup 256108544 Oct 25 15:35 rear-e205_03.iso
-rw-rw-rw- 1 nobody nogroup 521799680 Oct 25 15:35 rear-e205.iso
-rw-rw-rw- 1 nobody nogroup       261 Oct 25 15:35 VERSION
-rw-rw-rw- 1 nobody nogroup       202 Oct 25 15:35 README
-rw-rw-rw- 1 nobody nogroup   4568264 Oct 25 15:35 rear-e205.log

nfs/e205 # for iso in rear-e205.iso rear-e205_01.iso rear-e205_02.iso rear-e205_03.iso ; do echo $iso ; mount $iso /tmp/isomp/ 2>/dev/null ; find /tmp/isomp/ ; umount /tmp/isomp/ ; echo ==================== ; done

rear-e205.iso
/tmp/isomp/
/tmp/isomp/isolinux
/tmp/isomp/isolinux/boot.cat
/tmp/isomp/isolinux/chain.c32
/tmp/isomp/isolinux/hdt.c32
/tmp/isomp/isolinux/initrd.cgz
/tmp/isomp/isolinux/isolinux.bin
/tmp/isomp/isolinux/isolinux.cfg
/tmp/isomp/isolinux/kernel
/tmp/isomp/isolinux/menu.c32
/tmp/isomp/isolinux/message
/tmp/isomp/isolinux/pci.ids
/tmp/isomp/isolinux/poweroff.com
/tmp/isomp/isolinux/rear.help
/tmp/isomp/isolinux/reboot.c32
/tmp/isomp/isolinux/vesamenu.c32
/tmp/isomp/mybackup
/tmp/isomp/mybackup/backup.log
/tmp/isomp/mybackup/backup.splitted
/tmp/isomp/mybackup/backup.tar.gz.00
====================
rear-e205_01.iso
/tmp/isomp/
/tmp/isomp/mybackup
/tmp/isomp/mybackup/backup.tar.gz.01
====================
rear-e205_02.iso
/tmp/isomp/
/tmp/isomp/mybackup
/tmp/isomp/mybackup/backup.tar.gz.02
====================
rear-e205_03.iso
/tmp/isomp/
/tmp/isomp/mybackup
/tmp/isomp/mybackup/backup.tar.gz.03
====================

Then on the original system

e205:~/rear.master # usr/sbin/rear -d -D mkrescue
Relax-and-Recover 2.2 / Git
Using log file: /root/rear.master/var/log/rear/rear-e205.log
Using backup archive '/tmp/rear.rITEfXGRMNZacS3/tmp/isofs/mybackup/backup.tar.gz'
Creating disk layout
Using sysconfig bootloader 'grub2'
Creating root filesystem layout
Saving file capabilities (NETFS_RESTORE_CAPABILITIES)
Copying logfile /root/rear.master/var/log/rear/rear-e205.log into initramfs as '/tmp/rear-e205-partial-2017-10-25T15:40:00+02:00.log'
Copying files and directories
Copying binaries and libraries
Copying all kernel modules in /lib/modules/4.4.21-69-default (MODULES contains 'all_modules')
Copying all files in /lib*/firmware/
Creating recovery/rescue system initramfs/initrd initrd.cgz with gzip default compression
Created initrd.cgz with gzip default compression (169693456 bytes) in 20 seconds
Making ISO image
Wrote ISO image: /root/rear.master/var/lib/rear/output/rear-e205.iso (170M)
Copying resulting files to nfs location
Saving /root/rear.master/var/log/rear/rear-e205.log as rear-e205.log to nfs location

results on the NFS server

nfs/e205 # ls -ltr
total 1079708
-rw-rw-rw- 1 nobody nogroup 333821952 Oct 25 15:35 rear-e205_01.iso
-rw-rw-rw- 1 nobody nogroup 333821952 Oct 25 15:35 rear-e205_02.iso
-rw-rw-rw- 1 nobody nogroup 256108544 Oct 25 15:35 rear-e205_03.iso
-rw-rw-rw- 1 nobody nogroup 177375232 Oct 25 15:40 rear-e205.iso
-rw-rw-rw- 1 nobody nogroup       261 Oct 25 15:40 VERSION
-rw-rw-rw- 1 nobody nogroup       202 Oct 25 15:40 README
-rw-rw-rw- 1 nobody nogroup   4467922 Oct 25 15:40 rear-e205.log

nfs/e205 # for iso in rear-e205.iso rear-e205_01.iso rear-e205_02.iso rear-e205_03.iso ; do echo $iso ; mount $iso /tmp/isomp/ 2>/dev/null ; find /tmp/isomp/ ; umount /tmp/isomp/ ; echo ==================== ; done

rear-e205.iso
/tmp/isomp/
/tmp/isomp/isolinux
/tmp/isomp/isolinux/boot.cat
/tmp/isomp/isolinux/chain.c32
/tmp/isomp/isolinux/hdt.c32
/tmp/isomp/isolinux/initrd.cgz
/tmp/isomp/isolinux/isolinux.bin
/tmp/isomp/isolinux/isolinux.cfg
/tmp/isomp/isolinux/kernel
/tmp/isomp/isolinux/menu.c32
/tmp/isomp/isolinux/message
/tmp/isomp/isolinux/pci.ids
/tmp/isomp/isolinux/poweroff.com
/tmp/isomp/isolinux/rear.help
/tmp/isomp/isolinux/reboot.c32
/tmp/isomp/isolinux/vesamenu.c32
====================
rear-e205_01.iso
/tmp/isomp/
/tmp/isomp/mybackup
/tmp/isomp/mybackup/backup.tar.gz.01
====================
rear-e205_02.iso
/tmp/isomp/
/tmp/isomp/mybackup
/tmp/isomp/mybackup/backup.tar.gz.02
====================
rear-e205_03.iso
/tmp/isomp/
/tmp/isomp/mybackup
/tmp/isomp/mybackup/backup.tar.gz.03
====================

so that the files

mybackup/backup.log
mybackup/backup.splitted
mybackup/backup.tar.gz.00

are missing after "rear mkrescue" in the
first ISO that is named "rear-HOSTNAME.iso"

jsmeix commented at 2017-10-25 14:38:

As a quick fix at least for now I aviod this issue via
https://github.com/rear/rear/pull/1542/commits/63cc5122b3418b85eb8ddeb5ecc3260ff7a4a593
by forbidding the mkrescue workflow if ISO_MAX_SIZE is set
which is a part of https://github.com/rear/rear/pull/1542

Perhaps not the very best solution but I guess nowadays
ISO_MAX_SIZE is amlost nowhere used in practice
so that I won't spend much time on such issues.

FYI
how it now works for me:

e205:~/rear.master # usr/sbin/rear -d -D mkbackup
Relax-and-Recover 2.2 / Git
Using log file: /root/rear.master/var/log/rear/rear-e205.log
Using backup archive '/tmp/rear.sEE15B8AE6KapJH/tmp/isofs/mybackup/backup.tar.gz'
Creating disk layout
Using sysconfig bootloader 'grub2'
Creating root filesystem layout
Saving file capabilities (NETFS_RESTORE_CAPABILITIES)
Copying logfile /root/rear.master/var/log/rear/rear-e205.log into initramfs as '/tmp/rear-e205-partial-2017-10-25T16:21:36+02:00.log'
Copying files and directories
Copying binaries and libraries
Copying all kernel modules in /lib/modules/4.4.21-69-default (MODULES contains 'all_modules')
Copying all files in /lib*/firmware/
Creating recovery/rescue system initramfs/initrd initrd.cgz with gzip default compression
Created initrd.cgz with gzip default compression (169704648 bytes) in 20 seconds
Creating tar archive '/tmp/rear.sEE15B8AE6KapJH/tmp/isofs/mybackup/backup.tar.gz'
Preparing archive operation
Archived 25 MiB [avg 6648 KiB/sec] 
Archived 52 MiB [avg 7659 KiB/sec] 
...
Archived 1179 MiB [avg 8818 KiB/sec] 
OK
Archived 1179 MiB in 140 seconds [avg 8629 KiB/sec]
Preparing 4 ISO images
Initial (bootable) ISO image will be rear-e205.iso labelled RELAXRECOVER containing backup.tar.gz.00 (333447168 bytes)
Making additional ISO image: rear-e205_01.iso labelled RELAXRECOVER_01 containing backup.tar.gz.01 (333447168 bytes)
Wrote ISO image: /root/rear.master/var/lib/rear/output/rear-e205_01.iso (319M)
Making additional ISO image: rear-e205_02.iso labelled RELAXRECOVER_02 containing backup.tar.gz.02 (333447168 bytes)
Wrote ISO image: /root/rear.master/var/lib/rear/output/rear-e205_02.iso (319M)
Making additional ISO image: rear-e205_03.iso labelled RELAXRECOVER_03 containing backup.tar.gz.03 (255717430 bytes)
Wrote ISO image: /root/rear.master/var/lib/rear/output/rear-e205_03.iso (245M)
Making ISO image
Wrote ISO image: /root/rear.master/var/lib/rear/output/rear-e205.iso (498M)
Copying resulting files to nfs location
Saving /root/rear.master/var/log/rear/rear-e205.log as rear-e205.log to nfs location

that results on the NFS server

nfs/e205 # ls -ltr
total 1416156
-rw-rw-rw- 1 nobody nogroup 333821952 Oct 25 16:24 rear-e205_01.iso
-rw-rw-rw- 1 nobody nogroup 333821952 Oct 25 16:24 rear-e205_02.iso
-rw-rw-rw- 1 nobody nogroup 256094208 Oct 25 16:24 rear-e205_03.iso
-rw-rw-rw- 1 nobody nogroup 521803776 Oct 25 16:24 rear-e205.iso
-rw-rw-rw- 1 nobody nogroup       261 Oct 25 16:24 VERSION
-rw-rw-rw- 1 nobody nogroup       202 Oct 25 16:24 README
-rw-rw-rw- 1 nobody nogroup   4568156 Oct 25 16:24 rear-e205.log

and a subsequent

e205:~/rear.master # usr/sbin/rear -d -D mkrescue
Relax-and-Recover 2.2 / Git
Using log file: /root/rear.master/var/log/rear/rear-e205.log
Using backup archive '/tmp/rear.JTxu3cWaTSOJry2/tmp/isofs/mybackup/backup.tar.gz'
Creating disk layout
Using sysconfig bootloader 'grub2'
Creating root filesystem layout
Saving file capabilities (NETFS_RESTORE_CAPABILITIES)
Copying logfile /root/rear.master/var/log/rear/rear-e205.log into initramfs as '/tmp/rear-e205-partial-2017-10-25T16:26:38+02:00.log'
Copying files and directories
Copying binaries and libraries
Copying all kernel modules in /lib/modules/4.4.21-69-default (MODULES contains 'all_modules')
Copying all files in /lib*/firmware/
Creating recovery/rescue system initramfs/initrd initrd.cgz with gzip default compression
Created initrd.cgz with gzip default compression (169702405 bytes) in 20 seconds
ERROR: The mkrescue workflow is forbidden when ISO_MAX_SIZE is set
Aborting due to an error, check /root/rear.master/var/log/rear/rear-e205.log for details

results no change of the existing files on the NFS server
so that then "rear recover" still "just works".

jsmeix commented at 2017-10-25 14:48:

I consider it sufficiently fixed via
https://github.com/rear/rear/pull/1542/commits/63cc5122b3418b85eb8ddeb5ecc3260ff7a4a593
in https://github.com/rear/rear/pull/1542

jsmeix commented at 2017-10-26 12:00:

With https://github.com/rear/rear/pull/1549 merged
this issue should now be completely fixed.

jsmeix commented at 2017-10-26 12:26:

FYI why I consider this one as a "critical" bug:

Because without internal knowledge how multiple ISOs
are implemented a user could assume that after an
initial "rear mkbackup" he could use "rear mkrescue"
to re-create the rescue system on the first ISO
and keep the backup on the other ISOs intact.

I.e. a user could falsely asume the first ISO
that is named "rear-HOSTNAME.iso"
(same name as a usual rescue system ISO)
contains only the rescue system and
the other ISOs that are named
rear-HOSTNAME_01.iso rear-HOSTNAME_02.iso ...
contain the splitted backup.tar.gz file
so that he could safely run "rear mkrescue"
to update the "rear-HOSTNAME.iso"
but actually that is not the case.


[Export of Github issue for rear/rear.]