Bug 1108171 - RFE: virt-builder should be able to build PXE images for baremetal installation
Summary: RFE: virt-builder should be able to build PXE images for baremetal installation
Keywords:
Status: NEW
Alias: None
Product: Virtualization Tools
Classification: Community
Component: libguestfs
Version: unspecified
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: Richard W.M. Jones
QA Contact:
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2014-06-11 13:55 UTC by Richard W.M. Jones
Modified: 2021-04-19 10:35 UTC (History)
2 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed:
Embargoed:


Attachments (Terms of Use)

Description Richard W.M. Jones 2014-06-11 13:55:27 UTC
This is an RFE bug for adding the facility to build PXE
images from virt-builder, so you can do baremetal installation.

A long time ago, I wrote a script called livecd-iso-to-pxeboot:
https://git.fedorahosted.org/cgit/livecd/tree/tools/livecd-iso-to-pxeboot.sh

This takes a live CD ISO (built by another tool) and turns it into
the kernel, initrd + configuration file that you need in order
to do a PXE boot.  I was hoping that the same technique could be
used on general images (ie. virt-builder images).  In fact it doesn't
work.

How livecd-iso-to-pxeboot works
-------------------------------

What livecd-iso-to-pxeboot does behind the scenes is to extract
the kernel & initrd from the original ISO.  (There are at known
locations, because in the original ISO they are loaded by the
ISOLINUX boot loader).

It then takes the ISO itself, wraps it up in a cpio file, and
appends it to the initrd.  The kernel allows you to create
non-standard cpio files by just appending multiple cpio files
together (these don't work in real cpio).

The kernel and this very bloated initrd are sent over the network
during the PXE boot.  The kernel loads the appended ISO into its
ramdisk where it appears as a file called /foo.iso

The kernel cmdline specifies:

  ... rootflags=loop root=/foo.iso

causing the foo.iso to be loopback-mounted (over /, I think?) and
the boot continues from there.

Why this doesn't work for virt-builder
--------------------------------------

The method outlined above makes two assumptions:

(1) That the ISO is a raw-format bare filesystem, so that loopback
mounting works.  This is not true for virt-builder, but I guess it
would be relatively easy to arrange it.

(2) The cpio format has a limited file size of 4294967295 bytes.
virt-builder raw images are bigger than this (although they are
sparse, but cpio cannot store sparse images).  We cannot use a
non-raw format because of assumption (1).

Other approaches
----------------

*If* we were allowed to use non-upstream kernel modules, then there
are various other options such as cloop.

Squashfs might work.

We might be able to build an ISO.

Dracut may have something to offer.

Comment 1 Lukas Zapletal 2015-11-03 10:36:08 UTC
Rich, this sounds interesting. Can you elaborate on "so you can do baremetal installation"? I can think two scenarios:

A) System boots from the image via PXE into operation

B) System boots via PXE and something writes the content of the image onto hard drive so it can reboot into operation mode

Comment 2 Richard W.M. Jones 2015-11-03 13:58:41 UTC
(In reply to Lukas Zapletal from comment #1)
> Rich, this sounds interesting. Can you elaborate on "so you can do baremetal
> installation"? I can think two scenarios:
> 
> A) System boots from the image via PXE into operation
> 
> B) System boots via PXE and something writes the content of the image onto
> hard drive so it can reboot into operation mode

I mean more like (B), although it's more like: system boots
over PXE, and the hard disk isn't touched at all by virt-builder.

This bug is really about how to build virt-p2v using virt-builder:

http://libguestfs.org/virt-p2v-make-disk.1.html
https://github.com/libguestfs/libguestfs/blob/master/p2v/virt-p2v-make-disk.in

Currently when we want to build a virt-p2v PXE boot image, we
have to go via the kickstart route and run the sucky livecd tools:

http://libguestfs.org/virt-p2v-make-kickstart.1.html


Note You need to log in before you can comment on or make changes to this bug.