Bug 1264835

Summary: ppc64le: virt-customize --install fail to detect the guest arch
Product: Red Hat Enterprise Linux 7 Reporter: Hu Zhang <huzhan>
Component: libguestfsAssignee: Richard W.M. Jones <rjones>
Status: CLOSED ERRATA QA Contact: Virtualization Bugs <virt-bugs>
Severity: medium Docs Contact:
Priority: medium    
Version: 7.2CC: leiwang, linl, ptoscano, sherold, wshi, xchen
Target Milestone: rc   
Target Release: ---   
Hardware: ppc64le   
OS: Unspecified   
Whiteboard:
Fixed In Version: libguestfs-1.32.5-10.el7 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2016-11-03 17:55:47 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: 1211996, 1218766    
Bug Blocks: 1288337, 1301891    
Attachments:
Description Flags
virt-customize_install.log none

Description Hu Zhang 2015-09-21 10:53:41 UTC
Created attachment 1075458 [details]
virt-customize_install.log

Description of problem:
virt-customize --install fail to detect the guest arch. It returns the error "host cpu
(powerpc64le) and guest arch (ppc64) are not compatible". Actually, the guest arch is ppc64le.
They have the same arch.

Version-Release number of selected component (if applicable):
kernel-3.10.0-316.el7.ppc64le
libguestfs-1.28.1-1.55.el7.ppc64le
libguestfs-tools-c-1.28.1-1.55.el7.ppc64le

How reproducible:
Always

Steps to Reproduce:
1. In host
# virt-customize -a RHEL-Server-ppc64le-7.1-hvm.raw --install openssh -v -x
...
virt-customize: error: host cpu (powerpc64le) and guest arch (ppc64) are
not compatible, so you cannot use command line options that involve running
commands in the guest.  Use --firstboot scripts instead.

If reporting bugs, run virt-customize with debugging enabled and include
the complete output:

  virt-customize -v -x [...]
libguestfs: trace: close
...
  
2. In guest
#  subscription-manager facts
...
distribution.id: Maipo
distribution.name: Red Hat Enterprise Linux Server
distribution.version: 7.1
distribution.version.modifier: ga
lscpu.architecture: ppc64le
lscpu.byte_order: Little Endian
...

Actual results:
In step 1, virt-customize fails to detect the guest arch.

Expected results:
The package should installed successfully through virt-customize --install.

Additional info:
The attachment is the full log file.

Comment 1 Richard W.M. Jones 2015-09-21 10:57:35 UTC
This is fixed upstream, but not in RHEL 7.2.

Upstream fix: https://github.com/libguestfs/libguestfs/commit/33d2b4a7341830efeddb1f258ac77f67a8004d30
Upstream bug 1211996

Should be fixed by the rebase.

Comment 5 Xianghua Chen 2016-06-28 06:16:53 UTC
It still failed with packages:
libguestfs-1.32.5-6.el7.x86_64

Steps:
1. Prepare an ppc64le guest image:
RHEL-7.1-ppc64le.qcow2 
2. Create  a tmp.qcow2 to only record the difference to backing_file:
# qemu-img create -f qcow2 -o backing_file=RHEL-7.1-ppc64le.qcow2 tmp.qcow2
# virt-inspector -a tmp.qcow2 
<?xml version="1.0"?>
<operatingsystems>
  <operatingsystem>
    <root>/dev/rhel-l/root</root>
    <name>linux</name>
    <arch>ppc64le</arch>
    <distro>rhel</distro>
    <product_name>Red Hat Enterprise Linux Server 7.1 (Maipo)</product_name>
    <major_version>7</major_version>
    <minor_version>1</minor_version>
    <package_format>rpm</package_format>
    <package_management>yum</package_management>
    <hostname>localhost.localdomain</hostname>
    <format>installed</format>
    <mountpoints>
      <mountpoint dev="/dev/rhel-l/root">/</mountpoint>
      <mountpoint dev="/dev/sda2">/boot</mountpoint>
... ... 
3. # virt-customize -a tmp.qcow2  --install openssh
[   0.0] Examining the guest ...
[   3.0] Setting a random seed
[   3.0] Installing packages: openssh
virt-customize: error: host cpu (x86_64) and guest arch (ppc64le) are not 
compatible, so you cannot use command line options that involve running 
commands in the guest.  Use --firstboot scripts instead.

