1LIVEMEDIA-CREATOR(1)                 Lorax                LIVEMEDIA-CREATOR(1)
2
3
4

NAME

6       livemedia-creator - Live Media Creator Documentation
7
8       Authors
9              Brian C. Lane <bcl@redhat.com>
10
11       livemedia-creator uses Anaconda, kickstart and Lorax to create bootable
12       media that use the same install path as a normal  system  installation.
13       It  can  be used to make live isos, bootable (partitioned) disk images,
14       tarfiles, and filesystem images for use with  virtualization  and  con‐
15       tainer solutions like libvirt, docker, and OpenStack.
16
17       The general idea is to use qemu with kickstart and an Anaconda boot.iso
18       to install into a disk image and then use the disk image to create  the
19       bootable media.
20
21       livemedia-creator --help will describe all of the options available. At
22       the minimum you need:
23
24       --make-iso to create a final bootable .iso or one of the other --make-*
25       options.
26
27       --iso to specify the Anaconda install media to use with qemu.
28
29       --ks to select the kickstart file describing what to install.
30
31       To use livemedia-creator with virtualization you will need to have qemu
32       installed.
33
34       If you are going to be using Anaconda directly,  with  --no-virt  mode,
35       make sure you have the anaconda-tui package installed.
36
37       Conventions used in this document:
38
39       lmc is an abbreviation for livemedia-creator.
40
41       builder is the system where livemedia-creator is being run
42
43       image is the disk image being created by running livemedia-creator
44

LIVEMEDIA-CREATOR CMDLINE ARGUMENTS

