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   Named Arguments
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 proxy URL to use for the install
152
153       -anaconda-arg
154              Additional argument to pass to  anaconda  (no-virt  mode).  Pass
155              once for each argument
156
157       -armplatform
158              the  platform  to  use when creating images for ARM, i.e., high‐
159              bank, mvebu, omap, tegra, etc.
160
161       -location
162              location of iso directory tree with initrd.img and vmlinuz. Used
163              to run qemu with a newer initrd than the iso.
164
165       -logfile
166              Name and path for primary logfile, other logs will be created in
167              the same directory.
168
169              Default: ./livemedia.log
170
171       -lorax-templates
172              Path to mako templates for lorax
173
174       -tmp   Top level temporary directory
175
176              Default: /var/tmp
177
178       -resultdir
179              Directory to copy the resulting images and iso into. Defaults to
180              the temporary working directory
181
182       -macboot
183              Make the iso bootable on UEFI based Mac systems
184
185              Default: True
186
187       -nomacboot
188              Do not create a Mac bootable iso
189
190              Default: False
191
192       -extra-boot-args
193              Extra  arguments  to add to the bootloader kernel cmdline in the
194              templates
195
196              Default: ""
197
198       -project
199              substituted for @PROJECT@ in bootloader config files
200
201              Default: "Linux"
202
203       -releasever
204              substituted for @VERSION@ in bootloader config files
205
206              Default: "34"
207
208       -volid volume id
209
210       -squashfs-only
211              Use a plain squashfs filesystem for the runtime.
212
213              Default: False
214
215       -timeout
216              Cancel installer after X minutes
217
218       V      show program's version number and exit
219
220   disk/fs image arguments
221       -disk-image
222              Path to existing disk image to use for creating final image.
223
224       -keep-image
225              Keep raw disk image after .iso creation
226
227              Default: False
228
229       -fs-image
230              Path to existing filesystem image to use for creating final  im‐
231              age.
232
233       -image-name
234              Name  of output file to create. Used for tar, fs and disk image.
235              Default is a random name.
236
237       -tar-disk-name
238              Name of the archive member for make-tar-disk.
239
240       -fs-label
241              Label to set on fsimage, default is 'Anaconda'
242
243              Default: "Anaconda"
244
245       -image-size-align
246              Create a disk image with a size that is a multiple of this value
247              in MiB.
248
249              Default: 0
250
251       -image-type
252              Create an image with qemu-img. See qemu-img --help for supported
253              formats.
254
255       -qemu-arg
256              Arguments to pass to qemu-img. Pass once for each argument, they
257              will be used for ALL calls to qemu-img.
258
259              Default: []
260
261       -qcow2 Create  qcow2 image instead of raw sparse image when making disk
262              images.
263
264              Default: False
265
266       -qcow2-arg
267              Arguments to pass to qemu-img. Pass once for each argument, they
268              will be used for ALL calls to qemu-img.
269
270              Default: []
271
272       -compression
273              Compression  binary  for make-tar. xz, lzma, gzip, and bzip2 are
274              supported. xz is the default.
275
276              Default: "xz"
277
278       -compress-arg
279              Arguments to pass to compression. Pass once for each argument
280
281              Default: []
282
283   appliance arguments
284       -app-name
285              Name of appliance to pass to template
286
287       -app-template
288              Path to template to use for appliance data.
289
290       -app-file
291              Appliance template results file.
292
293              Default: "appliance.xml"
294
295   qemu arguments
296       -ram   Memory to allocate for installer in megabytes.
297
298              Default: 2048
299
300       -vcpus Passed to qemu -smp command
301
302       -vnc   Passed to qemu -display command. eg. vnc=127.0.0.1:5, default is
303              to choose the first unused vnc port.
304
305       -arch  System  arch to build for. Used to select qemu-system-* command.
306              Defaults to qemu-system-<arch>
307
308       -kernel-args
309              Additional argument to pass to the installation kernel
310
311       -ovmf-path
312              Path to OVMF firmware
313
314              Default: "/usr/share/edk2/ovmf/"
315
316       -virt-uefi
317              Use OVMF firmware to boot the VM in UEFI mode
318
319              Default: False
320
321       -no-kvm
322              Skip using kvm with qemu even if it is available.
323
324              Default: False
325
326       -with-rng
327              RNG device for QEMU (none for no RNG)
328
329              Default: "/dev/random"
330
331   dracut arguments: (default: )
332       -dracut-conf
333              Path to a dracut.conf file to use instead of the  default  argu‐
334              ments. See the dracut.conf(5) manpage.
335
336       -dracut-arg
337              Argument  to  pass to dracut when rebuilding the initramfs. Pass
338              this once for each argument. NOTE: this overrides the defaults.
339
340   pxe to live arguments
341       -live-rootfs-size
342              Size of root filesystem of live image in GiB
343
344              Default: 0
345
346       -live-rootfs-keep-size
347              Keep the original size of root filesystem in live image
348
349              Default: False
350
351   OCI arguments
352       -oci-config
353              config.json OCI configuration file
354
355       -oci-runtime
356              runtime.json OCI configuration file
357
358   Vagrant arguments
359       -vagrant-metadata
360              optional metadata.json file
361
362       -vagrantfile
363              optional vagrantfile
364

QUICKSTART

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

HOW ISO CREATION WORKS

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

KICKSTARTS

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

ANACONDA IMAGE INSTALL (NO-VIRT)

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

AMI IMAGES

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

APPLIANCE CREATION

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

FILESYSTEM IMAGE CREATION

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

TAR FILE CREATION

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

LIVE IMAGE FOR PXE BOOT

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

ATOMIC LIVE IMAGE FOR PXE BOOT

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

USING MOCK AND --NO-VIRT TO CREATE IMAGES

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

USING MOCK AND QEMU TO CREATE IMAGES

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

OPENSTACK IMAGE CREATION

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

DOCKER IMAGE CREATION

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

OPEN CONTAINER INITIATIVE IMAGE CREATION

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

VAGRANT IMAGE CREATION

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

CREATING UEFI DISK IMAGES WITH VIRT

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

DEBUGGING PROBLEMS

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

HACKING

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

AUTHOR

927       Weldr Team
928
930       2018, Red Hat, Inc.
931
932
933
934
93534.10                            Apr 27, 2021             LIVEMEDIA-CREATOR(1)
Impressum