Lorenz
2014-Feb-10 05:38 UTC
/usr/bin/ssh not found when rsync is executed within rsnapshot
Hello,
yesterday i posted this issue on snapshot-discuss at listsourceforge.net
(subject:
wondering why backup wont start), but after reading the FAQ and searching the
bugzilla DB i thought it could help to post here as well.
i have a problem. But let me first describe my setup. i followed this howto:
http://dev.kprod.net/?q=linux-backup-rsnapshot-no-root
Now there is a backup server rpi-home and a remote host debx40. On both these
computers there is debian jessie (with rsnapshot version 1.3.1) installed, there
is a user backupuser and as far as i can see the remote login with password for
that user works:
backupuser at rpi-home ~ $ ssh debx40 -i ~/.ssh/id_rsa
Linux debx40 3.12-1-486 #1 Debian 3.12.9-1 (2014-02-01) i686
###some greeting lines###
$ whoami
backupuser
here is the result of
grep -v "#" /etc/rsnapshot | grep [a-z]
i.e. the /etc/rsnapshot minus the comments and the empty lines:
config_version 1.2
snapshot_root /media/extfp/Backup/rsnapshot/test/
no_create_root 1
cmd_cp /bin/cp
cmd_rm /bin/rm
cmd_rsync /usr/bin/rsync
cmd_ssh /usr/bin/ssh
cmd_logger /usr/bin/logger
retain hourly 6
retain daily 7
retain weekly 4
verbose 5
loglevel 5
logfile /var/log/rsnapshot.log
lockfile /var/run/rsnapshot.pid
rsync_long_args -ev --rsync-path=/home/backupuser/rsync-wrapper.sh
ssh_args -i /home/backupuser/.ssh/id_rsa
link_dest 0
rsync_numtries 1
backup backupuser at debx40:/ debx40/
and this is the content of /home/backupuser/rsync-wrapper.sh on the remote
debx40.
#!/bin/sh
date >> /home/backupuser/backuplog
echo $@ >> /home/backupuser/backuplog
/usr/bin/sudo /usr/bin/rsync "$@";
in the /etc/sudoers there is a line
backupuser ALL=NOPASSWD: /usr/bin/rsync
when i enter e.g. sudo rsnapshot -D hourly on the backup server rpi-home i get
this
require Lchown
Lchown module loaded successfully
Setting locale to POSIX "C"
echo 4702 > /var/run/rsnapshot.pid
mkdir -m 0755 -p /media/extfp/Backup/rsnapshot/test/hourly.0/
/usr/bin/rsync -av -ev --rsync-path=/home/backupuser/rsync-wrapper.sh \
--rsh="/usr/bin/ssh -i /home/backupuser/.ssh/id_rsa" backupuser at
debx40:/ \
/media/extfp/Backup/rsnapshot/test/hourly.0/debx40/
rsync: Failed to exec /usr/bin/ssh -i /home/backupuser/.ssh/id_rsa: No such file
or directory (2)
rsync error: error in IPC code (code 14) at pipe.c(85) [Receiver=3.1.0]
rsync: connection unexpectedly closed (0 bytes received so far) [Receiver]
rsync error: error in rsync protocol data stream (code 12) at io.c(226)
[Receiver=3.1.0]
----------------------------------------------------------------------------
rsnapshot encountered an error! The program was invoked with these options:
/usr/bin/rsnapshot -D hourly
----------------------------------------------------------------------------
ERROR: /usr/bin/rsync returned 12 while processing backupuser at debx40:/
/usr/bin/logger -i -p user.err -t rsnapshot /usr/bin/rsnapshot -D hourly: \
ERROR: /usr/bin/rsync returned 12 while processing backupuser at debx40:/
touch /media/extfp/Backup/rsnapshot/test/hourly.0/
No directory to delete: /media/extfp/Backup/rsnapshot/test/_delete.4702
rm -f /var/run/rsnapshot.pid
/usr/bin/logger -i -p user.err -t rsnapshot /usr/bin/rsnapshot -D hourly: \
ERROR: /usr/bin/rsnapshot -D hourly: completed, but with some errors
I suppose the important info is in that line
rsync: Failed to exec /usr/bin/ssh -i /home/backupuser/.ssh/id_rsa: No such file
or directory (2)
but surprisingly to me: the Backup starts when i do
sudo /usr/bin/rsync -av -ev --rsync-path=/home/backupuser/rsync-wrapper.sh \
--rsh="/usr/bin/ssh -i /home/backupuser/.ssh/id_rsa" backupuser at
debx40:/ \
/media/extfp/Backup/rsnapshot/test/hourly.0/debx40/
, which is the exact same command (copy-pasted from the rsnapshot output) that
caused the error
in the first place. Except the sudo in front of it.
What could be the reason? How could i debug this?
--
kind Regards
Lorenz from Greifswald
Paul Slootman
2014-Feb-10 09:44 UTC
/usr/bin/ssh not found when rsync is executed within rsnapshot
On Mon 10 Feb 2014, Lorenz wrote:> grep -v "#" /etc/rsnapshot | grep [a-z] > i.e. the /etc/rsnapshot minus the comments and the empty lines:I'd recommend using 'grep .' to find non-empty lines... shorter and more accurate :-)> rsync_long_args -ev --rsync-path=/home/backupuser/rsync-wrapper.sh-e is the short version of --rsh so I don't know what you're trying to do here... use the 'v' command instead of (the default) ssh? Probably not.> /usr/bin/rsync -av -ev --rsync-path=/home/backupuser/rsync-wrapper.sh \ > --rsh="/usr/bin/ssh -i /home/backupuser/.ssh/id_rsa" backupuser at debx40:/ \ > /media/extfp/Backup/rsnapshot/test/hourly.0/debx40/ > rsync: Failed to exec /usr/bin/ssh -i /home/backupuser/.ssh/id_rsa: No such file or directory (2)Besides the extraneous -e option this should work. The error message is a bit misleading though. Make sure that there are no "wrong" whitespace characters in there. I've fallen into the trap of copy&pasting commands / configs from websites and having them fail mysteriously, until I noticed I could not left-shift those lines in vim with << . Those leading spaces were not spaces but "no-break spaces", hex value 0x80. So check your config / scripts with "LANG=C cat -v /etc/rsnapshot" etc.> What could be the reason? How could i debug this?I often use "strace -f -e execve command ..." and / or "strace -f -e execve command ..." in such cases to see what it is really trying to run. Paul
Chris Davies
2014-Feb-14 22:33 UTC
/usr/bin/ssh not found when rsync is executed within rsnapshot
On 10/02/14 05:38, Lorenz wrote: > i have a problem. But let me first describe my setup. [...rsnapshot configuration...] > cmd_ssh /usr/bin/ssh > ssh_args -i /home/backupuser/.ssh/id_rsa > rsync: Failed to exec /usr/bin/ssh -i /home/backupuser/.ssh/id_rsa: No such file or directory (2) There's a bug in some versions of rsnapshot that causes it to try and execute cmd_ssh + ssh_args as a single command. The workaround is either to put as much of ssh_args as possible into $HOME/.ssh/config for the specific target host, or to create a /usr/local/bin/ssh-for-rsnapshot type script that incorporates the call to ssh with the relevant arguments. Chris -------------- next part -------------- A non-text attachment was scrubbed... Name: smime.p7s Type: application/pkcs7-signature Size: 3746 bytes Desc: S/MIME Cryptographic Signature URL: <http://lists.samba.org/pipermail/rsync/attachments/20140214/4f4e4304/attachment.bin>