#573254 rsnapshot shouldn't bail on absent backup points when invoked for mere rotation

#573254#5
Date:
2010-03-10 05:17:59 UTC
From:
To:
When backup points do not exist, rsnapshot refuses to proceed, throwing errors
like:

ERROR: /etc/rsnapshot.conf on line 196:
ERROR: backup /mnt/root_backup/etc/ lizzie/ - Source directory \
         "/mnt/root_backup/etc/" doesn't exist

This makes sense for the lowest backup level, where we'll actually be doing a
rsync with the source, but in the higher levels, we're merely rotating the
target, so why do we care?

I use rsnapshot with lvm snapshots, which I create before every rsnapshot
invocation and remove afterward.  But why should this be necessary for the
higher level backups?

#573254#10
Date:
2010-04-04 15:43:30 UTC
From:
To:
Hello,

Can you attach your /etc/rsnapshot.conf file ?
I don't really understand your problem, all details needed to understand
bit more your usecase (lvm usage, commands used, etc...) appreciated.

Thanks in advance.

#573254#15
Date:
2010-04-04 16:18:37 UTC
From:
To:
Done.

The main (internal) drive on the system uses LVM
(/, /home, /usr, /swap, /var).  I back up parts of /var, /usr, /home
and /boot.  To ensure that the backups are consistent, I use the LVM
snapshot feature, so that instead of backing up, for example, /home,
directly, I create a home_backup lv, which remains static, and then
back that up.  I'm following the basic procedure given in the LVM howto:

http://tldp.org/HOWTO/LVM-HOWTO/snapshots_backup.html

My backup rsnapshot wrapper is this (invoked with one argument, which
is passed to rsnapshot):

#! /bin/sh

/sbin/lvcreate -L 2G -s -n home_backup /dev/lizzie/home
/sbin/lvcreate -L 100M -s -n root_backup /dev/lizzie/root
/sbin/lvcreate -L 1G -s -n var_backup /dev/lizzie/var

/bin/mount /dev/lizzie/home_backup /mnt/home_backup/
/bin/mount /dev/lizzie/root_backup /mnt/root_backup/
/bin/mount /dev/lizzie/var_backup /mnt/var_backup/

nice -n 19 /usr/bin/rsnapshot $1

/bin/umount /mnt/home_backup/
/bin/umount /mnt/root_backup/
/bin/umount /mnt/var_backup/

/sbin/lvremove -f lizzie/home_backup
/sbin/lvremove -f lizzie/root_backup
/sbin/lvremove -f lizzie/var_backup

I'll be glad to provide any other information that you need.

Celejar

#573254#20
Date:
2010-04-06 20:10:17 UTC
From:
To:
Hello,

Thanks for all informations provided.

I just realize that rsnapshot support LVM since 1.3.1 release, as
mentionned in the manpage (example with your case):

backup	lvm://lizzie/root/etc	lizzie/

You have to define some variables to take advantages of this feature:

linux_lvm_cmd_lvcreate			/sbin/lvcreate
linux_lvm_cmd_lvremove			/sbin/lvremove
linux_lvm_cmd_mount			/bin/mount
linux_lvm_cmd_umount			/bin/umount
linux_lvm_snapshotsize			256M
linux_lvm_snapshotname			rsnapshot
linux_lvm_vgpath			/dev
linux_lvm_mountpath			/mnt

Is this corresponding to your needs ?

#573254#25
Date:
2010-04-07 16:00:00 UTC
From:
To:
Thanks, I'm trying this now.  I'll report back after using this
configuration for a while.

Celejar

#573254#30
Date:
2010-04-08 18:52:07 UTC
From:
To:
Hi,

