I’m running into a bit of trouble using virt-builder and I’m hoping that someone might be able to point in the right direction.

 

My build process creates a custom ISO image which is subsequently used to kickstart an Oracle X4-2 server using PXE.  The ISO is a minimal install and contains a suite of packages and customization scripts to properly configure our box during first boot.  The process works great for kickstarting baremetal machines as well as VMs created with virt-manager or vsphere.

 

I’d like to be able to use virt-builder to build virtual images automatically (i.e., take our .ISO and generate a qcow2 of a properly installed system).  Unfortunately, virt-builder doesn’t seem to like the format of my ISO image.  The tool dies during the “Setting passwords” step because it’s attempting to create a temp file in /etc and my ISO doesn’t have an /etc directory at this point.

 

Here’s a snippet that shows the error message:

 

[  16.0] Setting passwords

libguestfs: trace: mktemp "/etc/shadow.guestfsXXXXXX"

libguestfs: trace: mktemp = NULL (error)

virt-builder: error: libguestfs error: mktemp: /etc/shadow.guestfsyU5Zwo:

No such file or directory

 

Is there a particular ISO format that virt-builder expects?

 

As a test, I used virt-builder to successfully create a centos-6 image.  I looked in my .cache/virt-builder directory, unxz’d the image and then mounted the partitions.  It appears that the sanitized centos-6 image is fully complete (i.e., contains a typical filesystem, has an /etc, an /etc/passwd…etc.) whereas mine seems more like a linux image that is in a ready-to-be-installed state.

 

virt-inspector on my ISO shows:

 

<?xml version="1.0"?>

<operatingsystems>

  <operatingsystem>

    <root>/dev/sda</root>

    <name>linux</name>

    <arch>x86_64</arch>

    <distro>oraclelinux</distro>

    <major_version>6</major_version>

    <minor_version>0</minor_version>

    <package_format>rpm</package_format>

    <package_management>yum</package_management>

    <format>installer</format>

    <mountpoints>

      <mountpoint dev="/dev/sda">/</mountpoint>

    </mountpoints>

    <filesystems>

      <filesystem dev="/dev/sda">

        <type>iso9660</type>

        <label>iDVA 4.95.0 x86_64</label>

        <uuid>2015-11-20-19-50-52-00</uuid>

      </filesystem>

    </filesystems>

    <applications/>

  </operatingsystem>

</operatingsystems>

 

Likewise, if I mount my ISO I have a filesystem that looks like:

 

drwxrwxr-x  3 test test      4096 Nov 19 18:03 images

drwxrwxr-x 11 test test      4096 Nov 19 18:05 iqcustom

-rw-rw-r--  1 test test 966785078 Nov 19 18:08 iqcustom.tar.gz

drwxrwxr-x  2 test test      4096 Nov 19 18:03 isolinux

-rw-rw-r--  1 test test      2368 Nov 19 18:03 ks-dell.cfg

-rw-rw-r--  1 test test     15158 Nov 19 18:03 ks-oracle.cfg

-rw-rw-r--  1 test test     15985 Nov 19 18:03 ks-pxe.cfg

-rw-rw-r--  1 test test      3061 Nov 19 18:03 ks-pxe-oracle-vm.cfg

-rw-rw-r--  1 test test      2176 Nov 19 18:03 ks-vm.cfg

drwxrwxr-x  2 test test     36864 Nov 19 18:04 Packages

drwxrwxr-x  2 test test      4096 Nov 19 18:04 repodata

-r--r--r--  1 test test      3106 Nov 19 18:05 TRANS.TBL

drwxrwxr-x  3 test test      4096 Nov 19 18:05

 

In contrast, mounting one of the partitions in the centos-6 image shows:

 

dr-xr-xr-x.  2 root root  4096 Oct 31  2014 bin

drwxr-xr-x.  2 root root  4096 Oct 31  2014 boot

drwxr-xr-x.  2 root root  4096 Oct 31  2014 dev

drwxr-xr-x. 73 root root  4096 Dec  9 16:26 etc

drwxr-xr-x.  2 root root  4096 Sep 23  2011 home

dr-xr-xr-x. 10 root root  4096 Oct 31  2014 lib

dr-xr-xr-x.  9 root root 12288 Oct 31  2014 lib64

drwx------.  2 root root 16384 Oct 31  2014 lost+found

drwxr-xr-x.  2 root root  4096 Sep 23  2011 media

drwxr-xr-x.  2 root root  4096 Sep 23  2011 mnt

drwxr-xr-x.  3 root root  4096 Oct 31  2014 opt

drwxr-xr-x.  2 root root  4096 Oct 31  2014 proc

dr-xr-x---.  2 root root  4096 Oct 31  2014 root

dr-xr-xr-x.  2 root root 12288 Oct 31  2014 sbin

drwxr-xr-x.  2 root root  4096 Oct 31  2014 selinux

drwxr-xr-x.  2 root root  4096 Sep 23  2011 srv

drwxr-xr-x.  2 root root  4096 Oct 31  2014 sys

drwxrwxrwt.  2 root root  4096 Oct 31  2014 tmp

drwxr-xr-x. 13 root root  4096 Oct 31  2014 usr

drwxr-xr-x. 19 root root  4096 Oct 31  2014 var

 

 

Note: we build our ISO using mkisofs.  Is there some other tool/process that we should use to generate ISOs that satisfy virt-builder?  Should I be starting from a Live CD format?   

 

Cheers!

                                                                                                                                                      

 



NOTICE: This communication and any attachments may contain confidential and/or privileged information of IneoQuest Technologies, Inc. ("IneoQuest"). This communication is intended solely for the use of the individual or entity to which it is addressed. If you are not the intended recipient of this communication, you are hereby notified that any dissemination, distribution, copying or other use of this communication or the information it contains is strictly prohibited and may be unlawful. If you have received this communication in error, please notify the sender immediately by reply e-mail and destroy all copies of this communication (including attachments), electronic or otherwise. If you are a party to a written Non-Disclosure Agreement ("NDA") with IneoQuest, you should maintain the contents of this communication (including attachments) in confidence to the full extent specified in the NDA.