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

QUICKSTART

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

HOW ISO CREATION WORKS

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

KICKSTARTS

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

ANACONDA IMAGE INSTALL (NO-VIRT)

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

AMI IMAGES

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

APPLIANCE CREATION

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

FILESYSTEM IMAGE CREATION

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

TAR FILE CREATION

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

LIVE IMAGE FOR PXE BOOT

646       The --make-pxe-live command will produce squashfs image containing live
647       root  filesystem  that can be used for pxe boot. Directory with results
648       will contain the live image, kernel image, initrd image and template of
649       pxe configuration for the images.
650

ATOMIC LIVE IMAGE FOR PXE BOOT

652       The   --make-ostree-live  command  will  produce  the  same  result  as
653       --make-pxe-live for installations of Atomic  Host.   Example  kickstart
654       for  such  an  installation  using Atomic installer iso with local repo
655       included in the image can be found in docs/rhel-atomic-pxe-live.ks.
656
657       The PXE images can also be created with --no-virt by using the  example
658       kickstart  in  docs/fedora-atomic-pxe-live-novirt.ks.  This  also works
659       inside the mock environment.
660

USING MOCK AND --NO-VIRT TO CREATE IMAGES

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

USING MOCK AND QEMU TO CREATE IMAGES

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

OPENSTACK IMAGE CREATION

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

DOCKER IMAGE CREATION

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

OPEN CONTAINER INITIATIVE IMAGE CREATION

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

VAGRANT IMAGE CREATION

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

CREATING UEFI DISK IMAGES WITH VIRT

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

DEBUGGING PROBLEMS

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

HACKING

929       Development  on  this will take place as part of the lorax project, and
930       on the anaconda-devel-list mailing list, and on github
931
932       Feedback, enhancements and bugs are welcome.  You can use  bugzilla  to
933       report bugs against the lorax component.
934

AUTHOR

936       Weldr Team
937
939       2018, Red Hat, Inc.
940
941
942
943
94433.2                             Apr 28, 2020             LIVEMEDIA-CREATOR(1)
Impressum