46       Create Live Install Media
47
48
49          usage: livemedia-creator [-h]
50                                   (--make-iso | --make-disk | --make-fsimage | --make-appliance | --make-ami | --make-tar | --make-tar-disk | --make-pxe-live | --make-ostree-live | --make-oci | --make-vagrant)
51                                   [--iso ISO] [--iso-only] [--iso-name ISO_NAME] [--ks KS] [--image-only] [--no-virt]
52                                   [--proxy PROXY] [--anaconda-arg ANACONDA_ARGS] [--armplatform ARMPLATFORM]
53                                   [--location LOCATION] [--logfile LOGFILE] [--lorax-templates LORAX_TEMPLATES] [--tmp TMP]
54                                   [--resultdir RESULT_DIR] [--macboot] [--nomacboot] [--extra-boot-args EXTRA_BOOT_ARGS]
55                                   [--disk-image DISK_IMAGE] [--keep-image] [--fs-image FS_IMAGE] [--image-name IMAGE_NAME]
56                                   [--tar-disk-name TAR_DISK_NAME] [--fs-label FS_LABEL] [--image-size-align IMAGE_SIZE_ALIGN]
57                                   [--image-type IMAGE_TYPE] [--qemu-arg QEMU_ARGS] [--qcow2] [--qcow2-arg QEMU_ARGS]
58                                   [--compression COMPRESSION] [--compress-arg COMPRESS_ARGS] [--app-name APP_NAME]
59                                   [--app-template APP_TEMPLATE] [--app-file APP_FILE] [--ram MEMORY] [--vcpus VCPUS]
60                                   [--vnc VNC] [--arch ARCH] [--kernel-args KERNEL_ARGS] [--ovmf-path OVMF_PATH] [--virt-uefi]
61                                   [--no-kvm] [--with-rng WITH_RNG] [--dracut-conf DRACUT_CONF] [--dracut-arg DRACUT_ARGS]
62                                   [--live-rootfs-size LIVE_ROOTFS_SIZE] [--live-rootfs-keep-size] [--oci-config OCI_CONFIG]
63                                   [--oci-runtime OCI_RUNTIME] [--vagrant-metadata VAGRANT_METADATA]
64                                   [--vagrantfile VAGRANTFILE] [--project PROJECT] [--releasever RELEASEVER] [--volid VOLID]
65                                   [--squashfs-only] [--timeout TIMEOUT] [-V]
66
67   Named Arguments
68       -make-iso
69              Build a live iso
70
71              Default: False
72
73       -make-disk
74              Build a partitioned disk image
75
76              Default: False
77
78       -make-fsimage
79              Build a filesystem image
80
81              Default: False
82
83       -make-appliance
84              Build an appliance image and XML description
85
86              Default: False
87
88       -make-ami
89              Build an ami image
90
91              Default: False
92
93       -make-tar
94              Build a tar of the root filesystem
95
96              Default: False
97
98       -make-tar-disk
99              Build a tar of a partitioned disk image
100
101              Default: False
102
103       -make-pxe-live
104              Build a live pxe boot squashfs image
105
106              Default: False
107
108       -make-ostree-live
109              Build a live pxe boot squashfs image of Atomic Host
110
111              Default: False
112
113       -make-oci
114              Build an Open Container Initiative image
115
116              Default: False
117
118       -make-vagrant
119              Build a Vagrant Box image
120
121              Default: False
122
123       -iso   Anaconda installation .iso path to use for qemu
124
125       -iso-only
126              Remove  all  iso creation artifacts except the boot.iso, combine
127              with --iso-name to rename the boot.iso
128
129              Default: False
130
131       -iso-name
132              Name of output iso file for --iso-only. Default is boot.iso
133
134       -ks    Kickstart file defining the install.
135
136       -image-only
137              Exit after creating fs/disk image.
138
139              Default: False
140
141       -no-virt
142              Run anaconda directly on host instead of using qemu
143
144              Default: False
145
146       -proxy proxy URL to use for the install
147
148       -anaconda-arg
149              Additional argument to pass to  anaconda  (no-virt  mode).  Pass
150              once for each argument
151
152       -armplatform
153              the  platform  to  use when creating images for ARM, i.e., high‐
154              bank, mvebu, omap, tegra, etc.
155
156       -location
157              location of iso directory tree with initrd.img and vmlinuz. Used
158              to run qemu with a newer initrd than the iso.
159
160       -logfile
161              Name and path for primary logfile, other logs will be created in
162              the same directory.
163
164              Default: ./livemedia.log
165
166       -lorax-templates
167              Path to mako templates for lorax
168
169       -tmp   Top level temporary directory
170
171              Default: /var/tmp
172
173       -resultdir
174              Directory to copy the resulting images and iso into. Defaults to
175              the temporary working directory
176
177       -macboot
178              Make the iso bootable on UEFI based Mac systems
179
180              Default: True
181
182       -nomacboot
183              Do not create a Mac bootable iso
184
185              Default: False
186
187       -extra-boot-args
188              Extra  arguments  to add to the bootloader kernel cmdline in the
189              templates
190
191              Default: ""
192
193       -project
194              substituted for @PROJECT@ in bootloader config files
195
196              Default: "Linux"
197
198       -releasever
199              substituted for @VERSION@ in bootloader config files
200
201              Default: "32"
202
203       -volid volume id
204
205       -squashfs-only
206              Use a plain squashfs filesystem for the runtime.
207
208              Default: False
209
210       -timeout
211              Cancel installer after X minutes
212
213       V      show program's version number and exit
214
215   disk/fs image arguments
216       -disk-image
217              Path to existing disk image to use for creating final image.
218
219       -keep-image
220              Keep raw disk image after .iso creation
221
222              Default: False
223
224       -fs-image
225              Path to existing filesystem image  to  use  for  creating  final
226              image.
227
228       -image-name
229              Name  of output file to create. Used for tar, fs and disk image.
230              Default is a random name.
231
232       -tar-disk-name
233              Name of the archive member for make-tar-disk.
234
235       -fs-label
236              Label to set on fsimage, default is 'Anaconda'
237
238              Default: "Anaconda"
239
240       -image-size-align
241              Create a disk image with a size that is a multiple of this value
242              in MiB.
243
244              Default: 0
245
246       -image-type
247              Create an image with qemu-img. See qemu-img --help for supported
248              formats.
249
250       -qemu-arg
251              Arguments to pass to qemu-img. Pass once for each argument, they
252              will be used for ALL calls to qemu-img.
253
254              Default: []
255
256       -qcow2 Create  qcow2 image instead of raw sparse image when making disk
257              images.
258
259              Default: False
260
261       -qcow2-arg
262              Arguments to pass to qemu-img. Pass once for each argument, they
263              will be used for ALL calls to qemu-img.
264
265              Default: []
266
267       -compression
268              Compression  binary  for make-tar. xz, lzma, gzip, and bzip2 are
269              supported. xz is the default.
270
271              Default: "xz"
272
273       -compress-arg
274              Arguments to pass to compression. Pass once for each argument
275
276              Default: []
277
278   appliance arguments
279       -app-name
280              Name of appliance to pass to template
281
282       -app-template
283              Path to template to use for appliance data.
284
285       -app-file
286              Appliance template results file.
287
288              Default: "appliance.xml"
289
290   qemu arguments
291       -ram   Memory to allocate for installer in megabytes.
292
293              Default: 2048
294
295       -vcpus Passed to qemu -smp command
296
297       -vnc   Passed to qemu -display command. eg. vnc=127.0.0.1:5, default is
298              to choose the first unused vnc port.
299
300       -arch  System  arch to build for. Used to select qemu-system-* command.
301              Defaults to qemu-system-<arch>
302
303       -kernel-args
304              Additional argument to pass to the installation kernel
305
306       -ovmf-path
307              Path to OVMF firmware
308
309              Default: "/usr/share/edk2/ovmf/"
310
311       -virt-uefi
312              Use OVMF firmware to boot the VM in UEFI mode
313
314              Default: False
315
316       -no-kvm
317              Skip using kvm with qemu even if it is available.
318
319              Default: False
320
321       -with-rng
322              RNG device for QEMU (none for no RNG)
323
324              Default: "/dev/random"
325
326   dracut arguments: (default: )
327       -dracut-conf
328              Path to a dracut.conf file to use instead of the  default  argu‐
329              ments. See the dracut.conf(5) manpage.
330
331       -dracut-arg
332              Argument  to  pass to dracut when rebuilding the initramfs. Pass
333              this once for each argument. NOTE: this overrides the defaults.
334
335   pxe to live arguments
336       -live-rootfs-size
337              Size of root filesystem of live image in GiB
338
339              Default: 0
340
341       -live-rootfs-keep-size
342              Keep the original size of root filesystem in live image
343
344              Default: False
345
346   OCI arguments
347       -oci-config
348              config.json OCI configuration file
349
350       -oci-runtime
351              runtime.json OCI configuration file
352
353   Vagrant arguments
354       -vagrant-metadata
355              optional metadata.json file
356
357       -vagrantfile
358              optional vagrantfile
359

