Bug 1157691

Summary: virt-p2v-make-disk should add firmwares
Product: Red Hat Enterprise Linux 7 Reporter: Richard W.M. Jones <rjones>
Component: libguestfsAssignee: Richard W.M. Jones <rjones>
Status: CLOSED ERRATA QA Contact: Virtualization Bugs <virt-bugs>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 7.1CC: codong, dyuan, juzhou, linux, mbooth, mzhan, ptoscano, rbalakri, rjones, tzheng
Target Milestone: rc   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard: V2V
Fixed In Version: libguestfs-1.28.1-1.6.el7 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: 1157679 Environment:
Last Closed: 2015-03-05 13:46:56 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: 1157679    
Bug Blocks: 1168626    

Description Richard W.M. Jones 2014-10-27 13:56:52 UTC
Guess we're gonna need this for RHEL 7.1 too ...

+++ This bug was initially created as a clone of Bug #1157679 +++

virt-p2v-make-disk and -make-kickstart should add firmware files to the virt-builder image.  I'm trying to build a USB key to migrate a physical machine with an Adaptec SAS controller that needs aic94xx firmware.  I added "--run-command "yum -y groupinstall 'Hardware Support'" to the -make-disk script (which of course is Fedora specific).

--- Additional comment from Richard W.M. Jones on 2014-10-27 09:53:11 EDT ---

This patch (only lightly tested) should fix it:

https://github.com/libguestfs/libguestfs/commit/91788cd76f23227c102293a5dc5eef1c30cf7858

Comment 4 Richard W.M. Jones 2014-10-28 11:30:11 UTC
Suggested method to QA this:

(1) Build the image by doing:

$ virt-p2v-make-disk -o /tmp/p2v.img fedora-20

(2) Open the disk image in virt-rescue:

$ virt-rescue --ro -a /tmp/p2v.img

(3) In the virt-rescue shell, mount up the partitions:

><rescue> mount /dev/sda3 /sysroot
><rescue> mount /dev/sda1 /sysroot/boot

(4) Look for the initramfs file in /sysroot/boot/ and run
lsinitrd on it:

><rescue> cd /sysroot/boot/
><rescue> ls -l
><rescue> lsinitrd NAME-OF-INITRD |& grep usb.storage

You should see at least 1 line referring to the usb-storage.ko
kernel module, which indicates that it has been included in the
initramfs.

