Problems in Automated Backups With rdiff-backup

Discussion in 'HOWTO-Related Questions' started by capricorn, Jan 11, 2007.

  1. capricorn

    capricorn New Member

    hi !
    I am struggling in configuation of Automated Backups with rdiff-backup. I tried it many times but didnt get any success so thought to ask for problems i am facing.

    My server has k12ltsp distribution and the backup server has CentOS.
    STEP 1:
    K12ltsp Distribution has rdiff-backup-1.0.5-1.fc5 and CentOS distribution has
    rdiff-backup-1.0.5-1.el4.rf which i think are same version.

    STEP 2:
    I have created user as mentioned in step 2.
    and then i run command su -m rdiff-backup

    [root@localhost ~]# su -m rdiff-backup
    bash: /root/.bashrc: Permission denied
    bash-3.00$ whoami
    rdiff-backup

    cd /backup

    bash-3.00$ cd /backup/
    bash-3.00$ ssh-keygen -t rsa
    Generating public/private rsa key pair.
    Enter file in which to save the key (/backup/.ssh/id_rsa):
    /backup/.ssh/id_rsa already exists.
    Overwrite (y/n)? y
    Enter passphrase (empty for no passphrase):
    Enter same passphrase again:
    Your identification has been saved in /backup/.ssh/id_rsa.
    Your public key has been saved in /backup/.ssh/id_rsa.pub.
    The key fingerprint is:
    11:97:c7:66:70:e7:61:66:21:e2:91:0c:51:46:73:ca rdiff-backup@localhost.localdomain

    NEXT I have created file with contents as following:

    bash-3.00$ cat /backup/.ssh/config
    host hostname
    hostname myipaddress
    user root
    identityfile /backup/.ssh/id_rsa
    compression yes
    cipher blowfish
    protocol 2

    Next i change the permission of that file:

    bash-3.00$ chmod -R go-rwx /backup/.ssh
    bash-3.00$ ls -l /backup/.ssh
    total 16
    -rw------- 1 rdiff-backup rdiff-backup 124 Jan 10 22:35 config
    -rw------- 1 rdiff-backup rdiff-backup 883 Jan 10 22:33 id_rsa
    -rw------- 1 rdiff-backup rdiff-backup 244 Jan 10 22:33 id_rsa.pub
    -rw------- 1 rdiff-backup rdiff-backup 395 Jan 10 21:42 known_hosts

    When i tried to copy public key to server

    bash-3.00$ ssh-copy-id -i ~/.ssh/id_rsa.pub root@host ipaddress
    bash: ssh-copy-id: command not found
    Then what i did is

    bash-3.00$ scp ~/.ssh/id_rsa.pub root@host ipaddress:/public.tmp
    root@host ip address's password:
    /root/.ssh/id_rsa.pub: Permission denied

    Then i login in as root to my backup server n did this:

    [root@localhost ~]# scp /backup/.ssh/id_rsa.pub root@host ipaddress:/public.tmp
    root@host ipaddress 's password:
    id_rsa.pub 100% 244 0.2KB/s 00:00

    Then i login to my server and did this:
    [root@mainframe]# cat /public.tmp >> /root/.ssh/authorized_keys
    root@mainframe]# cat /root/.ssh/authorized_keys
    ssh-rsa AAAAB3.................................................= rdiff-backup@localhost.localdomain

    Then i prepand the text n its in one line
    command="rdiff-backup --server --restrict-read-only /",from="ipaddress",no-port-forwarding,no-X11-forwarding,no-pty ssh-rsa AAAAB3.................................................= rdiff-backup@localhost.localdomain

    [root@mainframe ~]# chmod -R go-rwx /root/.ssh
    I have uncomment the two lines in /etc/ssh/sshd_config
    [root@mainframe ~]# cat /etc/ssh/sshd_config
    RSAAuthentication yes
    PubkeyAuthentication yes
    [root@mainframe ~]# /etc/init.d/sshd restart
    Stopping sshd: [ OK ]
    Starting sshd: [ OK ]
    [root@mainframe ~]#

    STEP 4:
    bash-3.00$ whoami
    rdiff-backup
    bash-3.00$
    bash-3.00$ cd /backup/
    But it will ask me for password :(

    bash-3.00$ rdiff-backup ipaddress::/boot boot
    rdiff-backup@ipaddress's password:

    I am sending you all details so that u can figure it out well n tell me why this not working at my end.

    Regards.
     
    Last edited: Mar 8, 2007
  2. falko

    falko Super Moderator

    The problem might be in /root/.ssh/authorized_keys. It could also be caused by two different rdiff-backup versions (I'm not sure if yours are identical).
     
  3. capricorn

    capricorn New Member

    They are same only distribution is different.
     
  4. falko

    falko Super Moderator

    I think they're different. You can only be sure that they are the same if they have identical version numbers and are from the same distribution.
     
  5. capricorn

    capricorn New Member

    well there version number is same i.e 1.0.5 but distribution is different.
    rdiff-backup-1.0.5-1.fc5
    rdiff-backup-1.0.5-1.el4.rf

    U sure we can't configure it on different distributions ?
    Is there any howto available to configure rdifs-backup on CentOS as there is ssh-copy-id . Well i have seen ur's n matt posts but i wish i can found this package on CentOS.
    Regards.
     
  6. capricorn

    capricorn New Member

    Still problem with rdiff-backup

    Now i have the same version on fedora.
    Backupserver
    [root@mainframebkup /]# rpm -q rdiff-backup
    rdiff-backup-1.0.5-1.fc5

    Mainserver
    [root@mainframe ~]# rpm -q rdiff-backup
    rdiff-backup-1.0.5-1.fc5

    But still im having problem. Plz check me output n tell me wat to do .

    Step 2: [root@mainframebkup /]# su -m rdiff-backup
    bash: /root/.bashrc: Permission denied


    bash-3.1$ cd /backup/


    bash-3.1$ ssh-keygen -t rsa
    Generating public/private rsa key pair.
    Enter file in which to save the key (/backup/.ssh/id_rsa):
    /backup/.ssh/id_rsa already exists.
    Overwrite (y/n)? y
    Enter passphrase (empty for no passphrase):
    Enter same passphrase again:
    Your identification has been saved in /backup/.ssh/id_rsa.
    Your public key has been saved in /backup/.ssh/id_rsa.pub.
    The key fingerprint is:
    29:65:2f:dd:04:82:b1:61:b1:6d:65:14:23:77:40:c8 rdiff-backup@hostname
    bash-3.1$

    bash-3.1$ cat /backup/.ssh/config
    host server_backup
    hostname ip address
    user root
    identityfile /backup/.ssh/id_rsa
    compression yes
    cipher blowfish
    protocol 2

    bash-3.1$ chmod -R go-rwx /backup/.ssh

    when i follow your step i got error i.e
    bash-3.1$ ssh-copy-id -i ~/.ssh/id_rsa.pub root@ipaddress
    21
    /usr/bin/ssh-copy-id: ERROR: No identities found
    ( The thing i did here is as follow. I removed ~/.ssh from there.)
    bash-3.1$ pwd
    /backup/.ssh

    bash-3.1$ ssh-copy-id -i id_rsa.pub root@ipaddress
    10
    root@ipaddress's password:
    Now try logging into the machine, with "ssh 'root@ipaddress'", and check in:

    .ssh/authorized_keys

    to make sure we haven't added extra keys that you weren't expecting.

    bash-3.1$

    Now on main server.
    [root@mainframe ~]# cat /root/.ssh/authorized_keys
    ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEAv4ZaUtqxyrAHsU26nrEft8NAnU3ssdLtvPMqfFeUgm1s4GLMlZmKVGTf1otXFEJ43eT3w9D5LSuxpvADTyCfg0KL5EGEpabx7mnkHxTAyCws1Pb8o2PIGKTjxMdgBeK4Mq1MO+5kgPKVsQ+T8YcMo08vxUETrkIjdw98/VBceipBhakK+6HJaZJ8xjO5----------------
    == rdiff-backup@hostname
    step 3; Edit the publick key on main server.(its in one line)
    command="rdiff-backup --server --restrict-read-only /",from="ipaddress",no-port-forwarding,no-X11-forwarding,no-pty ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEAv4ZaUtqxyrAHsU26nrEft8NAnU3ssdLtvPMqfFeUgm1s4GLMlZmKVGTf1otXFEJ43eT3w9D5LSuxpvADTyCfg0KL5EGEpabx7mnkHxTAyCws1Pb8o2--------------------------------------------+NZWM6bXABRnw9NBHtnKFcmc1EpiFp6FhKOKR6KoYZS80C+NRpLZDV9uVDNMjuBHjwUobdpyWSiQ+EzXthxJgtmapMjLrlZqCz4HQ== rdiff-backup@server ip address

    Step 4 : testing
    bash-3.1$ rdiff-backup server_backup::/boot boot
    root@192.168.0.254's password:
    it ask me for password :(:(:(:(
     
    Last edited: Mar 8, 2007
  7. Hans

    Hans Moderator

    In the past, I had some problems with creating backups by using rdiff as well.
    The clue was that i did not use the vi editor, but another called nano which comes with Debian. When i started to use vi, i did not have any problems anymore. Maybe it works also for you.
     
  8. capricorn

    capricorn New Member

    I have read your post of vi and nano problem but i m using vi on fedora. I also think that i haven't done any thing wrong n checked all things 10 times but still not getting any success.
     
  9. Hans

    Hans Moderator

    Ok, you do not have nano, but you have vi.
    So, i would give it a try.
     
  10. capricorn

    capricorn New Member

    yes i m using vi editor and i have pasted all output . plz check it n give suggestion wat should i do.
     
  11. capricorn

    capricorn New Member

    need some more info

    Apart from above problem I want to know about this cron job last line
    40 2 * * * /usr/bin/rdiff-backup --exclude /tmp --exclude /mnt --exclude /proc --exclude /dev --exclude /cdrom --exclude /floppy server1_backup::/ /backup/server1

    " server1_backup::/ /backup/server1 "
    As in my case i put the host in config file as server_backup next my backup server name is
    bash-3.1$ hostname
    mainframebkup.rnd
    and its ip is 192.168.0.152 n i prefer to to use ip address then hostname.
    so in that case wat should i do to line /back/server1
    and also in which directory i found backups in backup server ?
     
  12. falko

    falko Super Moderator

    What's the output of
    Code:
    ls -la /backup
    ,
    Code:
    ls -la /backup/.ssh
    , and
    Code:
    grep rdiff-backup /etc/passwd
    ?
     
  13. capricorn

    capricorn New Member

    falko i will paste u output tomorrow but i have some query about this crontab
    i.e
    40 2 * * * /usr/bin/rdiff-backup --exclude /tmp --exclude /mnt --exclude /proc --exclude /dev --exclude /cdrom --exclude /floppy server1_backup::/ /backup/server1

    in the last text :://backup/server1
    wat this line is doing ? is this the hostname if yes how can i put ip address over here?
    becoz i dont get any password option when i do
    rdiff-backup server_backup::/boot boot
    so i thought to go ahead . if i get some problem i will ask you.
    Also where the data will be after the cron job will work ?
    Regards.
     
  14. capricorn

    capricorn New Member

    falko no need to reply for above post as i have rdiff working at home I got the above thing. . If i will face any other problem i will ask u.
    thanks.
     
    Last edited: Mar 6, 2007
  15. capricorn

    capricorn New Member

    falko it worked fine n even i backup my data from server to backup server day before yesterday. Today i checked it as i changed crontab timings and just execute command i.e rdiff-backup server_backup::/boot boot and got errors .

    bash-3.1$ rdiff-backup server_backup::/boot boot
    Traceback (most recent call last):
    File "/usr/bin/rdiff-backup", line 23, in ?
    rdiff_backup.Main.Main(sys.argv[1:])
    File "/usr/lib/python2.4/site-packages/rdiff_backup/Main.py", line 285, in Main
    take_action(rps)
    File "/usr/lib/python2.4/site-packages/rdiff_backup/Main.py", line 255, in take_action
    elif action == "backup": Backup(rps[0], rps[1])
    File "/usr/lib/python2.4/site-packages/rdiff_backup/Main.py", line 296, in Backup
    backup_set_fs_globals(rpin, rpout)
    File "/usr/lib/python2.4/site-packages/rdiff_backup/Main.py", line 418, in backup_set_fs_globals
    dest_fsa = rpout.conn.fs_abilities.get_fsabilities_readwrite(
    File "/usr/lib/python2.4/site-packages/rdiff_backup/fs_abilities.py", line 415, in get_fsabilities_readwrite
    return FSAbilities(desc_string).init_readwrite(
    File "/usr/lib/python2.4/site-packages/rdiff_backup/fs_abilities.py", line 152, in init_readwrite
    subdir.mkdir()
    File "/usr/lib/python2.4/site-packages/rdiff_backup/rpath.py", line 796, in mkdir
    self.conn.os.mkdir(self.path)
    OSError: [Errno 28] No space left on device: 'boot/rdiff-backup-data/rdiff-backup.tmp.0'
    Traceback (most recent call last):
    bash-3.1$ File "/usr/bin/rdiff-backup", line 23, in ?
    rdiff_backup.Main.Main(sys.argv[1:])
    File "/usr/lib/python2.4/site-packages/rdiff_backup/Main.py", line 285, in Main
    take_action(rps)
    File "/usr/lib/python2.4/site-packages/rdiff_backup/Main.py", line 253, in take_action
    connection.PipeConnection(sys.stdin, sys.stdout).Server()
    File "/usr/lib/python2.4/site-packages/rdiff_backup/connection.py", line 352, in Server
    self.get_response(-1)
    File "/usr/lib/python2.4/site-packages/rdiff_backup/connection.py", line 314, in get_response
    try: req_num, object = self._get()
    File "/usr/lib/python2.4/site-packages/rdiff_backup/connection.py", line 230, in _get
    raise ConnectionReadError("Truncated header string (problem "
    rdiff_backup.connection.ConnectionReadError: Truncated header string (problem probably originated remotely)

    Regards.
     
  16. falko

    falko Super Moderator

    What's the output of
    Code:
    df -h
    on both systems?
     
  17. capricorn

    capricorn New Member

    BACKUP SERVER:
    bash-3.1$ df -h
    Filesystem Size Used Avail Use% Mounted on
    /dev/ida!c0d2p1 17G 16G 0 100% /
    tmpfs 1014M 0 1014M 0% /dev/shm
    /dev/ida/c0d0p1 33G 177M 31G 1% /home


    MAIN SERVER :
    [root@mainserver~]# df -h
    Filesystem Size Used Avail Use% Mounted on
    /dev/hda2 37G 15G 20G 44% /
    /dev/hda1 99M 13M 81M 14% /boot
    tmpfs 505M 0 505M 0% /dev/shm
     
  18. falko

    falko Super Moderator

    Your backup server is full. You must free some space before you can create new backups.
     
  19. capricorn

    capricorn New Member

    ok
    My crontab file is also corrupt dont know how.
    when i do crontab -e and insert text in it and try to save it, it give me following error and when i press ENTER it again go to text of file.
    crontab.XXXXD7XkXt"
    "crontab.XXXXD7XkXt" E514: write error (file system full?)
    WARNING: Original file may be lost or damaged
    don't quit the editor until the file is successfully written!
    Press ENTER or type command to continue

    Also when i open the file i got the following error
    E297: Write error in swap file
    "/tmp/crontab.XXXXBEhvOv" 0L, 0C
    Press ENTER or type command to continue
     
    Last edited: Mar 14, 2007
  20. martinfst

    martinfst HowtoForge Supporter

    Same as till already said: clean up your full file systems 1st. Have you mounted /tmp on a separate filesystem? Do
    Code:
    ls -l /tmp
    to what's in there and what can be removed. Normally everything in /tmp can be deleted......
     

Share This Page