Bug 1167916

Summary: P2V: invalid conversion server prints unexpected end of file waiting for password prompt.
Product: Red Hat Enterprise Linux 7 Reporter: Richard W.M. Jones <rjones>
Component: libguestfsAssignee: John Eckersberg <jeckersb>
Status: CLOSED ERRATA QA Contact: Virtualization Bugs <virt-bugs>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 7.2CC: cm-r, dyuan, juzhou, mbooth, mxie, mzhan, ptoscano, tzheng
Target Milestone: rc   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard: P2V
Fixed In Version: libguestfs-1.32.5-4.el7 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2016-11-03 17:47:43 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 1168626, 1288337    

Description Richard W.M. Jones 2014-11-25 15:59:54 UTC
Description of problem:

In https://bugzilla.redhat.com/show_bug.cgi?id=1165564#c4
tzheng commented:

Tested the new iso,when I launch to virt-p2v boot GUI and input the Conversion server and password,error shows:
P2V error:unexpected end of file waiting for password prompt.

We didn't work out why that happened.

Version-Release number of selected component (if applicable):

virt-v2v 1.28.1 (el7)

How reproducible:

Unknown.

Additional info:

See my additional comments:
https://bugzilla.redhat.com/show_bug.cgi?id=1165564#c5
https://bugzilla.redhat.com/show_bug.cgi?id=1165564#c6

The bug "fixed itself" somehow, but I don't believe it.

Comment 2 Richard W.M. Jones 2014-11-25 16:32:54 UTC
Background:

I believe Tingting was referring to a failure in the
libguestfs.git/p2v/ssh.c function 'test_connection', which
opens an ssh connection to a host which is supposed to have
virt-v2v installed.  Somehow she triggered the error
"unexpected end of file waiting for password prompt" in
ssh.c:start_ssh.

You can exercise this path by pushing the "Test connection"
button the first dialog.

