PDA

View Full Version : Amrecover : Connection reset by peer



blakkheim.gw
January 17th, 2007, 07:54 AM
Hello everyone,

I've followed all how-to available on differents amanda sites but I can't get the amrecover command working.

This is my config :
1 Amanda server 2.5.1p2
1 Amanda client 2.5.1p2

Everything is ok to get amdump working and amcheck doesn't display any error. I can do an amrecover on the server itself (cause the server does backup itself, too).

On the server :
- /var/spool/amanda/.amandahosts :

server.domain amanda amdump
server.domain root amindexd amidxtaped
client.domain root amindexd amidxtaped
- /etc/hosts is ok and contains the full qualified name of both the server and the client
- /etc/amanda/amanda-client.conf :

conf "daily"
index_server "server.domain"
tape_server "server.domain"
tapedev "/dev/nst0"
auth "bsdtcp"

- /etc/xinetd.d/amanda :


service amanda
{
socket_type = stream
protocol = tcp
wait = no
user = amanda
group = amanda
groups = yes
server = /usr/libexec/amandad
server_args = -auth=bsdtcp amdump amindexd amidxtaped
# You need to ensure this points to your Amanda server!
# Don't just remove it!
only_from = server.domain client.domain
disable = no
}

service amandaidx
{
socket_type = stream
protocol = tcp
wait = no
user = amanda
group = amanda
groups = yes
server = /usr/libexec/amindexd
# You need to ensure this points to your Amanda server!
# Don't just remove it!
only_from = server.domain client.domain
disable = no
}

service amidxtape
{
socket_type = stream
protocol = tcp
wait = no
user = amanda
group = amanda
groups = yes
server = /usr/libexec/amidxtaped
# You need to ensure this points to your Amanda server!
# Don't just remove it!
only_from = server.domain client.domain
disable = no
}


- When I perform a netstat -a on the server :

tcp 0 0 *:amanda *:* LISTEN
tcp 0 0 *:amandaidx *:* LISTEN
tcp 0 0 *:amidxtape *:* LISTEN



On the client :
- /var/spool/amanda/.amandahosts :

server.domain amanda amdump
- /etc/amanda/amanda-client.conf :

conf "daily"
index_server "server.domain"
tape_server "server.domain"
tapedev "/dev/nst0"
auth "bsdtcp"


- /etc/xinetd.d/amanda :

service amanda
{
socket_type = stream
protocol = tcp
wait = no
user = amanda
group = amanda
groups = yes
server = /usr/libexec/amandad
server_args = -auth=bsdtcp amdump amindexd amidxtaped
# You need to ensure this points to your Amanda server!
# Don't just remove it!
only_from = server.domain
disable = no
}

service amandaidx
{
socket_type = stream
protocol = tcp
wait = no
user = amanda
group = amanda
groups = yes
server = /usr/libexec/amindexd
# You need to ensure this points to your Amanda server!
# Don't just remove it!
disable = yes
}

service amidxtape
{
socket_type = stream
protocol = tcp
wait = no
user = amanda
group = amanda
groups = yes
server = /usr/libexec/amidxtaped
# You need to ensure this points to your Amanda server!
# Don't just remove it!
disable = yes
}


But, when I perform a amrecover on my client, I get this message :
AMRECOVER Version 2.5.1p2. Contacting server on -nameofclient- ...
[request failed: recv error: Connection reset by peer]

I've tried writing the complete amrecover command with options, like this :
amrecover -s server.domain -t server.domain -d /dev/nst0
but I get the same message.

And the weird thing is, when I look in the client logs (/var/spool/amanda/tmp/client/daily/amrecover<timestamp>.debug), I see that the client try to connect to its own IP address instead of the server !

...
amrecover: connect_port: Skip port 526: Owned by tempo.
amrecover: connect_port: Try port 527: Available -
amrecover: connected to 192.168.136.170.10080 <--- client IP address
amrecover: our side is 0.0.0.0.527
amrecover: try_socksize: send buffer size is 65536
amrecover: try_socksize: receive buffer size is 65536
security_stream_seterr(0x805be68, recv error: Connection reset by peer)
security_seterror(handle=0x805b9e8, driver=0xb7edd140 (BSDTCP) error=recv error: Connection reset by peer)
security_close(handle=0x805b9e8, driver=0xb7edd140 (BSDTCP))
security_stream_close(0x805be68)


Any help would be very very very appreciated.

Thanks.

ppragin
January 17th, 2007, 09:52 AM
Hello,

The reason you are having connection issues is because your xinetd configs are incorrect.
Please read this document to find a solution:
http://www.zmanda.com/quick-backup-setup.html

Pavel
Thanks

blakkheim.gw
January 18th, 2007, 12:01 AM
Hello,

Thanks for your reply. I've tried putting in my xinetd amanda file the same lines that in the tutorial. But if I remove the only_from directive in the xinetd amanda service config file, both on the client and the server, I got an error message while trying to perform an amcheck. If I put the directive allowing everyone connecting to this service (only_from = 0.0.0.0), the amcheck is ok.
But, now when I launch an amrecover from the client, as user root, I got the following message :

AMRECOVER Version 2.5.1p2. Contacting server on -clientname- ...
NAK: user root from client.domain is not allowed to execute the service amindexd: Please add "amindexd amidxtaped" to the line in /var/spool/amanda/.amandahosts


On the server, the lines in the .amandahosts file are ok :


server.domain amanda amdump
server.domain root amindexd amidxtaped
client.domain root amindexd amidxtaped


But, as I said before, I'm sure that the client is trying to connect to itself and not to the server.domain as indicated in /etc/amanda/amanda-client.conf

Even if I explicitly give it the name of server with :


amrecover -s server.domain -t server.domain

it gives me the same answer..

By the way, my xinetd amanda service file, now looks like this :
On the server :

service amanda
{
disable = no
socket_type = stream
protocol = tcp
wait = no
user = amanda
group = amanda
groups = yes
server = /usr/libexec/amandad
server_args = -auth=bsdtcp amdump amindexd amidxtaped
only_from = 0.0.0.0
}


On the client :


service amanda
{
disable = no
socket_type = stream
protocol = tcp
wait = no
user = amanda
group = amanda
groups = yes
server = /usr/libexec/amandad
server_args = -auth=bsdtcp amdump
only_from = 0.0.0.0
}


Thanks for replies.

blakkheim.gw
January 18th, 2007, 01:54 AM
I finally found the reason of my problem. In fact, my Amanda client is set on a Gentoo server. Each time I launched amrecover, it tried to connect to the Amanda server set in the environement variable $AMANDA_SERVER
But the problem is that even if a /etc/amanda/amanda-client.conf exists, amrecover doesn't override the $AMANDA_SERVER variable with the settings contained in this file nor with the amrecover command line options.. Strange.
So, on Gentoo, the solution is to edit the file /etc/env.d/97amanda and to change this :

AMANDA_SERVER=server.domain
AMANDA_SERVER_INDEX=server.domain
AMANDA_SERVER_TAPE=server-domain


Then, as root, type :


env-update && source /etc/profile


Then, it works. At least for me.
If it can help...