If reporting bugs, run virt-customize with debugging enabled and include 
the complete output:

  virt-customize -v -x [...]


The error is still there.

Comment 6 Pino Toscano 2016-06-28 07:59:43 UTC
(In reply to Xianghua Chen from comment #5)
> virt-customize: error: host cpu (x86_64) and guest arch (ppc64le) are not 
> compatible, so you cannot use command line options that involve running 
> commands in the guest.  Use --firstboot scripts instead.

This is correct: you cannot run (easily, I'd say) ppc64le binaries using the x86_64 appliance built from the host.

You need to try on a ppc64le host as well, like shown in comment #0.

Comment 7 Xianghua Chen 2016-06-29 02:15:07 UTC
(In reply to Pino Toscano from comment #6)
> (In reply to Xianghua Chen from comment #5)
> > virt-customize: error: host cpu (x86_64) and guest arch (ppc64le) are not 
> > compatible, so you cannot use command line options that involve running 
> > commands in the guest.  Use --firstboot scripts instead.
> 
> This is correct: you cannot run (easily, I'd say) ppc64le binaries using the
> x86_64 appliance built from the host.
> 
> You need to try on a ppc64le host as well, like shown in comment #0.

I'm sorry I have pasted the wrong log I think... I should paste the one on ppc64le.
Actually I tried first on x86_64 which gives the above error, then I tried on ppc64le it still fail as following:
----------------------------------------------------------
# uname -a
Linux ibm-p8-rhevm-17.lab4.eng.bos.redhat.com 3.10.0-327.el7.ppc64le #1 SMP Thu Oct 29 17:31:13 EDT 2015 ppc64le ppc64le ppc64le GNU/Linux

# virt-customize -a RHEL-7.1-ppc64le.qcow2 --install openssh
[   0.0] Examining the guest ...
[   5.6] Setting a random seed
[   5.6] Installing packages: openssh
virt-customize: error: host cpu (powerpc64le) and guest arch (ppc64le) are 
not compatible, so you cannot use command line options that involve running 
commands in the guest.  Use --firstboot scripts instead.

If reporting bugs, run virt-customize with debugging enabled and include 
the complete output:

  virt-customize -v -x [...]
---------------------------------------------------------

It's not fixed yet, the error is the same as before.

Comment 8 Richard W.M. Jones 2016-06-29 09:15:21 UTC
Should be fixed by:
https://github.com/libguestfs/libguestfs/commit/3ac0aa82327a23e3a2538f46938481beae72d2ec

Comment 10 Xianghua Chen 2016-07-07 02:39:04 UTC
Verified with the packages:
libguestfs-1.32.5-6.el7.x86_64

Verify steps:
1. Prepare an ppc64le guest image:
RHEL-7.1-ppc64le.qcow2 
2. Create  a tmp.qcow2 to only record the difference to backing_file:
# qemu-img create -f qcow2 -o backing_file=RHEL-7.1-ppc64le.qcow2 tmp.qcow2
3. 
# virt-customize -a tmp.qcow2 --install openssh[   0.0] Examining the guest ...
[   5.6] Setting a random seed
[   5.6] Installing packages: openssh
[   6.8] Finishing off

4. 
# guestfish -a tmp.qcow2 -i sh 'rpm -qa | grep -i openssh'
openssh-clients-6.6.1p1-28.el7.ppc64le
openssh-6.6.1p1-28.el7.ppc64le
openssh-server-6.6.1p1-28.el7.ppc64le


Commands finished successfully, and the package has been installed correctly.

So verified.

Comment 11 Richard W.M. Jones 2016-07-07 07:34:52 UTC
(In reply to Xianghua Chen from comment #10)
> # guestfish -a tmp.qcow2 -i sh 'rpm -qa | grep -i openssh'
> openssh-clients-6.6.1p1-28.el7.ppc64le
> openssh-6.6.1p1-28.el7.ppc64le
> openssh-server-6.6.1p1-28.el7.ppc64le

This should also have worked:

virt-inspector -a tmp.qcow2 | grep openssh

Comment 13 errata-xmlrpc 2016-11-03 17:55:47 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