QUICKSTART

361       Run this to create a bootable live iso:
362
363          sudo livemedia-creator --make-iso \
364          --iso=/extra/iso/boot.iso --ks=./docs/fedora-livemedia.ks
365
366       You can run it directly from the lorax git repo like this:
367
368          sudo PATH=./src/sbin/:$PATH PYTHONPATH=./src/ ./src/sbin/livemedia-creator \
369          --make-iso --iso=/extra/iso/boot.iso \
370          --ks=./docs/fedora-livemedia.ks --lorax-templates=./share/
371
372       You can observe the installation using vnc. The  logs  will  show  what
373       port  was  chosen,  or  you  can use a specific port by passing it. eg.
374       --vnc vnc:127.0.0.1:5
375
376       This is usually a good idea when testing changes to the kickstart.  lmc
377       tries  to  monitor  the logs for fatal errors, but may not catch every‐
378       thing.
379

HOW ISO CREATION WORKS

381       There are 2 stages, the install stage which produces a disk or filesys‐
382       tem  image  as  its  output, and the boot media creation which uses the
383       image as its input.  Normally you would run both stages, but it is pos‐
384       sible  to  stop  after  the install stage, by using --image-only, or to
385       skip the install stage and use a previously created disk image by pass‐
386       ing --disk-image or --fs-image
387
388       When creating an iso qemu boots using the passed Anaconda installer iso
389       and installs the system based on the kickstart. The  %post  section  of
390       the kickstart is used to customize the installed system in the same way
391       that current spin-kickstarts do.
392
393       livemedia-creator monitors the install process for problems by watching
394       the  install  logs. They are written to the current directory or to the
395       base directory specified by the --logfile command. You can also monitor
396       the install by using a vnc client. This is recommended when first modi‐
397       fying a kickstart, since there are still places where Anaconda may  get
398       stuck without the log monitor catching it.
399
400       The output from this process is a partitioned disk image. kpartx can be
401       used to mount and examine it when there is a problem with the  install.
402       It can also be booted using kvm.
403
404       When creating an iso the disk image's / partition is copied into a for‐
405       matted filesystem image which is then used as the input  to  lorax  for
406       creation of the final media.
407
408       The   final   image  is  created  by  lorax,  using  the  templates  in
409       /usr/share/lorax/live/ or the live directory below the directory speci‐
410       fied  by  --lorax-templates.  The  templates are written using the Mako
411       template system with some extra commands added by lorax.
412
413       NOTE:
414          The output from --make-iso includes the artifacts used to create the
415          boot.iso;  the  kernel, initrd, the squashfs filesystem, etc. If you
416          only want the boot.iso you can pass --iso-only and the  other  files
417          will  be  removed.  You  can  also  name the iso by using --iso-name
418          my-live.iso.
419