I'm still having trouble removing my snapshot volumes.  I recalled that
my fstab mounts are based on UUID, which are identical for the origin
and the snapshot (so much for unique ;)), so I switched to path based
mounting, and so far I have not experienced the problem in exactly the
original form (although it only happened occasionally anyway, so
there's nothing conclusive here).

But I'm still having trouble with snapshot removal.  I'm using
rsnapshot's lvm integration: the utility creates a snapshot, mounts it,
does a rsync based backup of the snapshot, umounts the snapshot and
then removes it.  But rsnapshot keeps bailing, claiming that the
snapshot can't be removed.  When I try to remove it manually, I get the
"Can't remove open logical volume" error.  I generally find that after
waiting a few minutes and trying again, it works.  It isn't mounted
anymore, so why isn't it going away the first time(s)?

Celejar

#573254#35
Date:
2010-06-08 19:32:00 UTC
From:
To:
Hello,

As this bug seems to be a lvm issue, i will close in some days unless
you have good reason to don't.

#573254#40
Date:
2010-06-10 17:03:38 UTC
From:
To:
Well, although I'm not experiencing the problem anymore, since moving
away from lvm snapshots, I believe that rsnapshot is still using
incorrect logic, even though I'm no longer being hit by it.

My original point (which, AFAICT, remains valid) was that if rsnapshot
can't find any of the source directories, it will quit.  Now, this
makes sense where we're asking it to sync the target with the source,
but when we're asking for a higher level backup, which just involves a
rotation of the directories on the target, without doing anything
involving the source, there seems to be no reason for rsnapshot to care
that the source directories don't currently exist.

Celejar

#573254#45
Date:
2011-02-23 13:06:04 UTC
From:
To:
hello

the problem is that rsnapshot does "fear the unknown" (line 1004 in
ubuntu's rsnapshot). below is the last else clause checking
different formats of the backup source inside the sub parse_config_file:

# fear the unknown
} else {
	config_err($file_line_num, "$line - Source directory \"$src\"
doesn't exist"); next;
}

in some situations it should not fear, because it does not need (the
unknown) source directory:
- as mentioned by the op it should not fear if it is just rotating
- when invoking diff or du

this leads to situations where 'rsnapshot -c ... diff' with one config
file bails but using another config file, where the source exists (but
does not matter) _to diff directories of the same snapshot root_ works
flawlessly:

/data/backup/system# rsnapshot
-c /root/backup-scripts/settings/hostname/rsnapshot-root.conf diff
bootly.[01]
----------------------------------------------------------------------------
rsnapshot encountered an error! The program was invoked with these
options: /usr/bin/rsnapshot -c
\ /root/backup-scripts/settings/hostname/rsnapshot-root.conf diff
bootly.0 \ bootly.1
----------------------------------------------------------------------------
ERROR: /root/backup-scripts/settings/hostname/rsnapshot-root.conf on
line 223: ERROR: backup /mnt/root-snapshot root/ \
exclude=dev,exclude=tmp,exclude=lib/udev/,exclude=var/spool \
         - Source directory "/mnt/root-snapshot" doesn't exist
ERROR:
---------------------------------------------------------------------
ERROR: Errors were found
in /root/backup-scripts/settings/hostname/rsnapshot-root.conf, ERROR:
rsnapshot can not continue. If you think an entry looks right, make
ERROR: sure you don't have spaces where only tabs should be.
================================

the second one uses the default config file (which i don't use
normally) with this backup points which all exist:
backup	/home/		localhost/
backup	/etc/		localhost/
backup	/usr/local/	localhost/

/data/backup/system# rsnapshot diff bootly.[01]
Comparing bootly.1 to bootly.0
Between bootly.1 and bootly.0:
  92 were added, taking 6362802 bytes;
  85 were removed, saving 6292118
================================

my perl skills are non-existent and i did not read a lot of
rsnapshot's code, but my general idea to fix this problem would be:
- define all cases where the source directory is not need
- set a global variable or argument of parse_config_file to indicate
  when this is the case
- skip the source directory check in parse_config_file according to
  this information

#573254#50
Date:
2017-01-26 05:06:28 UTC
From:
To:
Dear Customer,

Your parcel was successfully delivered January 23 to USPS Station, but our courier cound not contact you.

Download postal receipt attached to e-mail!

Yours faithfully,
Clayton Frank,
USPS Office Clerk.

#573254#55
Date:
2019-10-24 05:45:50 UTC
From:
To:
This was reported against 1.3.1, however 1.4.2 is available in oldstable. Can
you confirm if this issue is still present? If so, would you also be able to
also check against the latest git revision (many bug fixes are not released)?

#573254#60
Date:
2020-01-07 22:36:54 UTC
From:
To:
Hi,

I have checked with the one in Debian Buster (1.4.2-1) and Bullseye
(1.4.3-1). The same error is emitted for the du command. The code in
git as of now does not look like it has been changed either:
https://github.com/rsnapshot/rsnapshot/blob/3b3fc2c1676b5f93f33671dd07d6569ec95c4dd4/rsnapshot-program.pl#L1086

KR

#573254#65
Date:
2021-06-04 01:57:26 UTC
From:
To: