[SOLVED] Snapshot backups not running

This forum is dedicated to advanced help and support :

Ask here your questions about advanced usage of Mageia. For example you may post here all your questions about network and automated installs, complex server configurations, kernel tuning, creating your own Mageia mirrors, and all tasks likely to be touchy even for skilled users.

[SOLVED] Snapshot backups not running

Postby isaiah36 » Dec 22nd, '15, 05:14

Hello,

I have enabled Snapshots and pointed it to a directory on an external USB drive. I am doing only the /etc and /usr directories by snapshot, and using cloud backup for the /home directories. Here is the log output

Code: Select all
Dec 21 07:01:01 localhost rsnapshot[6088]: /usr/bin/rsnapshot hourly: ERROR: At least one backup level must be set. rsnapshot can not continue.


Any suggestions will be much appreciated. TIA
Last edited by isaiah36 on Dec 24th, '15, 13:10, edited 1 time in total.
User avatar
isaiah36
 
Posts: 109
Joined: Dec 21st, '15, 13:18

Re: Snapshot backups not running

Postby isaiah36 » Dec 22nd, '15, 07:03

I found a possible solution through google search, and edited the /etc/rsnapshot.conf file by adding the lines

Code: Select all
interval hourly 6
interval daily 7


(The deafult installation of Mageia 5 does not include a text editor. I installed 'kate' first but was unable to run it as root because no X session was found for root. Then I installed 'gedit' and successfully edited the .conf file. One could also use the chown command to temporarily give ownership of the file to one's user account for purposes of editing.)

Now, I will wait and see if the backups directory gets populated.
User avatar
isaiah36
 
Posts: 109
Joined: Dec 21st, '15, 13:18

Re: Snapshot backups not running

Postby filip » Dec 22nd, '15, 10:31

Hi isaiah36 and welcome around.

It seems you use KDE so IIRC 'kwrite' is installed by default.
For purpose of editing configuration files owned by root or any other nonuser owned files I use Midnight Commander (called mc in mcc) which among other very useful stuff have also editor. I also recommend 'colorprompt' as it colors the CLI prompt by user (root prompt is red, users is green).

BTW I also use 'rsnapshot' a lot as it can be almost a lifesaver. I even started a project of a cheap remote backup just now. I already modded two USB plugs to WRT54GL and I need to change it's firmware to DD-WRT with support for Samba and then configure all that.
filip
 
Posts: 475
Joined: May 4th, '11, 22:10
Location: Kranj, Slovenia

Re: Snapshot backups not running

Postby isaiah36 » Dec 22nd, '15, 10:43

Hi Filip,

Thanks for the welcome! I tried Kwrite at first just to read the content of the file but it did not open the .conf file, maybe because of permissions. I hope to do as little manual editing of config as possible. I would like to have snapshots to restore from in case I have to reinstall the system. This Mageia 5 is as complete and smooth as any Linux I have ever used, it is in the Ubuntu league. This snapshot problem surprises me because the issue appears to be known since 2012 at least, maybe earlier.
User avatar
isaiah36
 
Posts: 109
Joined: Dec 21st, '15, 13:18

Re: Snapshot backups not running

Postby isaiah36 » Dec 23rd, '15, 11:48

My edit of the .conf file evidently did not work. I am still not seeing any files in the backups directory.
User avatar
isaiah36
 
Posts: 109
Joined: Dec 21st, '15, 13:18

Re: Snapshot backups not running

Postby filip » Dec 23rd, '15, 23:19

It's known that Snapshots works unreliably. But you can configure it manually.
You can test your config with rsnapshot -t hourly. Your friend is also: man rsnapshot.

Do you also have rsnapshot files in cron?

Here's my modified working example from cron.hourly. You can adjust it to daily, weekly, monthly and yearly directories if needed.
Code: Select all
$ cat /etc/cron.hourly/rsnapshot
#!/bin/sh
# WARNING: This file was autogenerated from /etc/rsnapshot.conf in Mageia
# WARNING: Please alter /etc/rsnapshot.conf instead of /etc/cron.%s/rsnapshot
#          Then rerun draksnapshot-config
#
# /etc/cron.hourly/rsnapshot: crontab fragment for rsnapshot

/usr/bin/rsnapshot hourly > /dev/null


HTH.
filip
 
Posts: 475
Joined: May 4th, '11, 22:10
Location: Kranj, Slovenia

Re: Snapshot backups not running

Postby isaiah36 » Dec 24th, '15, 05:10

No, I don't. I'm not really a fan of tinkering with the system. It doesn't make sense for me to divert a lot of time to learning system administration. I ran rsync manually and made a backup of the /usr and /etc directories. It skipped a lot of "non regular files" but the backup version is larger than the system version by about 200 Mb so I figure it followed the symlinks and backed up those directories as well. I will run it again with the -av argument after deleting this backup. As long as I have one clean backup of the fully functional system I'm good. I don't need it to run daily - or do I? Do the /usr and /etc directories change a lot from normal use?
User avatar
isaiah36
 
Posts: 109
Joined: Dec 21st, '15, 13:18

Re: Snapshot backups not running

Postby isaiah36 » Dec 24th, '15, 05:25

This is what my /etc/rsnapshot.conf looks like

Code: Select all
#################################################
# rsnapshot.conf - rsnapshot configuration file #
#################################################
#                                               #
# PLEASE BE AWARE OF THE FOLLOWING RULES:       #
#                                               #
# This file requires tabs between elements      #
#                                               #
# Directories require a trailing slash:         #
#   right: /home/                               #
#   wrong: /home                                #
#                                               #
#################################################

#######################
# CONFIG FILE VERSION #
#######################

config_version   1.2

###########################
# SNAPSHOT ROOT DIRECTORY #
###########################

# All snapshots will be stored under this root directory.
#
snapshot_root   /home/isaiah/Downloads/backups

# If no_create_root is enabled, rsnapshot will not automatically create the
# snapshot_root directory. This is particularly useful if you are backing
# up to removable media, such as a FireWire or USB drive.
#
no_create_root   1

#################################
# EXTERNAL PROGRAM DEPENDENCIES #
#################################

# LINUX USERS:   Be sure to uncomment "cmd_cp". This gives you extra features.
# EVERYONE ELSE: Leave "cmd_cp" commented out for compatibility.
#
# See the README file or the man page for more details.
#
cmd_cp      /usr/bin/cp

# uncomment this to use the rm program instead of the built-in perl routine.
#
cmd_rm      /usr/bin/rm

# rsync must be enabled for anything to work. This is the only command that
# must be enabled.
#
cmd_rsync   /usr/bin/rsync

# Uncomment this to enable remote ssh backups over rsync.
#
cmd_ssh   /usr/bin/ssh

# Comment this out to disable syslog support.
#
cmd_logger   /usr/bin/logger

# Uncomment this to specify the path to "du" for disk usage checks.
# If you have an older version of "du", you may also want to check the
# "du_args" parameter below.
#
cmd_du      /usr/bin/du

# Uncomment this to specify the path to rsnapshot-diff.
#
cmd_rsnapshot_diff   /usr/bin/rsnapshot-diff

# Specify the path to a script (and any optional arguments) to run right
# before rsnapshot syncs files
#
#cmd_preexec   /path/to/preexec/script

# Specify the path to a script (and any optional arguments) to run right
# after rsnapshot syncs files
#
#cmd_postexec   /path/to/postexec/script

#########################################
#           BACKUP INTERVALS            #
# Must be unique and in ascending order #
# i.e. hourly, daily, weekly, etc.      #
#########################################


############################################
#              GLOBAL OPTIONS              #
# All are optional, with sensible defaults #
############################################

# Verbose level, 1 through 5.
# 1     Quiet           Print fatal errors only
# 2     Default         Print errors and warnings only
# 3     Verbose         Show equivalent shell commands being executed
# 4     Extra Verbose   Show extra verbose information
# 5     Debug mode      Everything
#
verbose      2

# Same as "verbose" above, but controls the amount of data sent to the
# logfile, if one is being used. The default is 3.
#
loglevel   3

# If you enable this, data will be written to the file you specify. The
# amount of data written is controlled by the "loglevel" parameter.
#
logfile   /var/log/rsnapshot

# If enabled, rsnapshot will write a lockfile to prevent two instances
# from running simultaneously (and messing up the snapshot_root).
# If you enable this, make sure the lockfile directory is not world
# writable. Otherwise anyone can prevent the program from running.
#
lockfile   /var/run/rsnapshot.pid

# Default rsync args. All rsync commands have at least these options set.
#
#rsync_short_args   -a
#rsync_long_args   --delete --numeric-ids --relative --delete-excluded

# ssh has no args passed by default, but you can specify some here.
#
#ssh_args   -p 22

# Default arguments for the "du" program (for disk space reporting).
# The GNU version of "du" is preferred. See the man page for more details.
# If your version of "du" doesn't support the -h flag, try -k flag instead.
#
#du_args   -csh

# If this is enabled, rsync won't span filesystem partitions within a
# backup point. This essentially passes the -x option to rsync.
# The default is 0 (off).
#
#one_fs      0

# The include and exclude parameters, if enabled, simply get passed directly
# to rsync. If you have multiple include/exclude patterns, put each one on a
# separate line. Please look up the --include and --exclude options in the
# rsync man page for more details on how to specify file name patterns.
#
#include   ???
#include   ???
exclude   /home/isaiah/Downloads/backups
#exclude   ???

# The include_file and exclude_file parameters, if enabled, simply get
# passed directly to rsync. Please look up the --include-from and
# --exclude-from options in the rsync man page for more details.
#
#include_file   /path/to/include/file
#exclude_file   /path/to/exclude/file

# If your version of rsync supports --link-dest, consider enable this.
# This is the best way to support special files (FIFOs, etc) cross-platform.
# The default is 0 (off).
#
link_dest   1

# When sync_first is enabled, it changes the default behaviour of rsnapshot.
# Normally, when rsnapshot is called with its lowest interval
# (i.e.: "rsnapshot hourly"), it will sync files AND rotate the lowest
# intervals. With sync_first enabled, "rsnapshot sync" handles the file sync,
# and all interval calls simply rotate files. See the man page for more
# details. The default is 0 (off).
#
#sync_first   0

# If enabled, rsnapshot will move the oldest directory for each interval
# to [interval_name].delete, then it will remove the lockfile and delete
# that directory just before it exits. The default is 0 (off).
#
#use_lazy_deletes   0

# Number of rsync re-tries. If you experience any network problems or
# network card issues that tend to cause ssh to crap-out with
# "Corrupted MAC on input" errors, for example, set this to a non-zero
# value to have the rsync operation re-tried
#
#rsync_numtries 0

###############################
### BACKUP POINTS / SCRIPTS ###
###############################

# LOCALHOST
backup   /etc/   localhost/
backup   /usr/   localhost/
#backup   /var/log/rsnapshot      localhost/
#backup   /etc/passwd   localhost/
#backup   /home/foo/My Documents/      localhost/
#backup   /foo/bar/   localhost/   one_fs=1, rsync_short_args=-urltvpog
#backup_script   /usr/bin/backup_pgsql.sh   localhost/postgres/

# EXAMPLE.COM
#backup_script   /bin/date "+ backup of example.com started at %c"   unused1
#backup   root@example.com:/home/   example.com/   +rsync_long_args=--bwlimit=16,exclude=core
#backup   root@example.com:/etc/   example.com/   exclude=mtab,exclude=core
#backup_script   ssh root@example.com "mysqldump -A > /var/db/dump/mysql.sql"   unused2
#backup   root@example.com:/var/db/dump/   example.com/
#backup_script   /bin/date   "+ backup of example.com ended at %c"   unused9

# CVS.SOURCEFORGE.NET
#backup_script   /usr/bin/backup_rsnapshot_cvsroot.sh   rsnapshot.cvs.sourceforge.net/

# RSYNC.SAMBA.ORG
#backup   rsync://rsync.samba.org/rsyncftp/   rsync.samba.org/rsyncftp/


Right off the top I notice it says, " Directories require a trailing slash" but below snapshot_root has been designated without a trailing slash -- so that might be it? I am going to try placing a trailing slash there and see what happens.

I also have an identical file to yours in /etc/cron.hourly - it might make sense for me to move that to daily for now, and weekly when I stop tinkering.
User avatar
isaiah36
 
Posts: 109
Joined: Dec 21st, '15, 13:18

Re: Snapshot backups not running

Postby isaiah36 » Dec 24th, '15, 07:37

Sorry, I was careless. My /etc/cron.hourly/rsnapshot file is not identical to yours - the first line is missing. Should I add it to mine?
User avatar
isaiah36
 
Posts: 109
Joined: Dec 21st, '15, 13:18

Re: Snapshot backups not running

Postby isaiah36 » Dec 24th, '15, 08:25

The man file for rsnapshot says the following -

Backup levels must be specified in the config file in order,
from most frequent to least frequent. The first entry is the one
which will be synced with the backup points. The subsequent
backup levels (e.g., daily, weekly, etc) simply rotate, with
each higher backup level pulling from the one below it for its
.0 directory.

retain hourly 6
retain daily 7
retain weekly 4


I did not see any such lines in rsnapshot.conf so I added them -- using Tab separators not spaces -- along with the explanation above it, commented out of course. Now, let's see what happens. When I type rsnapshot -t hourly as su I no longer get the error message, rather I get this

Code: Select all
6103 (process ID) old priority 0, new priority 19
echo 6101 > /var/run/rsnapshot.pid
mkdir -m 0755 -p /home/isaiah/Downloads/backups/hourly.0/
/usr/bin/rsync -a --delete --numeric-ids --relative --delete-excluded \
    --exclude=/home/isaiah/Downloads/backups/ /etc \
    /home/isaiah/Downloads/backups/hourly.0/localhost/
mkdir -m 0755 -p /home/isaiah/Downloads/backups/hourly.0/
/usr/bin/rsync -a --delete --numeric-ids --relative --delete-excluded \
    --exclude=/home/isaiah/Downloads/backups/ /usr \
    /home/isaiah/Downloads/backups/hourly.0/localhost/
touch /home/isaiah/Downloads/backups/hourly.0/


Just to be safe, I also ran rsync manually to make copies of the /usr and /etc directories. I don't see a Restore option in the Drakconf interface for Snapshots, so I guess if I ever have to do a restore I will have to do it from command line. Is that correct?
User avatar
isaiah36
 
Posts: 109
Joined: Dec 21st, '15, 13:18

Re: Snapshot backups not running

Postby isaiah36 » Dec 24th, '15, 13:09

SUCCESS! The backups directory is now being populated by Snapshots properly. The mod of the cron file by Filip was not needed in my case. The backup levels mod of the /etc/rsnapshot.conf file is the solution.
User avatar
isaiah36
 
Posts: 109
Joined: Dec 21st, '15, 13:18

Re: [SOLVED] Snapshot backups not running

Postby doktor5000 » Dec 24th, '15, 13:28

So if our tool for that, which is draksnapshot-config, does not produce a valid configuration anymore, could you please open a bugreport for that?
Cauldron is not for the faint of heart!
Caution: Hot, bubbling magic inside. May explode or cook your kittens!
----
Disclaimer: Beware of allergic reactions in answer to unconstructive complaint-type posts
User avatar
doktor5000
 
Posts: 17659
Joined: Jun 4th, '11, 10:10
Location: Leipzig, Germany

Re: [SOLVED] Snapshot backups not running

Postby isaiah36 » Dec 24th, '15, 13:30

Sure. How do I do that? Point me to the page.
User avatar
isaiah36
 
Posts: 109
Joined: Dec 21st, '15, 13:18

Re: [SOLVED] Snapshot backups not running

Postby doktor5000 » Dec 24th, '15, 13:33

Sorry, totally forgot :)

https://wiki.mageia.org/en/How_to_report_a_bug_properly
For completeness's sake and also to allow others to follow up on that bug report, please also post the link to it here in the thread, thanks.
Cauldron is not for the faint of heart!
Caution: Hot, bubbling magic inside. May explode or cook your kittens!
----
Disclaimer: Beware of allergic reactions in answer to unconstructive complaint-type posts
User avatar
doktor5000
 
Posts: 17659
Joined: Jun 4th, '11, 10:10
Location: Leipzig, Germany

Re: [SOLVED] Snapshot backups not running

Postby isaiah36 » Dec 24th, '15, 14:03

User avatar
isaiah36
 
Posts: 109
Joined: Dec 21st, '15, 13:18

Re: [SOLVED] Snapshot backups not running

Postby doktor5000 » Dec 24th, '15, 14:49

Thanks :D
Cauldron is not for the faint of heart!
Caution: Hot, bubbling magic inside. May explode or cook your kittens!
----
Disclaimer: Beware of allergic reactions in answer to unconstructive complaint-type posts
User avatar
doktor5000
 
Posts: 17659
Joined: Jun 4th, '11, 10:10
Location: Leipzig, Germany

Re: [SOLVED] Snapshot backups not running

Postby peterdit » Nov 27th, '19, 13:56

hello,
with ths entry in crontab
Code: Select all
5 9 * * *   root   /bin/rsnapshot hourly
, rsnapshot is running at 09:05
Peter
peterdit
 
Posts: 3
Joined: Feb 16th, '12, 14:59

Re: [SOLVED] Snapshot backups not running

Postby doktor5000 » Nov 27th, '19, 18:20

You may want to look at the date of the last reply ... that was 4 years ago, and the question was not really about the crontab entry.
Cauldron is not for the faint of heart!
Caution: Hot, bubbling magic inside. May explode or cook your kittens!
----
Disclaimer: Beware of allergic reactions in answer to unconstructive complaint-type posts
User avatar
doktor5000
 
Posts: 17659
Joined: Jun 4th, '11, 10:10
Location: Leipzig, Germany

Re: [SOLVED] Snapshot backups not running

Postby peterdit » Nov 28th, '19, 09:38

Hi doc,
but it is a solution to get around the "old" bugs 17390, 19195, 21260, 22425
peterdit
 
Posts: 3
Joined: Feb 16th, '12, 14:59

Re: [SOLVED] Snapshot backups not running

Postby doktor5000 » Nov 28th, '19, 13:56

Then it would probably be a better idea to post that in the relevant bug reports instead of here ?
Cauldron is not for the faint of heart!
Caution: Hot, bubbling magic inside. May explode or cook your kittens!
----
Disclaimer: Beware of allergic reactions in answer to unconstructive complaint-type posts
User avatar
doktor5000
 
Posts: 17659
Joined: Jun 4th, '11, 10:10
Location: Leipzig, Germany

Re: [SOLVED] Snapshot backups not running

Postby peterdit » Nov 29th, '19, 09:42

done, in bug 22425
peterdit
 
Posts: 3
Joined: Feb 16th, '12, 14:59


Return to Advanced support

Who is online

Users browsing this forum: No registered users and 1 guest