KICKSTARTS

421       The docs/ directory includes several example kickstarts, one to  create
422       a  live  desktop  iso using GNOME, and another to create a minimal disk
423       image. When creating your own kickstarts you should start with the min‐
424       imal  example,  it includes several needed packages that are not always
425       included by dependencies.
426
427       Or you can use existing spin kickstarts to create live media with a few
428       changes. Here are the steps I used to convert the Fedora XFCE spin.
429
430       1.  Flatten the xfce kickstart using ksflatten
431
432       2.  Add zerombr so you don't get the disk init dialog
433
434       3.  Add clearpart --all
435
436       4.  Add swap partition
437
438       5.  bootloader target
439
440       6.  Add shutdown to the kickstart
441
442       7.  Add  network  --bootproto=dhcp  --activate  to activate the network
443           This works for F16 builds but for F15 and before you need  to  pass
444           something on the cmdline that activate the network, like sshd:
445              livemedia-creator --kernel-args="sshd"
446
447       8.  Add a root password:
448
449              rootpw rootme
450              network --bootproto=dhcp --activate
451              zerombr
452              clearpart --all
453              bootloader --location=mbr
454              part swap --size=512
455              shutdown
456
457       9.  In  the  livesys  script section of the %post remove the root pass‐
458           word. This really depends on how the spin wants to work. You  could
459           add  the live user that you create to the %wheel group so that sudo
460           works if you wanted to.
461              passwd -d root > /dev/null
462
463       10. Remove /etc/fstab in %post, dracut handles mounting the rootfs
464
465           cat /dev/null > /dev/fstab
466
467           Do this only for live iso's, the filesystem will  be  mounted  read
468           only if there is no /etc/fstab
469
470       11. Don't delete initramfs files from /boot in %post
471
472       12. When creating live iso's you need to have, at least, these packages
473           in the %package section:: dracut-config-generic  dracut-live  -dra‐
474           cut-config-rescue grub2-efi memtest86+ syslinux
475
476   User created repositories
477       If  you  are  using  your  own  repositories and installing groups (eg.
478       @core) make sure you create the repodata with  groups  like  this  cre‐
479       aterepo -g /path/to/groups.xml /path/to/rpms
480
481   Using a Proxy with repos
482       One  drawback to using qemu is that it pulls the packages from the repo
483       each time you run it. To speed things up you either need a local mirror
484       of the packages, or you can use a caching proxy. When using a proxy you
485       pass it to livemedia-creator like this:
486          --proxy=http://proxy.yourdomain.com:3128
487
488       You also need to use a specific mirror instead of mirrormanager so that
489       the packages will get cached, so your kickstart url would look like:
490          url     --url="http://dl.fedoraproject.org/pub/fedora/linux/develop
491          ment/rawhide/x86_64/os/"
492
493       You can also add an update repo, but don't name it updates. Add --proxy
494       to  it as well. You can use all of the kickstart commands in your kick‐
495       start. Make sure there is only one url command, other repos have to use
496       the repo command and cannot be named updates which is reserved for Ana‐
497       conda's use. eg.:
498
499          url --url=PRIMARY-REPO-URL --proxy=PROXY-URL
500          repo --name="repo1" --baseurl=FIRST-REPO-URL --proxy=PROXY-URL
501          repo --name="repo2" --baseurl=SECOND-REPO_URL --proxy=PROXY-URL
502

ANACONDA IMAGE INSTALL (NO-VIRT)

