Bug 1278371

Summary: inspection returns arch="unknown" for Windows guest if file command is not installed
Product: [Community] Virtualization Tools Reporter: kwsk <k-park>
Component: libguestfsAssignee: Richard W.M. Jones <rjones>
Status: CLOSED UPSTREAM QA Contact:
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: unspecifiedCC: k-park, ptoscano, rbalakri
Target Milestone: ---Keywords: Reopened
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2015-11-06 13:21:24 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:
Attachments:
Description Flags
config.log output.log none

Description kwsk 2015-11-05 11:03:56 UTC
Description of problem:

virt-v2v failed to find virtio-win driver 1.31.24

libguestfs: trace: v2v: mkdir_p "/Windows/Drivers/VirtIO"
guestfsd: main_loop: proc 365 (hivex_node_set_value) took 0.00 seconds
guestfsd: main_loop: new request, len 0x44
libguestfs: trace: v2v: mkdir_p = 0
virt-v2v: warning: there are no virtio drivers available for this version
of Windows (6.1 unknown Server).  virt-v2v looks for drivers in
/usr/share/virtio-win

The guest will be configured to use slower emulated devices.

success in 1.28.1

libguestfs: trace: mkdir_p "/Windows/Drivers/VirtIO"
guestfsd: main_loop: new request, len 0x44
libguestfs: trace: mkdir_p = 0
virtio-win driver files matching this guest:
netkvm.cat [6,1,not-client,x86_64,cat] from /usr/share/virtio-win/./drivers/amd64/Win2008R2/netkvm.cat
netkvm.inf [6,1,not-client,x86_64,inf] from /usr/share/virtio-win/./drivers/amd64

virtio-win driver is located in /usr/share

echo $VIRTIO_WIN
/usr/share/virtio-win


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


How reproducible:


Steps to Reproduce:
1.
2.
3.

Actual results:


Expected results:


Additional info:

Comment 1 Richard W.M. Jones 2015-11-05 12:23:06 UTC
(In reply to kwsk from comment #0)
> Description of problem:
> 
> virt-v2v failed to find virtio-win driver 1.31.24
> 
> libguestfs: trace: v2v: mkdir_p "/Windows/Drivers/VirtIO"
> guestfsd: main_loop: proc 365 (hivex_node_set_value) took 0.00 seconds
> guestfsd: main_loop: new request, len 0x44
> libguestfs: trace: v2v: mkdir_p = 0
> virt-v2v: warning: there are no virtio drivers available for this version
> of Windows (6.1 unknown Server).  virt-v2v looks for drivers in
                  ^^^^^^^
It seems to have failed to find the Windows architecture.  That
should say something like "i386" or "x86_64", not "unknown".

I wonder if recent changes to libguestfs broke that?

Comment 2 Richard W.M. Jones 2015-11-05 13:11:55 UTC
Could you attach the full virt-v2v -v -x ... output to this bug.

Comment 3 Richard W.M. Jones 2015-11-05 13:34:17 UTC
I was unable to reproduce this bug with 1.31.24.  So I need the
full -v -x output from the failing run.

Comment 4 kwsk 2015-11-06 01:09:25 UTC
It was solved with libvirt-devel
Thank you for response

Comment 5 kwsk 2015-11-06 01:46:17 UTC
Created attachment 1090436 [details]
config.log output.log

Comment 6 kwsk 2015-11-06 01:47:20 UTC
It still failed to find driver
I uploaded config.log and output.log

Comment 7 kwsk 2015-11-06 02:46:46 UTC
file-devel rpm was lacked
closed

Comment 8 Richard W.M. Jones 2015-11-06 11:48:55 UTC
OK I reproduced this finally.  To reproduce:

(1) 'yum remove file' so the 'file' command/RPM is not installed

(2) compile libguestfs from source

(3) try to inspect a Windows guest, eg:

$ ./run virt-inspector /mnt/fastscratch/win2003.img | head
libguestfs: error: file: /WINDOWS/system32/cmd.exe: file: No such file or directory
<?xml version="1.0"?>
<operatingsystems>
  <operatingsystem>
    <root>/dev/sda1</root>
    <name>windows</name>
    <distro>windows</distro>
    <product_name>Microsoft Windows Server 2003</product_name>
    <major_version>5</major_version>
    <minor_version>2</minor_version>

There is an error message, but this should fail much harder.

Note that the error message does not appear in virt-v2v output,
although I'm not clear why.

Comment 9 Richard W.M. Jones 2015-11-06 13:21:24 UTC
I pushed the following commit to make it fail hard in this case:

https://github.com/libguestfs/libguestfs/commit/7964e48b5e4c0d0cc2bcf2c2bc027c65fa855d62