715 lines
43 KiB
HTML
715 lines
43 KiB
HTML
|
|
|
|
<!DOCTYPE html>
|
|
<!--[if IE 8]><html class="no-js lt-ie9" lang="en" > <![endif]-->
|
|
<!--[if gt IE 8]><!--> <html class="no-js" lang="en" > <!--<![endif]-->
|
|
<head>
|
|
<meta charset="utf-8">
|
|
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
|
|
<title>livemedia-creator — Lorax 24.6 documentation</title>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<link rel="stylesheet" href="_static/css/theme.css" type="text/css" />
|
|
|
|
|
|
|
|
|
|
|
|
<link rel="top" title="Lorax 24.6 documentation" href="index.html"/>
|
|
<link rel="next" title="Product and Updates Images" href="product-images.html"/>
|
|
<link rel="prev" title="lorax" href="lorax.html"/>
|
|
|
|
|
|
<script src="_static/js/modernizr.min.js"></script>
|
|
|
|
</head>
|
|
|
|
<body class="wy-body-for-nav" role="document">
|
|
|
|
<div class="wy-grid-for-nav">
|
|
|
|
|
|
<nav data-toggle="wy-nav-shift" class="wy-nav-side">
|
|
<div class="wy-side-nav-search">
|
|
|
|
|
|
|
|
<a href="index.html" class="icon icon-home"> Lorax
|
|
|
|
|
|
|
|
</a>
|
|
|
|
|
|
<div role="search">
|
|
<form id="rtd-search-form" class="wy-form" action="search.html" method="get">
|
|
<input type="text" name="q" placeholder="Search docs" />
|
|
<input type="hidden" name="check_keywords" value="yes" />
|
|
<input type="hidden" name="area" value="default" />
|
|
</form>
|
|
</div>
|
|
|
|
|
|
</div>
|
|
|
|
<div class="wy-menu wy-menu-vertical" data-spy="affix" role="navigation" aria-label="main navigation">
|
|
|
|
|
|
|
|
<ul class="current">
|
|
<li class="toctree-l1"><a class="reference internal" href="intro.html">Introduction to Lorax</a></li>
|
|
<li class="toctree-l1"><a class="reference internal" href="intro.html#before-lorax">Before Lorax</a></li>
|
|
<li class="toctree-l1"><a class="reference internal" href="lorax.html">lorax</a></li>
|
|
<li class="toctree-l1 current"><a class="current reference internal" href="">livemedia-creator</a><ul>
|
|
<li class="toctree-l2"><a class="reference internal" href="#quickstart">Quickstart</a></li>
|
|
<li class="toctree-l2"><a class="reference internal" href="#how-iso-creation-works">How ISO creation works</a></li>
|
|
<li class="toctree-l2"><a class="reference internal" href="#kickstarts">Kickstarts</a></li>
|
|
<li class="toctree-l2"><a class="reference internal" href="#anaconda-image-install-no-virt">Anaconda image install (no-virt)</a></li>
|
|
<li class="toctree-l2"><a class="reference internal" href="#ami-images">AMI Images</a></li>
|
|
<li class="toctree-l2"><a class="reference internal" href="#appliance-creation">Appliance Creation</a></li>
|
|
<li class="toctree-l2"><a class="reference internal" href="#filesystem-image-creation">Filesystem Image Creation</a></li>
|
|
<li class="toctree-l2"><a class="reference internal" href="#tar-file-creation">TAR File Creation</a></li>
|
|
<li class="toctree-l2"><a class="reference internal" href="#live-image-for-pxe-boot">Live Image for PXE Boot</a></li>
|
|
<li class="toctree-l2"><a class="reference internal" href="#atomic-live-image-for-pxe-boot">Atomic Live Image for PXE Boot</a></li>
|
|
<li class="toctree-l2"><a class="reference internal" href="#using-mock-to-create-images">Using Mock to Create Images</a></li>
|
|
<li class="toctree-l2"><a class="reference internal" href="#openstack-image-creation">OpenStack Image Creation</a></li>
|
|
<li class="toctree-l2"><a class="reference internal" href="#docker-image-creation">Docker Image Creation</a></li>
|
|
<li class="toctree-l2"><a class="reference internal" href="#open-container-initiative-image-creation">Open Container Initiative Image Creation</a></li>
|
|
<li class="toctree-l2"><a class="reference internal" href="#vagrant-image-creation">Vagrant Image Creation</a></li>
|
|
<li class="toctree-l2"><a class="reference internal" href="#creating-uefi-disk-images-with-virt">Creating UEFI disk images with virt</a></li>
|
|
<li class="toctree-l2"><a class="reference internal" href="#debugging-problems">Debugging problems</a></li>
|
|
<li class="toctree-l2"><a class="reference internal" href="#hacking">Hacking</a></li>
|
|
</ul>
|
|
</li>
|
|
<li class="toctree-l1"><a class="reference internal" href="product-images.html">Product and Updates Images</a></li>
|
|
<li class="toctree-l1"><a class="reference internal" href="modules.html">pylorax</a><ul>
|
|
<li class="toctree-l2"><a class="reference internal" href="pylorax.html">pylorax package</a><ul>
|
|
<li class="toctree-l3"><a class="reference internal" href="pylorax.html#submodules">Submodules</a></li>
|
|
<li class="toctree-l3"><a class="reference internal" href="pylorax.html#module-pylorax.base">pylorax.base module</a></li>
|
|
<li class="toctree-l3"><a class="reference internal" href="pylorax.html#module-pylorax.buildstamp">pylorax.buildstamp module</a></li>
|
|
<li class="toctree-l3"><a class="reference internal" href="pylorax.html#module-pylorax.decorators">pylorax.decorators module</a></li>
|
|
<li class="toctree-l3"><a class="reference internal" href="pylorax.html#module-pylorax.discinfo">pylorax.discinfo module</a></li>
|
|
<li class="toctree-l3"><a class="reference internal" href="pylorax.html#module-pylorax.dnfhelper">pylorax.dnfhelper module</a></li>
|
|
<li class="toctree-l3"><a class="reference internal" href="pylorax.html#module-pylorax.executils">pylorax.executils module</a></li>
|
|
<li class="toctree-l3"><a class="reference internal" href="pylorax.html#module-pylorax.imgutils">pylorax.imgutils module</a></li>
|
|
<li class="toctree-l3"><a class="reference internal" href="pylorax.html#module-pylorax.ltmpl">pylorax.ltmpl module</a></li>
|
|
<li class="toctree-l3"><a class="reference internal" href="pylorax.html#module-pylorax.monitor">pylorax.monitor module</a></li>
|
|
<li class="toctree-l3"><a class="reference internal" href="pylorax.html#module-pylorax.mount">pylorax.mount module</a></li>
|
|
<li class="toctree-l3"><a class="reference internal" href="pylorax.html#module-pylorax.output">pylorax.output module</a></li>
|
|
<li class="toctree-l3"><a class="reference internal" href="pylorax.html#module-pylorax.sysutils">pylorax.sysutils module</a></li>
|
|
<li class="toctree-l3"><a class="reference internal" href="pylorax.html#module-pylorax.treebuilder">pylorax.treebuilder module</a></li>
|
|
<li class="toctree-l3"><a class="reference internal" href="pylorax.html#module-pylorax.treeinfo">pylorax.treeinfo module</a></li>
|
|
<li class="toctree-l3"><a class="reference internal" href="pylorax.html#module-pylorax">Module contents</a></li>
|
|
</ul>
|
|
</li>
|
|
</ul>
|
|
</li>
|
|
</ul>
|
|
|
|
|
|
|
|
</div>
|
|
|
|
</nav>
|
|
|
|
<section data-toggle="wy-nav-shift" class="wy-nav-content-wrap">
|
|
|
|
|
|
<nav class="wy-nav-top" role="navigation" aria-label="top navigation">
|
|
<i data-toggle="wy-nav-top" class="fa fa-bars"></i>
|
|
<a href="index.html">Lorax</a>
|
|
</nav>
|
|
|
|
|
|
|
|
<div class="wy-nav-content">
|
|
<div class="rst-content">
|
|
<div role="navigation" aria-label="breadcrumbs navigation">
|
|
<ul class="wy-breadcrumbs">
|
|
<li><a href="index.html">Docs</a> »</li>
|
|
|
|
<li>livemedia-creator</li>
|
|
<li class="wy-breadcrumbs-aside">
|
|
|
|
|
|
<a href="_sources/livemedia-creator.txt" rel="nofollow"> View page source</a>
|
|
|
|
|
|
</li>
|
|
</ul>
|
|
<hr/>
|
|
</div>
|
|
<div role="main" class="document">
|
|
|
|
<div class="section" id="livemedia-creator">
|
|
<h1>livemedia-creator<a class="headerlink" href="#livemedia-creator" title="Permalink to this headline">¶</a></h1>
|
|
<table class="docutils field-list" frame="void" rules="none">
|
|
<col class="field-name" />
|
|
<col class="field-body" />
|
|
<tbody valign="top">
|
|
<tr class="field-odd field"><th class="field-name">Authors:</th><td class="field-body">Brian C. Lane <<a class="reference external" href="mailto:bcl%40redhat.com">bcl<span>@</span>redhat<span>.</span>com</a>></td>
|
|
</tr>
|
|
</tbody>
|
|
</table>
|
|
<p>livemedia-creator uses <a class="reference external" href="https://github.com/rhinstaller/anaconda">Anaconda</a>,
|
|
<a class="reference external" href="https://github.com/rhinstaller/pykickstart">kickstart</a> and <a class="reference external" href="https://github.com/rhinstaller/lorax">Lorax</a> to create bootable media that use the
|
|
same install path as a normal system installation. It can be used to make live
|
|
isos, bootable (partitioned) disk images, tarfiles, and filesystem images for
|
|
use with virtualization and container solutions like libvirt, docker, and
|
|
OpenStack.</p>
|
|
<p>The general idea is to use virt-install with kickstart and an Anaconda boot.iso
|
|
to install into a disk image and then use the disk image to create the bootable
|
|
media.</p>
|
|
<p>livemedia-creator –help will describe all of the options available. At the
|
|
minimum you need:</p>
|
|
<p><tt class="docutils literal"><span class="pre">--make-iso</span></tt> to create a final bootable .iso or one of the other <tt class="docutils literal"><span class="pre">--make-*</span></tt> options.</p>
|
|
<p><tt class="docutils literal"><span class="pre">--iso</span></tt> to specify the Anaconda install media to use with virt-install</p>
|
|
<p><tt class="docutils literal"><span class="pre">--ks</span></tt> to select the kickstart file describing what to install.</p>
|
|
<p>To use livemedia-creator with virt-install you will need to install the
|
|
following packages, as well as have libvirtd setup correctly.</p>
|
|
<ul class="simple">
|
|
<li><tt class="docutils literal"><span class="pre">virt-install</span></tt></li>
|
|
<li><tt class="docutils literal"><span class="pre">libvirt-python</span></tt></li>
|
|
</ul>
|
|
<p>If you are going to be using Anaconda directly, with <tt class="docutils literal"><span class="pre">--no-virt</span></tt> mode, make sure
|
|
you have the anaconda package installed. You can use the anaconda-tui package
|
|
to save a bit of space on the build system.</p>
|
|
<p>Conventions used in this document:</p>
|
|
<p><tt class="docutils literal"><span class="pre">lmc</span></tt> is an abbreviation for livemedia-creator.</p>
|
|
<p><tt class="docutils literal"><span class="pre">builder</span></tt> is the system where livemedia-creator is being run</p>
|
|
<p><tt class="docutils literal"><span class="pre">image</span></tt> is the disk image being created by running livemedia-creator</p>
|
|
<div class="section" id="quickstart">
|
|
<h2>Quickstart<a class="headerlink" href="#quickstart" title="Permalink to this headline">¶</a></h2>
|
|
<p>Run this to create a bootable live iso:</p>
|
|
<div class="highlight-python"><div class="highlight"><pre>sudo livemedia-creator --make-iso \
|
|
--iso=/extra/iso/boot.iso --ks=./docs/fedora-livemedia.ks
|
|
</pre></div>
|
|
</div>
|
|
<p>You can run it directly from the lorax git repo like this:</p>
|
|
<div class="highlight-python"><div class="highlight"><pre>sudo PATH=./src/sbin/:$PATH PYTHONPATH=./src/ ./src/sbin/livemedia-creator \
|
|
--make-iso --iso=/extra/iso/boot.iso \
|
|
--ks=./docs/fedora-livemedia.ks --lorax-templates=./share/
|
|
</pre></div>
|
|
</div>
|
|
<p>If you want to watch the install you can pass <tt class="docutils literal"><span class="pre">--vnc</span> <span class="pre">vnc</span></tt> and use a vnc client
|
|
to connect to localhost:0</p>
|
|
<p>This is usually a good idea when testing changes to the kickstart. lmc tries
|
|
to monitor the logs for fatal errors, but may not catch everything.</p>
|
|
</div>
|
|
<div class="section" id="how-iso-creation-works">
|
|
<h2>How ISO creation works<a class="headerlink" href="#how-iso-creation-works" title="Permalink to this headline">¶</a></h2>
|
|
<p>There are 2 stages, the install stage which produces a disk or filesystem image
|
|
as its output, and the boot media creation which uses the image as its input.
|
|
Normally you would run both stages, but it is possible to stop after the
|
|
install stage, by using <tt class="docutils literal"><span class="pre">--image-only</span></tt>, or to skip the install stage and use
|
|
a previously created disk image by passing <tt class="docutils literal"><span class="pre">--disk-image</span></tt> or <tt class="docutils literal"><span class="pre">--fs-image</span></tt></p>
|
|
<p>When creating an iso virt-install boots using the passed Anaconda installer iso
|
|
and installs the system based on the kickstart. The <tt class="docutils literal"><span class="pre">%post</span></tt> section of the
|
|
kickstart is used to customize the installed system in the same way that
|
|
current spin-kickstarts do.</p>
|
|
<p>livemedia-creator monitors the install process for problems by watching the
|
|
install logs. They are written to the current directory or to the base
|
|
directory specified by the –logfile command. You can also monitor the install
|
|
by passing <tt class="docutils literal"><span class="pre">--vnc</span> <span class="pre">vnc</span></tt> and using a vnc client. This is recommended when first
|
|
modifying a kickstart, since there are still places where Anaconda may get
|
|
stuck without the log monitor catching it.</p>
|
|
<p>The output from this process is a partitioned disk image. kpartx can be used
|
|
to mount and examine it when there is a problem with the install. It can also
|
|
be booted using kvm.</p>
|
|
<p>When creating an iso the disk image’s / partition is copied into a formatted
|
|
disk image which is then used as the input to lorax for creation of the final
|
|
media.</p>
|
|
<p>The final image is created by lorax, using the templates in /usr/share/lorax/
|
|
or the directory specified by <tt class="docutils literal"><span class="pre">--lorax-templates</span></tt></p>
|
|
<p>Currently the standard lorax templates are used to make a bootable iso, but
|
|
it should be possible to modify them to output other results. They are
|
|
written using the Mako template system which is very flexible.</p>
|
|
</div>
|
|
<div class="section" id="kickstarts">
|
|
<h2>Kickstarts<a class="headerlink" href="#kickstarts" title="Permalink to this headline">¶</a></h2>
|
|
<p>The docs/ directory includes several example kickstarts, one to create a live
|
|
desktop iso using GNOME, and another to create a minimal disk image. When
|
|
creating your own kickstarts you should start with the minimal example, it
|
|
includes several needed packages that are not always included by dependencies.</p>
|
|
<p>Or you can use existing spin kickstarts to create live media with a few
|
|
changes. Here are the steps I used to convert the Fedora XFCE spin.</p>
|
|
<ol class="arabic">
|
|
<li><p class="first">Flatten the xfce kickstart using ksflatten</p>
|
|
</li>
|
|
<li><p class="first">Add zerombr so you don’t get the disk init dialog</p>
|
|
</li>
|
|
<li><p class="first">Add clearpart –all</p>
|
|
</li>
|
|
<li><p class="first">Add swap partition</p>
|
|
</li>
|
|
<li><p class="first">bootloader target</p>
|
|
</li>
|
|
<li><p class="first">Add shutdown to the kickstart</p>
|
|
</li>
|
|
<li><p class="first">Add network –bootproto=dhcp –activate to activate the network
|
|
This works for F16 builds but for F15 and before you need to pass
|
|
something on the cmdline that activate the network, like sshd:</p>
|
|
<blockquote>
|
|
<div><p><tt class="docutils literal"><span class="pre">livemedia-creator</span> <span class="pre">--kernel-args="sshd"</span></tt></p>
|
|
</div></blockquote>
|
|
</li>
|
|
<li><p class="first">Add a root password:</p>
|
|
<div class="highlight-python"><div class="highlight"><pre>rootpw rootme
|
|
network --bootproto=dhcp --activate
|
|
zerombr
|
|
clearpart --all
|
|
bootloader --location=mbr
|
|
part swap --size=512
|
|
shutdown
|
|
</pre></div>
|
|
</div>
|
|
</li>
|
|
<li><p class="first">In the livesys script section of the %post remove the root password. This
|
|
really depends on how the spin wants to work. You could add the live user
|
|
that you create to the %wheel group so that sudo works if you wanted to.</p>
|
|
<blockquote>
|
|
<div><p><tt class="docutils literal"><span class="pre">passwd</span> <span class="pre">-d</span> <span class="pre">root</span> <span class="pre">></span> <span class="pre">/dev/null</span></tt></p>
|
|
</div></blockquote>
|
|
</li>
|
|
<li><p class="first">Remove /etc/fstab in %post, dracut handles mounting the rootfs</p>
|
|
<p><tt class="docutils literal"><span class="pre">cat</span> <span class="pre">/dev/null</span> <span class="pre">></span> <span class="pre">/dev/fstab</span></tt></p>
|
|
<p>Do this only for live iso’s, the filesystem will be mounted read only if
|
|
there is no /etc/fstab</p>
|
|
</li>
|
|
<li><p class="first">Don’t delete initramfs files from /boot in %post</p>
|
|
</li>
|
|
<li><p class="first">When creating live iso’s you need to have, at least, these packages in the %package section::
|
|
dracut-config-generic
|
|
dracut-live
|
|
-dracut-config-rescue
|
|
grub-efi
|
|
memtest86+
|
|
syslinux</p>
|
|
</li>
|
|
</ol>
|
|
<p>One drawback to using virt-install is that it pulls the packages from
|
|
the repo each time you run it. To speed things up you either need a local
|
|
mirror of the packages, or you can use a caching proxy. When using a proxy
|
|
you pass it to livemedia-creator like this:</p>
|
|
<blockquote>
|
|
<div><tt class="docutils literal"><span class="pre">--proxy=http://proxy.yourdomain.com:3128</span></tt></div></blockquote>
|
|
<p>You also need to use a specific mirror instead of mirrormanager so that the
|
|
packages will get cached, so your kickstart url would look like:</p>
|
|
<blockquote>
|
|
<div><tt class="docutils literal"><span class="pre">url</span> <span class="pre">--url="http://dl.fedoraproject.org/pub/fedora/linux/development/rawhide/x86_64/os/"</span></tt></div></blockquote>
|
|
<p>You can also add an update repo, but don’t name it updates. Add –proxy to
|
|
it as well.</p>
|
|
</div>
|
|
<div class="section" id="anaconda-image-install-no-virt">
|
|
<h2>Anaconda image install (no-virt)<a class="headerlink" href="#anaconda-image-install-no-virt" title="Permalink to this headline">¶</a></h2>
|
|
<p>You can create images without using virt-install by passing <tt class="docutils literal"><span class="pre">--no-virt</span></tt> on the
|
|
cmdline. This will use Anaconda’s directory install feature to handle the install.
|
|
There are a couple of things to keep in mind when doing this:</p>
|
|
<ol class="arabic simple">
|
|
<li>It will be most reliable when building images for the same release that the
|
|
host is running. Because Anaconda has expectations about the system it is
|
|
running under you may encounter strange bugs if you try to build newer or
|
|
older releases.</li>
|
|
<li>Make sure selinux is set to permissive or disabled. It won’t install
|
|
correctly with selinux set to enforcing yet.</li>
|
|
<li>It may totally trash your host. So far I haven’t had this happen, but the
|
|
possibility exists that a bug in Anaconda could result in it operating on
|
|
real devices. I recommend running it in a virt or on a system that you can
|
|
afford to lose all data from.</li>
|
|
</ol>
|
|
<p>The logs from anaconda will be placed in an ./anaconda/ directory in either
|
|
the current directory or in the directory used for –logfile</p>
|
|
<p>Example cmdline:</p>
|
|
<p><tt class="docutils literal"><span class="pre">sudo</span> <span class="pre">livemedia-creator</span> <span class="pre">--make-iso</span> <span class="pre">--no-virt</span> <span class="pre">--ks=./fedora-livemedia.ks</span></tt></p>
|
|
<div class="admonition note">
|
|
<p class="first admonition-title">Note</p>
|
|
<p class="last">Using no-virt to create a partitioned disk image (eg. –make-disk or
|
|
–make-vagrant) will only create disks usable on the host platform (BIOS
|
|
or UEFI). You can create BIOS partitioned disk images on UEFI by using
|
|
virt.</p>
|
|
</div>
|
|
</div>
|
|
<div class="section" id="ami-images">
|
|
<h2>AMI Images<a class="headerlink" href="#ami-images" title="Permalink to this headline">¶</a></h2>
|
|
<p>Amazon EC2 images can be created by using the –make-ami switch and an appropriate
|
|
kickstart file. All of the work to customize the image is handled by the kickstart.
|
|
The example currently included was modified from the cloud-kickstarts version so
|
|
that it would work with livemedia-creator.</p>
|
|
<p>Example cmdline:</p>
|
|
<p><tt class="docutils literal"><span class="pre">sudo</span> <span class="pre">livemedia-creator</span> <span class="pre">--make-ami</span> <span class="pre">--iso=/path/to/boot.iso</span> <span class="pre">--ks=./docs/fedora-livemedia-ec2.ks</span></tt></p>
|
|
<p>This will produce an ami-root.img file in the working directory.</p>
|
|
<p>At this time I have not tested the image with EC2. Feedback would be welcome.</p>
|
|
</div>
|
|
<div class="section" id="appliance-creation">
|
|
<h2>Appliance Creation<a class="headerlink" href="#appliance-creation" title="Permalink to this headline">¶</a></h2>
|
|
<p>livemedia-creator can now replace appliance-tools by using the –make-appliance
|
|
switch. This will create the partitioned disk image and an XML file that can be
|
|
used with virt-image to setup a virtual system.</p>
|
|
<p>The XML is generated using the Mako template from
|
|
/usr/share/lorax/appliance/libvirt.xml You can use a different template by
|
|
passing <tt class="docutils literal"><span class="pre">--app-template</span> <span class="pre"><template</span> <span class="pre">path></span></tt></p>
|
|
<p>Documentation on the Mako template system can be found at the <a class="reference external" href="http://docs.makotemplates.org/en/latest/index.html">Mako site</a></p>
|
|
<p>The name of the final output XML is appliance.xml, this can be changed with
|
|
<tt class="docutils literal"><span class="pre">--app-file</span> <span class="pre"><file</span> <span class="pre">path></span></tt></p>
|
|
<p>The following variables are passed to the template:</p>
|
|
<blockquote>
|
|
<div><dl class="docutils">
|
|
<dt><tt class="docutils literal"><span class="pre">disks</span></tt></dt>
|
|
<dd><p class="first">A list of disk_info about each disk.
|
|
Each entry has the following attributes:</p>
|
|
<blockquote class="last">
|
|
<div><p><tt class="docutils literal"><span class="pre">name</span></tt>
|
|
base name of the disk image file</p>
|
|
<p><tt class="docutils literal"><span class="pre">format</span></tt>
|
|
“raw”</p>
|
|
<p><tt class="docutils literal"><span class="pre">checksum_type</span></tt>
|
|
“sha256”</p>
|
|
<p><tt class="docutils literal"><span class="pre">checksum</span></tt>
|
|
sha256 checksum of the disk image</p>
|
|
</div></blockquote>
|
|
</dd>
|
|
</dl>
|
|
<p><tt class="docutils literal"><span class="pre">name</span></tt>
|
|
Name of appliance, from –app-name argument</p>
|
|
<p><tt class="docutils literal"><span class="pre">arch</span></tt>
|
|
Architecture</p>
|
|
<p><tt class="docutils literal"><span class="pre">memory</span></tt>
|
|
Memory in KB (from <tt class="docutils literal"><span class="pre">--ram</span></tt>)</p>
|
|
<p><tt class="docutils literal"><span class="pre">vcpus</span></tt>
|
|
from <tt class="docutils literal"><span class="pre">--vcpus</span></tt></p>
|
|
<p><tt class="docutils literal"><span class="pre">networks</span></tt>
|
|
list of networks from the kickstart or []</p>
|
|
<p><tt class="docutils literal"><span class="pre">title</span></tt>
|
|
from <tt class="docutils literal"><span class="pre">--title</span></tt></p>
|
|
<p><tt class="docutils literal"><span class="pre">project</span></tt>
|
|
from <tt class="docutils literal"><span class="pre">--project</span></tt></p>
|
|
<p><tt class="docutils literal"><span class="pre">releasever</span></tt>
|
|
from <tt class="docutils literal"><span class="pre">--releasever</span></tt></p>
|
|
</div></blockquote>
|
|
<p>The created image can be imported into libvirt using:</p>
|
|
<blockquote>
|
|
<div><tt class="docutils literal"><span class="pre">virt-image</span> <span class="pre">appliance.xml</span></tt></div></blockquote>
|
|
<p>You can also create qcow2 appliance images using <tt class="docutils literal"><span class="pre">--qcow2</span></tt>, for example:</p>
|
|
<div class="highlight-python"><div class="highlight"><pre>sudo livemedia-creator --make-appliance --iso=/path/to/boot.iso --ks=./docs/fedora-minimal.ks \
|
|
--qcow2 --app-file=minimal-test.xml --image-name=minimal-test.img
|
|
</pre></div>
|
|
</div>
|
|
</div>
|
|
<div class="section" id="filesystem-image-creation">
|
|
<h2>Filesystem Image Creation<a class="headerlink" href="#filesystem-image-creation" title="Permalink to this headline">¶</a></h2>
|
|
<p>livemedia-creator can be used to create un-partitined filesystem images using the
|
|
<tt class="docutils literal"><span class="pre">--make-fsimage</span></tt> option. As of version 21.8 this works with both virt-install and no-virt modes
|
|
of operation. Previously it was only available with no-virt.</p>
|
|
<p>Kickstarts should have a single / partition with no extra mountpoints.</p>
|
|
<blockquote>
|
|
<div><tt class="docutils literal"><span class="pre">livemedia-creator</span> <span class="pre">--make-fsimage</span> <span class="pre">--iso=/path/to/boot.iso</span> <span class="pre">--ks=./docs/fedora-minimal.ks</span></tt></div></blockquote>
|
|
<p>You can name the output image with <tt class="docutils literal"><span class="pre">--image-name</span></tt> and set a label on the filesystem with <tt class="docutils literal"><span class="pre">--fs-label</span></tt></p>
|
|
</div>
|
|
<div class="section" id="tar-file-creation">
|
|
<h2>TAR File Creation<a class="headerlink" href="#tar-file-creation" title="Permalink to this headline">¶</a></h2>
|
|
<p>The <tt class="docutils literal"><span class="pre">--make-tar</span></tt> command can be used to create a tar of the root filesystem. By
|
|
default it is compressed using xz, but this can be changed using the
|
|
<tt class="docutils literal"><span class="pre">--compression</span></tt> and <tt class="docutils literal"><span class="pre">--compress-arg</span></tt> options. This option works with both virt and
|
|
no-virt install methods.</p>
|
|
<p>As with <tt class="docutils literal"><span class="pre">--make-fsimage</span></tt> the kickstart should be limited to a single / partition.</p>
|
|
<p>For example:</p>
|
|
<div class="highlight-python"><div class="highlight"><pre>livemedia-creator --make-tar --iso=/path/to/boot.iso --ks=./docs/fedora-minimal.ks \
|
|
--image-name=fedora-root.tar.xz
|
|
</pre></div>
|
|
</div>
|
|
</div>
|
|
<div class="section" id="live-image-for-pxe-boot">
|
|
<h2>Live Image for PXE Boot<a class="headerlink" href="#live-image-for-pxe-boot" title="Permalink to this headline">¶</a></h2>
|
|
<p>The <tt class="docutils literal"><span class="pre">--make-pxe-live</span></tt> command will produce squashfs image containing live root
|
|
filesystem that can be used for pxe boot. Directory with results will contain
|
|
the live image, kernel image, initrd image and template of pxe configuration
|
|
for the images.</p>
|
|
</div>
|
|
<div class="section" id="atomic-live-image-for-pxe-boot">
|
|
<h2>Atomic Live Image for PXE Boot<a class="headerlink" href="#atomic-live-image-for-pxe-boot" title="Permalink to this headline">¶</a></h2>
|
|
<p>The <tt class="docutils literal"><span class="pre">--make-ostree-live</span></tt> command will produce the same result as <tt class="docutils literal"><span class="pre">--make-pxe-live</span></tt>
|
|
for installations of Atomic Host. Example kickstart for such an installation
|
|
using Atomic installer iso with local repo included in the image can be found
|
|
in docs/rhel-atomic-pxe-live.ks.</p>
|
|
</div>
|
|
<div class="section" id="using-mock-to-create-images">
|
|
<h2>Using Mock to Create Images<a class="headerlink" href="#using-mock-to-create-images" title="Permalink to this headline">¶</a></h2>
|
|
<p>As of lorax version 22.2 you can use livemedia-creator and anaconda version
|
|
22.15 inside of a mock chroot with –make-iso and –make-fsimage.</p>
|
|
<div class="admonition note">
|
|
<p class="first admonition-title">Note</p>
|
|
<p class="last">As of mock 1.2.12 you no longer need to bind mount <tt class="docutils literal"><span class="pre">/dev/</span></tt>, loop devices are setup
|
|
as part of the standard mock <tt class="docutils literal"><span class="pre">/dev/</span></tt> creation.</p>
|
|
</div>
|
|
<p>On the host system:</p>
|
|
<ol class="arabic">
|
|
<li><p class="first">yum install -y mock</p>
|
|
</li>
|
|
<li><p class="first">Add a user to the mock group to use for running mock. eg. builder</p>
|
|
</li>
|
|
<li><p class="first">Create a new /etc/mock/ config file based on the rawhide one, or modify the
|
|
existing one so that the following options are setup:</p>
|
|
<div class="highlight-python"><div class="highlight"><pre><span class="n">config_opts</span><span class="p">[</span><span class="s">'chroot_setup_cmd'</span><span class="p">]</span> <span class="o">=</span> <span class="s">'install @buildsys-build anaconda-tui lorax'</span>
|
|
|
|
<span class="c"># build results go into /home/builder/results/</span>
|
|
<span class="n">config_opts</span><span class="p">[</span><span class="s">'plugin_conf'</span><span class="p">][</span><span class="s">'bind_mount_opts'</span><span class="p">][</span><span class="s">'dirs'</span><span class="p">]</span><span class="o">.</span><span class="n">append</span><span class="p">((</span><span class="s">'/home/builder/results'</span><span class="p">,</span><span class="s">'/results/'</span><span class="p">))</span>
|
|
</pre></div>
|
|
</div>
|
|
<p>If you are creating images for a branched release of Fedora you should also enable
|
|
the updates-testing repository so that you get the latest builds in your mock chroot.</p>
|
|
</li>
|
|
</ol>
|
|
<p>The following steps are run as the builder user who is a member of the mock
|
|
group.</p>
|
|
<ol class="arabic" start="4">
|
|
<li><p class="first">Make a directory for results matching the bind mount above
|
|
<tt class="docutils literal"><span class="pre">mkdir</span> <span class="pre">~/results/</span></tt></p>
|
|
</li>
|
|
<li><p class="first">Copy the example kickstarts
|
|
<tt class="docutils literal"><span class="pre">cp</span> <span class="pre">/usr/share/docs/lorax/*ks</span> <span class="pre">.</span></tt></p>
|
|
</li>
|
|
<li><p class="first">Make sure tar and dracut-network are in the %packages section and that the
|
|
<tt class="docutils literal"><span class="pre">url</span> <span class="pre">points</span> <span class="pre">to</span> <span class="pre">the</span> <span class="pre">correct</span> <span class="pre">repo</span></tt></p>
|
|
</li>
|
|
<li><p class="first">Init the mock
|
|
<tt class="docutils literal"><span class="pre">mock</span> <span class="pre">-r</span> <span class="pre">fedora-rawhide-x86_64</span> <span class="pre">--init</span></tt></p>
|
|
</li>
|
|
<li><p class="first">Copy the kickstart inside the mock
|
|
<tt class="docutils literal"><span class="pre">mock</span> <span class="pre">-r</span> <span class="pre">fedora-rawhide-x86_64</span> <span class="pre">--copyin</span> <span class="pre">./fedora-minimal.ks</span> <span class="pre">/root/</span></tt></p>
|
|
</li>
|
|
<li><p class="first">Make a minimal iso:</p>
|
|
<div class="highlight-python"><div class="highlight"><pre>mock -r fedora-rawhide-x86_64 --chroot -- livemedia-creator --no-virt \
|
|
--resultdir=/results/try-1 --logfile=/results/logs/try-1/try-1.log \
|
|
--make-iso --ks /root/fedora-minimal.ks
|
|
</pre></div>
|
|
</div>
|
|
</li>
|
|
</ol>
|
|
<p>Results will be in ./results/try-1 and logs under /results/logs/try-1/
|
|
including anaconda logs and livemedia-creator logs. The new iso will be
|
|
located at ~/results/try-1/images/boot.iso, and the ~/results/try-1/
|
|
directory tree will also contain the vmlinuz, initrd, etc.</p>
|
|
</div>
|
|
<div class="section" id="openstack-image-creation">
|
|
<h2>OpenStack Image Creation<a class="headerlink" href="#openstack-image-creation" title="Permalink to this headline">¶</a></h2>
|
|
<p>OpenStack supports partitioned disk images so <tt class="docutils literal"><span class="pre">--make-disk</span></tt> can be used to
|
|
create images for importing into glance, OpenStack’s image storage component.
|
|
You need to have access to an OpenStack provider that allows image uploads, or
|
|
setup your own using the instructions from the <a class="reference external" href="https://www.rdoproject.org/Quickstart">RDO Project</a>.</p>
|
|
<p>The example kickstart, fedora-openstack.ks, is only slightly different than the
|
|
fedora-minimal.ks one. It adds the cloud-init and cloud-utils-growpart
|
|
packages. OpenStack supports setting up the image using cloud-init, and
|
|
cloud-utils-growpart will grow the image to fit the instance’s disk size.</p>
|
|
<p>Create a qcow2 image using the kickstart like this:</p>
|
|
<blockquote>
|
|
<div><tt class="docutils literal"><span class="pre">sudo</span> <span class="pre">livemedia-creator</span> <span class="pre">--make-disk</span> <span class="pre">--iso=/path/to/boot.iso</span> <span class="pre">--ks=/path/to/fedora-openstack.ks</span> <span class="pre">--qcow2</span></tt></div></blockquote>
|
|
<div class="admonition note">
|
|
<p class="first admonition-title">Note</p>
|
|
<p class="last">On the RHEL7 version of lmc <tt class="docutils literal"><span class="pre">--qcow2</span></tt> isn’t supported. You can only create a bare partitioned disk image.</p>
|
|
</div>
|
|
<p>Import the resulting disk image into the OpenStack system, either via the web UI, or glance on the cmdline:</p>
|
|
<div class="highlight-python"><div class="highlight"><pre>glance image-create --name "fedora-openstack" --is-public true --disk-format qcow2 \
|
|
--container-format bare --file ./fedora-openstack.qcow2
|
|
</pre></div>
|
|
</div>
|
|
<p>If qcow2 wasn’t used then <tt class="docutils literal"><span class="pre">--disk-format</span></tt> should be set to raw.</p>
|
|
</div>
|
|
<div class="section" id="docker-image-creation">
|
|
<h2>Docker Image Creation<a class="headerlink" href="#docker-image-creation" title="Permalink to this headline">¶</a></h2>
|
|
<p>Use lmc to create a tarfile as described in the <a class="reference internal" href="#tar-file-creation">TAR File Creation</a> section, but substitute the
|
|
fedora-docker.ks example kickstart which removes the requirement for core files and the kernel.</p>
|
|
<p>You can then import the tarfile into docker like this (as root):</p>
|
|
<blockquote>
|
|
<div><tt class="docutils literal"><span class="pre">cat</span> <span class="pre">/var/tmp/fedora-root.tar.xz</span> <span class="pre">|</span> <span class="pre">docker</span> <span class="pre">import</span> <span class="pre">-</span> <span class="pre">fedora-root</span></tt></div></blockquote>
|
|
<p>And then run bash inside of it:</p>
|
|
<blockquote>
|
|
<div><tt class="docutils literal"><span class="pre">sudo</span> <span class="pre">docker</span> <span class="pre">run</span> <span class="pre">-i</span> <span class="pre">-t</span> <span class="pre">fedora-root</span> <span class="pre">/bin/bash</span></tt></div></blockquote>
|
|
</div>
|
|
<div class="section" id="open-container-initiative-image-creation">
|
|
<h2>Open Container Initiative Image Creation<a class="headerlink" href="#open-container-initiative-image-creation" title="Permalink to this headline">¶</a></h2>
|
|
<p>The OCI is a new specification that is still being worked on. You can read more about it at
|
|
<a class="reference external" href="https://www.opencontainers.org/">the Open Container Initiative website</a>. You can create
|
|
OCI images using the following command:</p>
|
|
<div class="highlight-python"><div class="highlight"><pre>sudo livemedia-creator --make-oci --oci-config /path/to/config.json --oci-runtime /path/to/runtime.json \
|
|
--iso=/path/to/boot.iso --ks=/path/to/fedora-minimal.ks
|
|
</pre></div>
|
|
</div>
|
|
<p>You must provide the config.json and runtime.json files to be included in the bundle,
|
|
their specifications can be found <a class="reference external" href="https://github.com/opencontainers/specs">on the OCI github project</a>
|
|
output will be in the results directory with a default name of bundle.tar.xz</p>
|
|
<p>This will work with <tt class="docutils literal"><span class="pre">--no-virt</span></tt> and inside a mock since it doesn’t use any
|
|
partitioned disk images.</p>
|
|
</div>
|
|
<div class="section" id="vagrant-image-creation">
|
|
<h2>Vagrant Image Creation<a class="headerlink" href="#vagrant-image-creation" title="Permalink to this headline">¶</a></h2>
|
|
<p><a class="reference external" href="https://www.vagrantup.com/">Vagrant</a> images can be created using the following command:</p>
|
|
<div class="highlight-python"><div class="highlight"><pre>sudo livemedia-creator --make-vagrant --vagrant-metadata /path/to/metadata.json \
|
|
--iso=/path/to/boot.iso --ks=/path/to/fedora-vagrant.ks
|
|
</pre></div>
|
|
</div>
|
|
<p>The image created is a <a class="reference external" href="https://github.com/pradels/vagrant-libvirt">vagrant-libvirt</a> provider image and needs to have
|
|
vagrant setup with libvirt before you can use it.</p>
|
|
<p>The <tt class="docutils literal"><span class="pre">--vagrant-metadata</span></tt> file is optional, it will create a minimal one by
|
|
default, and if one is passed it will make sure the disk size is setup
|
|
correctly. If you pass a <tt class="docutils literal"><span class="pre">--vagrant-vagrantfile</span></tt> it will be included in the
|
|
image verbatim. By default no vagrantfile is created.</p>
|
|
<p>There is an example Vagrant kickstart file in the docs directory that sets up
|
|
the vagrant user with the default insecure SSH pubkey and a few useful
|
|
utilities.</p>
|
|
<p>This also works with <tt class="docutils literal"><span class="pre">--no-virt</span></tt>, but will not work inside a mock due to its
|
|
use of partitioned disk images and qcow2.</p>
|
|
</div>
|
|
<div class="section" id="creating-uefi-disk-images-with-virt">
|
|
<h2>Creating UEFI disk images with virt<a class="headerlink" href="#creating-uefi-disk-images-with-virt" title="Permalink to this headline">¶</a></h2>
|
|
<p>Partitioned disk images can only be created for the same platform as the host system (BIOS or
|
|
UEFI). You can use virt to create BIOS images on UEFI systems, and it is also possible
|
|
to create UEFI images on BIOS systems using OVMF. You first need to setup your system with
|
|
the OVMF firmware. The details can be <a class="reference external" href="http://www.linux-kvm.org/page/OVMF">found here linux-kvm OVMF page</a>
|
|
but it amounts to:</p>
|
|
<ol class="arabic simple">
|
|
<li>Download the firmware.repo from <a class="reference external" href="https://www.kraxel.org/repos/">Gerd Hoffmann</a> and install it
|
|
in /etc/yum.repos.d/</li>
|
|
<li>Install the edk2.git-ovmf-x64 package</li>
|
|
<li>Copy /usr/share/edk2.git/ovmf-x64/OVMF_CODE-pure-efi.fd to /usr/share/OVMF/OVMF_CODE.fd</li>
|
|
<li>Copy /usr/share/edk2.git/ovmf-x64/OVMF_VARS-pure-efi.fd to /usr/share/OVMF/OVMF_VARS.fd</li>
|
|
</ol>
|
|
<p>Now you can run livemedia-creator with <tt class="docutils literal"><span class="pre">--virt-uefi</span></tt> to boot and install using UEFI:</p>
|
|
<div class="highlight-python"><div class="highlight"><pre>sudo livemedia-creator --make-disk --virt-uefi --iso=/path/to/boot.iso \
|
|
--ks=/path/to/fedora-minimal.ks
|
|
</pre></div>
|
|
</div>
|
|
<p>Make sure that the kickstart you are using creates a /boot/efi partition by including this:</p>
|
|
<div class="highlight-python"><div class="highlight"><pre><span class="n">part</span> <span class="o">/</span><span class="n">boot</span><span class="o">/</span><span class="n">efi</span> <span class="o">--</span><span class="n">fstype</span><span class="o">=</span><span class="s">"efi"</span> <span class="o">--</span><span class="n">size</span><span class="o">=</span><span class="mi">500</span>
|
|
</pre></div>
|
|
</div>
|
|
<div class="admonition note">
|
|
<p class="first admonition-title">Note</p>
|
|
<p class="last">When using the resulting image with the current version of OVMF (edk2.git-ovmf-x64-0-20151103.b1295.ge5cffca)
|
|
it will not boot automatically because there is a problem with the fallback path.
|
|
You can boot it by entering the UEFI shell and running EFI/fedora/shim.efi and
|
|
then using efibootmgr to setup the correct boot entry.</p>
|
|
</div>
|
|
</div>
|
|
<div class="section" id="debugging-problems">
|
|
<h2>Debugging problems<a class="headerlink" href="#debugging-problems" title="Permalink to this headline">¶</a></h2>
|
|
<p>Sometimes an installation will get stuck. When using virt-install the logs will
|
|
be written to ./virt-install.log and most of the time any problems that happen
|
|
will be near the end of the file. lmc tries to detect common errors and will
|
|
cancel the installation when they happen. But not everything can be caught.
|
|
When creating a new kickstart it is helpful to use the <tt class="docutils literal"><span class="pre">--vnc</span> <span class="pre">vnc</span></tt> command so
|
|
that you can monitor the installation as it happens, and if it gets stuck
|
|
without lmc detecting the problem you can switch to tty1 and examine the system
|
|
directly.</p>
|
|
<p>If it does get stuck the best way to cancel is to use virsh to destroy the domain.</p>
|
|
<ol class="arabic simple">
|
|
<li>Use <tt class="docutils literal"><span class="pre">sudo</span> <span class="pre">virsh</span> <span class="pre">list</span></tt> to show the name of the virt. It will start with LiveOS and contain a UUID.</li>
|
|
<li>Run <tt class="docutils literal"><span class="pre">sudo</span> <span class="pre">virsh</span> <span class="pre">destroy</span> <span class="pre"><name></span></tt> to destroy the domain.</li>
|
|
<li>Wait 20 seconds or so for lmc to detect that the domain vanished. It should handle cleanup.</li>
|
|
</ol>
|
|
<p>If lmc didn’t handle the cleanup for some reason you can do this:
|
|
1. <tt class="docutils literal"><span class="pre">sudo</span> <span class="pre">virsh</span> <span class="pre">undefine</span> <span class="pre"><name></span></tt>
|
|
2. <tt class="docutils literal"><span class="pre">sudo</span> <span class="pre">umount</span> <span class="pre">/tmp/tmpXXXX</span></tt> to unmount the iso from its mountpoint.
|
|
3. <tt class="docutils literal"><span class="pre">sudo</span> <span class="pre">rm</span> <span class="pre">-rf</span> <span class="pre">/tmp/tmpXXXX</span></tt>
|
|
4. <tt class="docutils literal"><span class="pre">sudo</span> <span class="pre">rm</span> <span class="pre">/var/tmp/diskXXXXX</span></tt> to remove the disk image.</p>
|
|
<p>The logs from the virt-install run are stored in virt-install.log,
|
|
logs from livemedia-creator are in livemedia.log and program.log</p>
|
|
<p>You can add <tt class="docutils literal"><span class="pre">--image-only</span></tt> to skip the .iso creation and examine the resulting
|
|
disk image. Or you can pass <tt class="docutils literal"><span class="pre">--keep-image</span></tt> to keep it around after the iso has
|
|
been created.</p>
|
|
<p>Cleaning up aborted <tt class="docutils literal"><span class="pre">--no-virt</span></tt> installs can sometimes be accomplished by
|
|
running the <tt class="docutils literal"><span class="pre">anaconda-cleanup</span></tt> script. As of Fedora 18 anaconda is
|
|
multi-threaded and it can sometimes become stuck and refuse to exit. When this
|
|
happens you can usually clean up by first killing the anaconda process then
|
|
running <tt class="docutils literal"><span class="pre">anaconda-cleanup</span></tt>.</p>
|
|
</div>
|
|
<div class="section" id="hacking">
|
|
<h2>Hacking<a class="headerlink" href="#hacking" title="Permalink to this headline">¶</a></h2>
|
|
<p>Development on this will take place as part of the lorax project, and on the
|
|
anaconda-devel-list mailing list, and <a class="reference external" href="https://github.com/rhinstaller/lorax">on github</a></p>
|
|
<p>Feedback, enhancements and bugs are welcome. You can use <a class="reference external" href="https://bugzilla.redhat.com/enter_bug.cgi?product=Fedora&component=lorax">bugzilla</a> to
|
|
report bugs against the lorax component.</p>
|
|
</div>
|
|
</div>
|
|
|
|
|
|
</div>
|
|
<footer>
|
|
|
|
<div class="rst-footer-buttons" role="navigation" aria-label="footer navigation">
|
|
|
|
<a href="product-images.html" class="btn btn-neutral float-right" title="Product and Updates Images" accesskey="n">Next <span class="fa fa-arrow-circle-right"></span></a>
|
|
|
|
|
|
<a href="lorax.html" class="btn btn-neutral" title="lorax" accesskey="p"><span class="fa fa-arrow-circle-left"></span> Previous</a>
|
|
|
|
</div>
|
|
|
|
|
|
<hr/>
|
|
|
|
<div role="contentinfo">
|
|
<p>
|
|
© Copyright 2015, Red Hat, Inc..
|
|
</p>
|
|
</div>
|
|
Built with <a href="http://sphinx-doc.org/">Sphinx</a> using a <a href="https://github.com/snide/sphinx_rtd_theme">theme</a> provided by <a href="https://readthedocs.org">Read the Docs</a>.
|
|
|
|
</footer>
|
|
|
|
</div>
|
|
</div>
|
|
|
|
</section>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
|
|
<script type="text/javascript">
|
|
var DOCUMENTATION_OPTIONS = {
|
|
URL_ROOT:'./',
|
|
VERSION:'24.6',
|
|
COLLAPSE_INDEX:false,
|
|
FILE_SUFFIX:'.html',
|
|
HAS_SOURCE: true
|
|
};
|
|
</script>
|
|
<script type="text/javascript" src="_static/jquery.js"></script>
|
|
<script type="text/javascript" src="_static/underscore.js"></script>
|
|
<script type="text/javascript" src="_static/doctools.js"></script>
|
|
|
|
|
|
|
|
|
|
|
|
<script type="text/javascript" src="_static/js/theme.js"></script>
|
|
|
|
|
|
|
|
|
|
<script type="text/javascript">
|
|
jQuery(function () {
|
|
SphinxRtdTheme.StickyNav.enable();
|
|
});
|
|
</script>
|
|
|
|
|
|
</body>
|
|
</html> |