504       You can create images without using qemu by passing  --no-virt  on  the
505       cmdline.  This  will use Anaconda's directory install feature to handle
506       the install.  There are a couple of things to keep in mind  when  doing
507       this:
508
509       1. It  will  be most reliable when building images for the same release
510          that the host is running. Because Anaconda  has  expectations  about
511          the system it is running under you may encounter strange bugs if you
512          try to build newer or older releases.
513
514       2. It may totally trash your host. So far I haven't  had  this  happen,
515          but the possibility exists that a bug in Anaconda could result in it
516          operating on real devices. I recommend running it in a virt or on  a
517          system that you can afford to lose all data from.
518
519       The  logs  from  anaconda will be placed in an ./anaconda/ directory in
520       either the current directory or in the directory used for --logfile
521
522       Example cmdline:
523
524       sudo livemedia-creator --make-iso --no-virt --ks=./fedora-livemedia.ks
525
526       NOTE:
527          Using no-virt to create a partitioned disk image (eg. --make-disk or
528          --make-vagrant)  will  only create disks usable on the host platform
529          (BIOS or UEFI). You can create BIOS partitioned disk images on  UEFI
530          by using virt.
531
532       NOTE:
533          As  of  version  30.7  SELinux  can be set to Enforcing. The current
534          state is logged for debugging purposes  and  if  there  are  SELinux
535          denials they should be reported as a bug.
536

AMI IMAGES

538       Amazon  EC2 images can be created by using the --make-ami switch and an
539       appropriate kickstart file. All of the work to customize the  image  is
540       handled  by the kickstart.  The example currently included was modified
541       from the cloud-kickstarts version so that it would  work  with  liveme‐
542       dia-creator.
543
544       Example cmdline:
545
546       sudo      livemedia-creator      --make-ami     --iso=/path/to/boot.iso
547       --ks=./docs/fedora-livemedia-ec2.ks
548
549       This will produce an ami-root.img file in the working directory.
550
551       At this time I have not tested the image with EC2.  Feedback  would  be
552       welcome.
553

APPLIANCE CREATION

555       livemedia-creator   can   now  replace  appliance-tools  by  using  the
556       --make-appliance switch. This will create the  partitioned  disk  image
557       and  an  XML  file  that can be used with virt-image to setup a virtual
558       system.
559
560       The   XML   is    generated    using    the    Mako    template    from
561       /usr/share/lorax/appliance/libvirt.xml You can use a different template
562       by passing --app-template <template path>
563
564       Documentation on the Mako template system can be found at the Mako site
565
566       The name of the final output XML is appliance.xml, this can be  changed
567       with --app-file <file path>
568
569       The following variables are passed to the template:
570
571          disks  A list of disk_info about each disk.  Each entry has the fol‐
572                 lowing attributes:
573                     name base name of the disk image file
574
575                     format "raw"
576
577                     checksum_type "sha256"
578
579                     checksum sha256 checksum of the disk image
580
581          name Name of appliance, from --app-name argument
582
583          arch Architecture
584
585          memory Memory in KB (from --ram)
586
587          vcpus from --vcpus
588
589          networks list of networks from the kickstart or []
590
591          project from --project
592
593          releasever from --releasever
594
595       The created image can be imported into libvirt using:
596          virt-image appliance.xml
597
598       You can also create qcow2 appliance  images  using  --image-type=qcow2,
599       for example:
600
601          sudo livemedia-creator --make-appliance --iso=/path/to/boot.iso --ks=./docs/fedora-minimal.ks \
602          --image-type=qcow2 --app-file=minimal-test.xml --image-name=minimal-test.img
603

FILESYSTEM IMAGE CREATION

605       livemedia-creator can be used to create un-partitined filesystem images
606       using the --make-fsimage option. As of version  21.8  this  works  with
607       both qemu and no-virt modes of operation. Previously it was only avail‐
608       able with no-virt.
609
610       Kickstarts should have a single / partition with no extra mountpoints.
611          livemedia-creator       --make-fsimage       --iso=/path/to/boot.iso
612          --ks=./docs/fedora-minimal.ks
613
614       You  can name the output image with --image-name and set a label on the
615       filesystem with --fs-label
616

TAR FILE CREATION

618       The --make-tar command can be used to create a tar of the root filesys‐
619       tem.  By  default  it  is  compressed using xz, but this can be changed
620       using the --compression and --compress-arg options. This  option  works
621       with both virt and no-virt install methods.
622
623       As  with  --make-fsimage  the kickstart should be limited to a single /
624       partition.
625
626       For example:
627
628          livemedia-creator --make-tar --iso=/path/to/boot.iso --ks=./docs/fedora-minimal.ks \
629          --image-name=fedora-root.tar.xz
630

LIVE IMAGE FOR PXE BOOT

632       The --make-pxe-live command will produce squashfs image containing live
633       root  filesystem  that can be used for pxe boot. Directory with results
634       will contain the live image, kernel image, initrd image and template of
635       pxe configuration for the images.
636