Comment 3 tingting zheng 2014-12-18 09:29:08 UTC
(In reply to Richard W.M. Jones from comment #2)
> Background:
> 
> I believe Tingting was referring to a failure in the
> libguestfs.git/p2v/ssh.c function 'test_connection', which
> opens an ssh connection to a host which is supposed to have
> virt-v2v installed.  Somehow she triggered the error
> "unexpected end of file waiting for password prompt" in
> ssh.c:start_ssh.
> 
> You can exercise this path by pushing the "Test connection"
> button the first dialog.

I found that if the remote virt-v2v server can not be connected from virt-p2v client,such error info will show.

Comment 4 John Eckersberg 2014-12-18 16:35:04 UTC
(In reply to tingting zheng from comment #3)
> (In reply to Richard W.M. Jones from comment #2)
> > Background:
> > 
> > I believe Tingting was referring to a failure in the
> > libguestfs.git/p2v/ssh.c function 'test_connection', which
> > opens an ssh connection to a host which is supposed to have
> > virt-v2v installed.  Somehow she triggered the error
> > "unexpected end of file waiting for password prompt" in
> > ssh.c:start_ssh.
> > 
> > You can exercise this path by pushing the "Test connection"
> > button the first dialog.
> 
> I found that if the remote virt-v2v server can not be connected from
> virt-p2v client,such error info will show.

Confirmed I can reproduce by giving it a bogus v2v server.  It would be preferable to expose the actual error message that ssh reports, but it's not obvious to me how to achieve that with miniexpect.  Here's the output from miniexpect if I turn on DEBUG:

DEBUG: poll returned 1
DEBUG: read returned 63
DEBUG: read 63 bytes from pty
DEBUG: buffer content: ssh: connect to host 192.168.123.45 port 22: No route to host

DEBUG: poll returned 1
DEBUG: read returned -1

miniexpect clears the buffer in the handle before returning back to the user if none of the regular expressions match, so we end up losing the "real" error.

Comment 5 Richard W.M. Jones 2014-12-18 16:47:34 UTC
So the problem is likely to be in start_ssh(), probably in the
first call to mexp_expect.

I think the problem is the obvious solution -- adding a second catch-all
regexp -- won't work, for reasons explained here:

http://git.annexia.org/?p=miniexpect.git;a=blob;f=miniexpect.pod;h=b4f0edc3ec82772100934c4c1c3cc2bbb27924cf;hb=HEAD#l260

What would be nice would be to extend miniexpect so that some
kind of callback can be used by clients to collect up all of
the output from the command being run.  ie. That every time
miniexpect calls read (h->fd, ...) there is an opportunity to
pass that to a user-defined callback function.

Or perhaps it should be possible to override the read() function.

Either approach will allow virt-p2v to suck up all the output from
ssh and print it out in the case of an error.  (Probably virt-p2v
should stop doing that once the password has been sent)

Comment 7 Chengappa 2015-10-08 10:59:08 UTC
We need one simple deployment of converting a given server with some OS converted to a Virtual Machine.

i.e.
-> take a simple Linux/fedora machine and install apache or any web server for testing or any application for that matter – the purpose here is to see if this application works after the conversion to a virtual machine

-> Convert P2V using the tools.

-> Start virtual machine and see if works.

We have our conversion server in place, but we would like to know how could we initiate virt-p2v GUI from my physical server, we have difficulties understanding this -> When you start virt-p2v, you'll see a graphical configuration dialog that walks you through connection to the conversion server, asks for the password, which local hard disks you want to convert, and other things like the name of the guest to create and the number of virtual CPUs to give it.

How do we start virt-p2v on a fedora 21

Further, we see this:
[root@localhost ~]# yum install virt-p2v
Loaded plugins: langpacks
updates/21/x86_64/metalink                                                                                                                                                    |  14 kB  00:00:00
updates                                                                                                                                                                       | 4.7 kB  00:00:00
No package virt-p2v available.
Error: Nothing to do
[root@localhost ~]# virt-p2v --help
bash: virt-p2v: command not found...

Could you please help us with the steps in getting up the GUI

Sorry if this is very basic and if it seems to be a stupid question, apologize upfront... Awaiting for response patiently....

Comment 8 Chengappa 2015-10-08 11:02:38 UTC
We need one simple deployment of converting a given server with some OS converted to a Virtual Machine.

i.e.
-> take a simple Linux/fedora machine and install apache or any web server for testing or any application for that matter – the purpose here is to see if this application works after the conversion to a virtual machine

-> Convert P2V using the tools.

-> Start virtual machine and see if works.

We have our conversion server in place, but we would like to know how could we initiate virt-p2v GUI from my physical server, we have difficulties understanding this -> When you start virt-p2v, you'll see a graphical configuration dialog that walks you through connection to the conversion server, asks for the password, which local hard disks you want to convert, and other things like the name of the guest to create and the number of virtual CPUs to give it.

How do we start virt-p2v on a fedora 21

Further, we see this:
[root@localhost ~]# yum install virt-p2v
Loaded plugins: langpacks
updates/21/x86_64/metalink                                                                                                                                                    |  14 kB  00:00:00
updates                                                                                                                                                                       | 4.7 kB  00:00:00
No package virt-p2v available.
Error: Nothing to do
[root@localhost ~]# virt-p2v --help
bash: virt-p2v: command not found...

Could you please help us with the steps in getting up the GUI

Sorry if this is very basic and if it seems to be a stupid question, apologize upfront as we are taking a stab @ it for the first time... Awaiting for response patiently....

Comment 9 Richard W.M. Jones 2015-10-08 11:27:45 UTC
Posting comments on random bugs won't help.  Please send your
request to the libguestfs mailing list: libguestfs

Comment 11 Richard W.M. Jones 2016-06-16 20:25:40 UTC
Upstream fix 8717a110120f84973f1148adf48e59222cf45e73

Comment 14 mxie@redhat.com 2016-06-22 10:38:56 UTC
Sorry, pls ignore comment 13's verify result, correct the verify result as below:

I can reproduce the bug with build:
virt-p2v-livecd-1.28.1-1.49.1.el7.iso

Reproduce steps:
1. Boot the machine into p2v client via iso file
2. At the inputting conversion info interface,input correct conversion server info but change ssh port from 22 to 21, then click test connection, the error shows: unexpected end of file waiting for password prompt


Try to verify the bug with build:
virt-p2v-1.28.1-1.51.3.el7

Verify result:
After inputting correct conversion server info and changing ssh port from 22 to 21, then click test connection, the error shows: ssh:connect to host 10.66.4.137 port21:No route to host, the error info shows correct

According to verify result, the bug has been fixed

So move the bug from ON_QA to VERIFIED

Comment 16 errata-xmlrpc 2016-11-03 17:47:43 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://rhn.redhat.com/errata/RHSA-2016-2576.html