Comment 5 Richard W.M. Jones 2014-10-28 11:32:08 UTC
(In reply to Richard W.M. Jones from comment #4)
> Suggested method to QA this:
> 
> (1) Build the image by doing:
> 
> $ virt-p2v-make-disk -o /tmp/p2v.img fedora-20
> 
> (2) Open the disk image in virt-rescue:
> 
> $ virt-rescue --ro -a /tmp/p2v.img
> 
> (3) In the virt-rescue shell, mount up the partitions:
> 
> ><rescue> mount /dev/sda3 /sysroot
> ><rescue> mount /dev/sda1 /sysroot/boot
> 
> (4) Look for the initramfs file in /sysroot/boot/ and run
> lsinitrd on it:
> 
> ><rescue> cd /sysroot/boot/
> ><rescue> ls -l
> ><rescue> lsinitrd NAME-OF-INITRD |& grep usb.storage
> 
> You should see at least 1 line referring to the usb-storage.ko
> kernel module, which indicates that it has been included in the
> initramfs.

Sorry, also ...

(5) Check that /sysroot/lib/firmware exists and contains
/sysroot/lib/firmware/aic94xx-seq.fw

Comment 6 Richard W.M. Jones 2014-10-28 11:33:04 UTC
Tingting, can you QA ack this please.  See comments 4 & 5
for how to QA this.

Comment 8 tingting zheng 2014-10-30 03:41:06 UTC
I tested with:
virt-v2v-1.28.1-1.6.el7.x86_64
libguestfs-1.28.1-1.6.el7.x86_64

# virt-p2v-make-disk -o /tmp/p2v.img fedora-20

gpg: Signature made Tue 08 Jul 2014 05:11:00 AM EDT using RSA key ID E1B768A0
gpg: Good signature from "Richard W.M. Jones <rjones>"
gpg:                 aka "Richard W.M. Jones <rich>"
gpg: WARNING: This key is not certified with a trusted signature!
gpg:          There is no indication that the signature belongs to the owner.
Primary key fingerprint: F777 4FB1 AD07 4A7E 8C87  67EA 9173 8F73 E1B7 68A0
[   2.0] Downloading: http://libguestfs.org/download/builder/fedora-20.xz
######################################################################## 100.0%
[1622.0] Planning how to build this image
[1622.0] Uncompressing
[1635.0] Opening the new disk
[1835.0] Setting a random seed
[1836.0] Updating core packages
[3062.0] Installing packages: pcre libxml2 gtk2 /usr/bin/xinit /usr/bin/ssh /usr/bin/qemu-nbd /usr/bin/Xorg xorg-x11-drivers xorg-x11-fonts-Type1 matchbox-window-manager @hardware-support
[3165.0] Uploading: /usr/share/virt-p2v/issue to /etc/issue
[3165.0] Uploading: /usr/share/virt-p2v/issue to /etc/issue.net
[3165.0] Making directory: /usr/libexec
[3165.0] Uploading: /usr/libexec/virt-p2v to /usr/libexec
[3165.0] Changing permissions of /usr/libexec/virt-p2v to 0755
[3166.0] Uploading: /usr/share/virt-p2v/launch-virt-p2v to /usr/bin/
[3166.0] Changing permissions of /usr/bin/launch-virt-p2v to 0755
[3166.0] Uploading: /usr/share/virt-p2v/p2v.service to /etc/systemd/system/
[3166.0] Making directory: /etc/systemd/system/default.target.wants
[3166.0] Linking: /etc/systemd/system/default.target.wants/p2v.service -> /etc/systemd/system/p2v.service
[3166.0] Editing: /usr/lib/systemd/system/getty@.service
[3166.0] Editing: /etc/systemd/logind.conf
[3166.0] Uploading: /tmp/tmp.Rx1vVd9LVg/p2v.conf to /etc/dracut.conf.d/
virt-builder: error: libguestfs error: open: /tmp/tmp.Rx1vVd9LVg/p2v.conf: 
No such file or directory

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

  virt-builder -v -x [...]

I've meet the above error,would you pls help me to check it,thanks.

Comment 9 Richard W.M. Jones 2014-10-30 10:53:42 UTC
I have no idea why that failed.  It works fine for me.

Could files in /tmp have got deleted somehow while the program
was running?

Can you try outputting to -o /var/tmp/p2v.img instead, just in
case it's running out of space on /tmp.

Comment 10 tingting zheng 2014-10-30 11:26:54 UTC
(In reply to Richard W.M. Jones from comment #9)
> I have no idea why that failed.  It works fine for me.
> 
> Could files in /tmp have got deleted somehow while the program
> was running?
> 
> Can you try outputting to -o /var/tmp/p2v.img instead, just in
> case it's running out of space on /tmp.

I tired to output -o /var/tmp/p2v.img,and followed the steps in comment 4 and comment 5,it worked,results listed as below:

><rescue> lsinitrd initramfs-3.16.6-203.fc20.x86_64.img |& grep usb.storage
drwxr-xr-x   2 root     root            0 Oct 30 11:06 usr/lib/modules/3.16.6-203.fc20.x86_64/kernel/drivers/usb/storage
-rw-r--r--   1 root     root       133383 Oct 25 13:11 usr/lib/modules/3.16.6-203.fc20.x86_64/kernel/drivers/usb/storage/usb-storage.ko

><rescue> ls /sysroot/lib/firmware/aic94xx-seq.fw
/sysroot/lib/firmware/aic94xx-seq.fw

Refer to the above comments,moved the bug to VERIFIED.

Comment 12 errata-xmlrpc 2015-03-05 13:46:56 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/RHBA-2015-0303.html