[Libguestfs] Which ISO format/layout does virt-builder expect?

Scott Gorton scott.gorton at ineoquest.com
Fri Dec 11 17:02:21 UTC 2015


Perhaps an example will clarify.  Let's say that I want to create a virt-builder repository image for CentOS-6.5-x86_64-bin-DVA1.iso image that I downloaded off of a CentOS mirror.

1) First, let's mount the ISO to see what's inside

# mkdir /mnt/centos-6.5
# mount -o loop CentOS-6.5-x86_64-bin-DVD1.iso /mnt/centos-6.5
# cd /mnt/centos-6.5
# ls -l

-r--r--r-- 2 root root     14 Nov 29  2013 CentOS_BuildTag
dr-xr-xr-x 3 root root   2048 Nov 29  2013 EFI
-r--r--r-- 2 root root    212 Nov 27  2013 EULA
-r--r--r-- 2 root root  18009 Nov 27  2013 GPL
dr-xr-xr-x 3 root root   2048 Nov 29  2013 images
dr-xr-xr-x 2 root root   2048 Nov 29  2013 isolinux
dr-xr-xr-x 2 root root 655360 Nov 29  2013 Packages
-r--r--r-- 2 root root   1354 Nov 27  2013 RELEASE-NOTES-en-US.html
dr-xr-xr-x 2 root root   4096 Nov 29  2013 repodata
-r--r--r-- 2 root root   1706 Nov 27  2013 RPM-GPG-KEY-CentOS-6
-r--r--r-- 2 root root   1730 Nov 27  2013 RPM-GPG-KEY-CentOS-Debug-6
-r--r--r-- 2 root root   1730 Nov 27  2013 RPM-GPG-KEY-CentOS-Security-6
-r--r--r-- 2 root root   1734 Nov 27  2013 RPM-GPG-KEY-CentOS-Testing-6
-r--r--r-- 1 root root   3380 Nov 29  2013 TRANS.TBL

(Note: it's an install image like the one I've been trying to use)

2) Now following your instructions (https://rwmj.wordpress.com/2014/09/11/creating-a-local-virt-builder-repository/)
I'll move the iso to my ~/builder directory,  compress it and add an entry in my index file.

# // unmount the iso and move to builder directory
# umount /mnt/centos-6.5
# mv CentOS-6.5-x86_64-bin-DVD1.iso builder
# cd builder

# // get the original size of the iso
# ls -l CentOS-6.5-x86_64-bin-DVD1.iso
-rwxr--r-- 1 root root 4467982336 Dec 11 11:04 CentOS-6.5-x86_64-bin-DVD1.iso

# // compress it using prescribed settings
# xz --best --block-size=16777216 CentOS-6.5-x86_64-bin-DVD1.iso

# // get the size of the compressed image
# ls -l
-rwxr--r-- 1 root root 4287626520 Dec 11 11:04 CentOS-6.5-x86_64-bin-DVD1.iso.xz

# // create a sha512 checksum
# sha512sum CentOS-6.5-x86_64-bin-DVD1.iso.xz
ea57956dc36afc497e2508d8e5bda983b87c11007301d1d11936281ed3eb5fdff46fe125df8941df56a5f22866218d18fd426017a7adf032d90defc8e20b2ace  CentOS-6.5-x86_64-bin-DVD1.iso.xz

# // update the index file (steps omitted)
# // show the contents of the index file
# cat index
[centos-6.5]
name=centos-6.5
arch=x86_64
file=CentOS-6.5-x86_64-bin-DVD1.iso.xz
checksum[sha512]=ea57956dc36afc497e2508d8e5bda983b87c11007301d1d11936281ed3eb5fdff46fe125df8941df56a5f22866218d18fd426017a7adf032d90defc8e20b2ace
format=raw
size=4467982336
compressed_size=4287626520
expand=/dev/sda3
notes=CentOS-6.5

# // see if virt-builder lists the new image
# virt-builder --list|grep centos
gpg: Signature made Sat 05 Dec 2015 06:41:14 PM EST using RSA key ID E1B768A0
gpg: Good signature from "Richard W.M. Jones <rjones at redhat.com>"
gpg:                 aka "Richard W.M. Jones <rich at annexia.org>"
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
centos-6.5               x86_64     centos-6.5
centos-6                 x86_64     CentOS 6.6
centos-7.0               x86_64     CentOS 7.0
centos-7.1               x86_64     CentOS 7.1

3) Notice that centos-6.5 appears in list.  Let's try and create a 6.5 image

# virt-builder --password-crypto sha512 centos-6.5
gpg: Signature made Sat 05 Dec 2015 06:41:14 PM EST using RSA key ID E1B768A0
gpg: Good signature from "Richard W.M. Jones <rjones at redhat.com>"
gpg:                 aka "Richard W.M. Jones <rich at annexia.org>"
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
[   6.0] Downloading: file:///root/builder/CentOS-6.5-x86_64-bin-DVD1.iso.xz
[  19.0] Planning how to build this image
[  19.0] Uncompressing
[  23.0] Opening the new disk
[  25.0] Setting a random seed
virt-builder: warning: random seed could not be set for this type of guest
[  25.0] Setting passwords
virt-builder: error: libguestfs error: mktemp: /etc/shadow.guestfstcTloo:
No such file or directory

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

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

Notice the " error: libguestfs error: mktemp: /etc/shadow.guestfstcTloo" error.

The issue is that virt-builder expects the ISO image to contain an /etc directory.  This image does not.  It's a stock CentOS-6.5 installer image downloaded from CentOS.

So the question is what do I have to do to create an ISO image that virt-builder can use?  The images that are present in the virt-builder libguestfs.conf file (fetching from http://libguestfs.org/download/builder/index.asc), how are THOSE images built?

________________________________

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.





More information about the Libguestfs mailing list