ATOMIC LIVE IMAGE FOR PXE BOOT

638       The   --make-ostree-live  command  will  produce  the  same  result  as
639       --make-pxe-live for installations of Atomic  Host.   Example  kickstart
640       for  such  an  installation  using Atomic installer iso with local repo
641       included in the image can be found in docs/rhel-atomic-pxe-live.ks.
642
643       The PXE images can also be created with --no-virt by using the  example
644       kickstart  in  docs/fedora-atomic-pxe-live-novirt.ks.  This  also works
645       inside the mock environment.
646

USING MOCK AND --NO-VIRT TO CREATE IMAGES

648       As of lorax version 22.2 you can  use  livemedia-creator  and  anaconda
649       version  22.15 inside of a mock chroot with --make-iso and --make-fsim‐
650       age.
651
652       NOTE:
653          As of mock version 2.0 you no longer need to pass --old-chroot.  You
654          will,  however,  need to pass --enable-network so that the mock con‐
655          tainer can download packages.
656
657          Older versions of mock, between 1.3.4 and 2.0,  will  need  to  pass
658          --old-chroot  with mock. These versions of mock now default to using
659          systemd-nspawn which cannot create the  needed  loop  device  nodes.
660          Passing  --old-chroot  will  use  the old system where /dev/loop* is
661          setup for you.
662
663       On the host system:
664
665       1. yum install -y mock
666
667       2. Add a user to the mock group to use for running mock. eg. builder
668
669       3. Create a new /etc/mock/ config file based on  the  rawhide  one,  or
670          modify the existing one so that the following options are setup:
671
672             config_opts['chroot_setup_cmd'] = 'install @buildsys-build anaconda-tui lorax'
673
674             # build results go into /home/builder/results/
675             config_opts['plugin_conf']['bind_mount_opts']['dirs'].append(('/home/builder/results','/results/'))
676
677          If  you  are  creating  images  for a branched release of Fedora you
678          should also enable the updates-testing repository so  that  you  get
679          the latest builds in your mock chroot.
680
681       The  following steps are run as the builder user who is a member of the
682       mock group.
683
684       4. Make a directory for results matching the  bind  mount  above  mkdir
685          ~/results/
686
687       5. Copy the example kickstarts cp /usr/share/docs/lorax/*ks .
688
689       6. Make  sure  tar  and dracut-network are in the %packages section and
690          that the url points to the correct repo
691
692       7. Init the mock mock -r fedora-rawhide-x86_64 --init
693
694       8. Copy the kickstart inside the  mock  mock  -r  fedora-rawhide-x86_64
695          --copyin ./fedora-minimal.ks /root/
696
697       9. Make a minimal iso:
698
699             mock -r fedora-rawhide-x86_64 --enable-network --chroot -- livemedia-creator --no-virt \
700             --resultdir=/results/try-1 --logfile=/results/logs/try-1/try-1.log \
701             --make-iso --ks /root/fedora-minimal.ks
702
703       Results  will be in ./results/try-1 and logs under /results/logs/try-1/
704       including anaconda logs and livemedia-creator logs. The new iso will be
705       located  at  ~/results/try-1/images/boot.iso,  and the ~/results/try-1/
706       directory tree will also contain the vmlinuz, initrd, etc.
707

USING MOCK AND QEMU TO CREATE IMAGES

709       Version 25.0 of livemedia-creator switches to using qemu  for  virtual‐
710       ization.   This  allows creation of all image types, and use of the KVM
711       on the host if /dev/kvm is present in the mock environment.
712
713       On the host system:
714
715       1. yum install -y mock
716
717       2. Add a user to the mock group to use for running mock. eg. builder
718
719       3. Create a new /etc/mock/ config file based on  the  rawhide  one,  or
720          modify the existing one so that the following options are setup:
721
722             config_opts['chroot_setup_cmd'] = 'install @buildsys-build lorax qemu'
723
724             # build results go into /home/builder/results/
725             config_opts['plugin_conf']['bind_mount_opts']['dirs'].append(('/home/builder/results','/results/'))
726
727          If  you  are  creating  images  for a branched release of Fedora you
728          should also enable the updates-testing repository so  that  you  get
729          the latest builds in your mock chroot.
730
731       The  following steps are run as the builder user who is a member of the
732       mock group.
733
734       4. Make a directory for results matching the  bind  mount  above  mkdir
735          ~/results/
736
737       5. Copy the example kickstarts cp /usr/share/docs/lorax/*ks .
738
739       6. Make  sure  tar  and dracut-network are in the %packages section and
740          that the url points to the correct repo
741
742       7. Init the mock mock -r fedora-rawhide-x86_64 --init
743
744       8. Copy the kickstart inside the  mock  mock  -r  fedora-rawhide-x86_64
745          --copyin ./fedora-minimal.ks /root/
746
747       9. Copy    the    Anaconda   boot.iso   inside   the   mock   mock   -r
748          fedora-rawhide-x86_64 --copyin ./boot.iso /root/
749
750       10.
751          Make a minimal iso:
752
753             mock -r fedora-rawhide-x86_64 --enable-network --chroot -- livemedia-creator \
754             --resultdir=/results/try-1 --logfile=/results/logs/try-1/try-1.log \
755             --make-iso --ks /root/fedora-minimal.ks --iso /root/boot.iso
756
757       Results will be in ./results/try-1 and logs under  /results/logs/try-1/
758       including anaconda logs and livemedia-creator logs. The new iso will be
759       located at ~/results/try-1/images/boot.iso,  and  the  ~/results/try-1/
760       directory tree will also contain the vmlinuz, initrd, etc.
761
762       This will run qemu without kvm support, which is going to be very slow.
763       You can add mknod /dev/kvm c 10 232; to create the device  node  before
764       running lmc.
765

OPENSTACK IMAGE CREATION

767       OpenStack  supports  partitioned disk images so --make-disk can be used
768       to create images for importing into glance, OpenStack's  image  storage
769       component.   You  need  to  have  access  to an OpenStack provider that
770       allows image uploads, or setup your own using the instructions from the
771       RDO Project.
772
773       The  example kickstart, fedora-openstack.ks, is only slightly different
774       than  the  fedora-minimal.ks  one.   It   adds   the   cloud-init   and
775       cloud-utils-growpart  packages. OpenStack supports setting up the image
776       using cloud-init, and cloud-utils-growpart will grow the image  to  fit
777       the instance's disk size.
778
779       Create a qcow2 image using the kickstart like this:
780          sudo     livemedia-creator    --make-disk    --iso=/path/to/boot.iso
781          --ks=/path/to/fedora-openstack.ks --image-type=qcow2
782
783       NOTE:
784          On the RHEL7 version of lmc --image-type isn't  supported.  You  can
785          only create a bare partitioned disk image.
786
787       Import  the  resulting disk image into the OpenStack system, either via
788       the web UI, or glance on the cmdline:
789
790          glance image-create --name "fedora-openstack" --is-public true --disk-format qcow2 \
791          --container-format bare --file ./fedora-openstack.qcow2
792
793       If qcow2 wasn't used then --disk-format should be set to raw.
794

DOCKER IMAGE CREATION

796       Use lmc to create a tarfile as described in the TAR File Creation  sec‐
797       tion,  but  substitute  the  fedora-docker.ks  example  kickstart which
798       removes the requirement for core files and the kernel.
799
800       You can then import the tarfile into docker like this (as root):
801          cat /var/tmp/fedora-root.tar.xz | docker import - fedora-root
802
803       And then run bash inside of it:
804          sudo docker run -i -t fedora-root /bin/bash
805

OPEN CONTAINER INITIATIVE IMAGE CREATION

807       The OCI is a new specification that is still being worked on.  You  can
808       read  more  about  it at the Open Container Initiative website. You can
809       create OCI images using the following command:
810
811          sudo livemedia-creator --make-oci --oci-config /path/to/config.json --oci-runtime /path/to/runtime.json \
812          --iso=/path/to/boot.iso --ks=/path/to/fedora-minimal.ks
813
814       You must provide the config.json and runtime.json files to be  included
815       in  the  bundle,  their  specifications  can be found on the OCI github
816       project output will be in the results directory with a default name  of
817       bundle.tar.xz
818
819       This  will  work  with --no-virt and inside a mock since it doesn't use
820       any partitioned disk images.
821

VAGRANT IMAGE CREATION

823       Vagrant images can be created using the following command:
824
825          sudo livemedia-creator --make-vagrant --vagrant-metadata /path/to/metadata.json \
826          --iso=/path/to/boot.iso --ks=/path/to/fedora-vagrant.ks
827
828       The image created is a vagrant-libvirt provider image and needs to have
829       vagrant setup with libvirt before you can use it.
830
831       The  --vagrant-metadata  file is optional, it will create a minimal one
832       by default, and if one is passed it will make sure the  disk  size   is
833       setup  correctly.  If  you  pass  a  --vagrant-vagrantfile  it  will be
834       included in the image verbatim. By default no vagrantfile is created.
835
836       There is an example Vagrant kickstart file in the docs  directory  that
837       sets up the vagrant user with the default insecure SSH pubkey and a few
838       useful utilities.
839
840       This also works with --no-virt, but will not work inside a mock due  to
841       its use of partitioned disk images and qcow2.
842

CREATING UEFI DISK IMAGES WITH VIRT

844       Partitioned  disk  images  can only be created for the same platform as
845       the host system (BIOS or UEFI). You can use virt to create BIOS  images
846       on  UEFI systems, and it is also possible to create UEFI images on BIOS
847       systems using OVMF firmware and qemu.
848
849       Install the lorax-lmc-virt package, this will install qemu and the OVMF
850       firmware files.
851
852       Now  you can run livemedia-creator with --virt-uefi to boot and install
853       using UEFI:
854
855          sudo livemedia-creator --make-disk --virt-uefi --iso=/path/to/boot.iso \
856          --ks=/path/to/fedora-minimal.ks
857
858       Make sure that the kickstart you are using creates a  /boot/efi  parti‐
859       tion by including this:
860
861          part /boot/efi --fstype="efi" --size=500
862
863       Or  use  reqpart in the kickstart and Anaconda will create the required
864       partitions.
865
866       NOTE:
867          The --virt-uefi method is currently only  supported  on  the  x86_64
868          architecture.
869

DEBUGGING PROBLEMS

871       Sometimes an installation will get stuck. When using qemu the logs will
872       be written to ./virt-install.log and most of the time any problems that
873       happen  will  be  near  the end of the file. lmc tries to detect common
874       errors and will cancel the  installation  when  they  happen.  But  not
875       everything  can be caught.  When creating a new kickstart it is helpful
876       to use vnc so that you can monitor the installation as it happens,  and
877       if  it  gets  stuck without lmc detecting the problem you can switch to
878       tty1 and examine the system directly.
879
880       If you suspect problems with %pre or %post sections  you  can  redirect
881       the output to the terminal and examine it by logging into the VM. eg.:
882
883          %pre
884          chvt
885          exec < /dev/tty3 > /dev/tty3 2>/dev/tty3
886          #do stuff
887          echo hello world
888          %end
889
890       If  it  does  get stuck the best way to cancel is to use kill -9 on the
891       qemu pid, lmc will detect that the process died and cleanup.
892
893       If lmc didn't handle the cleanup for some reason you can  do  this:  1.
894       sudo  umount  /tmp/lmc-XXXX to unmount the iso from its mountpoint.  2.
895       sudo rm -rf /tmp/lmc-XXXX 3. sudo rm /var/tmp/lmc-disk-XXXXX to  remove
896       the disk image.
897
898       Note  that  lmc uses the lmc- prefix for all of its temporary files and
899       directories to make it easier to find and clean up leftovers.
900
901       The logs from the qemu run are stored in  virt-install.log,  logs  from
902       livemedia-creator are in livemedia.log and program.log
903
904       You  can  add  --image-only  to  skip the .iso creation and examine the
905       resulting disk image. Or you can pass --keep-image to  keep  it  around
906       after the iso has been created.
907
908       Cleaning up aborted --no-virt installs can sometimes be accomplished by
909       running the anaconda-cleanup  script.  As  of  Fedora  18  anaconda  is
910       multi-threaded  and  it  can sometimes become stuck and refuse to exit.
911       When this happens you can usually clean up by first  killing  the  ana‐
912       conda process then running anaconda-cleanup.
913

HACKING

915       Development  on  this will take place as part of the lorax project, and
916       on the anaconda-devel-list mailing list, and on github
917
918       Feedback, enhancements and bugs are welcome.  You can use  bugzilla  to
919       report bugs against the lorax component.
920

AUTHOR

922       Weldr Team
923
925       2018, Red Hat, Inc.
926
927
928
929
93032.6                             Feb 12, 2020             LIVEMEDIA-CREATOR(1)
Impressum