Symptoms
The pba_migrate script fails to connect to servers with the error messages provided below:
[0s] [DEBUG] [SSH::Connection] Init SSH using password authentification
[1m 21s] [DIE] [SSH::Connection] Error while init transport: Connection closed by remote host. at /usr/share/perl5/vendor_perl/Net/SSH/Perl/AuthMgr.pm line 143
or
[0s] [DEBUG] [SSH::Connection] Init SSH using password authentification
[3m 0s] [DIE] [SSH::Connection] Error while init transport: timeout at /usr/local/bm/tools/mig2rh6/SSH.pm line 136.
Cause
The problem lies in the Net::SSH::Perl module which fails to generate random data for securing a connection in a timely fashion; see the following thread on Perl website for more details - http://www.nntp.perl.org/group/perl.beginners/2009/02/msg106311.html.
Resolution
1) Make sure the Math::BigInt::GMP Perl module is installed on the server where the migration script is being executed:
[root@pba-migration pba-migration]# rpm -qa | grep GMP
perl-Math-BigInt-GMP-1.24-5.el6.x86_64
perl-Math-GMP-2.06-5.el6.x86_64
2) Make sure /dev/random produces random data with enough speed.
For example, this is a bad behavior (the command hangs and is interrupted by pressing Ctrl-C):
[root@pba-migration pba-migration]# dd if=/dev/random of=/tmp/rnd bs=1024 count=10
^C0+2 records in
0+2 records out
28 bytes (28 B) copied, 209.539 s, 0.0 kB/s
And this is a good one (executes instantly):
[root@pba-migration pba-migration]# dd if=/dev/random of=/tmp/rnd bs=1024 count=10
0+10 records in
0+10 records out
1197 bytes (1.2 kB) copied, 0.000892964 s, 1.3 MB/s
You can fix /dev/random by enabling the *rngd *daemon. It may complain about kernel modules:
[root@pba-migration pba-migration]# /etc/init.d/rngd start
Starting rngd: can't open entropy source(tpm or intel/amd rng)
Maybe RNG device modules are not loaded [FAILED]
If this happens, you can configure it to use /dev/urandom - put the following lines in the /etc/sysconfig/rngd file:
# Add extra options here
EXTRAOPTIONS="-r /dev/urandom"
Note: If /dev/random shows bad behavior inside Parallels Virtuozzo Container, the issue should be fixed on the hardware node, not inside the container.