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

QUICKSTART

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

HOW ISO CREATION WORKS

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

KICKSTARTS

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

ANACONDA IMAGE INSTALL (NO-VIRT)

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

AMI IMAGES

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

APPLIANCE CREATION

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

FILESYSTEM IMAGE CREATION

614       livemedia-creator can be used to create un-partitined filesystem images
615       using the --make-fsimage option. As of version  21.8  this  works  with
616       both qemu and no-virt modes of operation. Previously it was only avail‐
617       able with no-virt.
618
619       Kickstarts should have a single / partition with no extra mountpoints.
620          livemedia-creator       --make-fsimage       --iso=/path/to/boot.iso
621          --ks=./docs/fedora-minimal.ks
622
623       You  can name the output image with --image-name and set a label on the
624       filesystem with --fs-label
625

TAR FILE CREATION

627       The --make-tar command can be used to create a tar of the root filesys‐
628       tem.  By default it is compressed using xz, but this can be changed us‐
629       ing the --compression and --compress-arg  options.  This  option  works
630       with both virt and no-virt install methods.
631
632       As  with  --make-fsimage  the kickstart should be limited to a single /
633       partition.
634
635       For example:
636
637          livemedia-creator --make-tar --iso=/path/to/boot.iso --ks=./docs/fedora-minimal.ks \
638          --image-name=fedora-root.tar.xz
639

LIVE IMAGE FOR PXE BOOT

641       The --make-pxe-live command will produce squashfs image containing live
642       root  filesystem  that can be used for pxe boot. Directory with results
643       will contain the live image, kernel image, initrd image and template of
644       pxe configuration for the images.
645

ATOMIC LIVE IMAGE FOR PXE BOOT

647       The   --make-ostree-live  command  will  produce  the  same  result  as
648       --make-pxe-live for installations of Atomic  Host.   Example  kickstart
649       for such an installation using Atomic installer iso with local repo in‐
650       cluded in the image can be found in docs/rhel-atomic-pxe-live.ks.
651
652       The PXE images can also be created with --no-virt by using the  example
653       kickstart in docs/fedora-atomic-pxe-live-novirt.ks. This also works in‐
654       side the mock environment.
655

USING MOCK AND --NO-VIRT TO CREATE IMAGES

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

USING MOCK AND QEMU TO CREATE IMAGES

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

OPENSTACK IMAGE CREATION

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

DOCKER IMAGE CREATION

805       Use lmc to create a tarfile as described in the TAR File Creation  sec‐
806       tion,  but  substitute the fedora-docker.ks example kickstart which re‐
807       moves the requirement for core files and the kernel.
808
809       You can then import the tarfile into docker like this (as root):
810          cat /var/tmp/fedora-root.tar.xz | docker import - fedora-root
811
812       And then run bash inside of it:
813          sudo docker run -i -t fedora-root /bin/bash
814

OPEN CONTAINER INITIATIVE IMAGE CREATION

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

VAGRANT IMAGE CREATION

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

CREATING UEFI DISK IMAGES WITH VIRT

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

DEBUGGING PROBLEMS

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

HACKING

924       Development  on  this will take place as part of the lorax project, and
925       on the anaconda-devel-list mailing list, and on github
926
927       Feedback, enhancements and bugs are welcome.  You can use  bugzilla  to
928       report bugs against the lorax component.
929

AUTHOR

931       Weldr Team
932
934       2018, Red Hat, Inc.
935
936
937
938
93935.7                             Oct 11, 2021             LIVEMEDIA-CREATOR(1)
Impressum