LIVEMEDIA-CREATOR(1)
β¨ NAME β¨
livemedia-creator β Live Media Creator Documentation π
π Authors π
Brian C. Lane <bcl@redhat.com>
okay bestie, sit down, hydrate, because this tool is iconic and I need you to understand it. livemedia-creator uses Anaconda, kickstart and Lorax to create bootable media that use the same install path as a normal system installation. No cap. It can be used to make live isos, bootable (partitioned) disk images, tarfiles, and filesystem images for use with virtualization and container solutions like libvirt, docker, and OpenStack. it's giving versatility π
The general idea is to use qemu with kickstart and an Anaconda boot.iso to install into a disk image and then use the disk image to create the bootable media. like, that's the whole plot π¦
livemedia-creator --help will describe all of the options available. At the minimum you need:
--make-isoto create a final bootable.isoor one of the other--make-*options. β--isoto specify the Anaconda install media to use with qemu.--ksto select the kickstart file describing what to install.
π«Ά heads up bestie: to use livemedia-creator with virtualization you will need to have qemu installed.
π and if you are going to be using Anaconda directly, with --no-virt mode, make sure you have the anaconda-tui package installed. do not skip this, I am literally begging.
π Conventions used in this document: π
lmcis an abbreviation forlivemedia-creator.builderis the system wherelivemedia-creatoris being runimageis the disk image being created by runninglivemedia-creator
that's the intro, bestie β the rest is coming, stay with me π§
π¦ SYNOPSIS π¦
okay bestie, here's the whole entire shape of the thing before we get into the vibes. it's a lot of brackets. it's giving "choose your own adventure" but make it bootable:
usage: livemedia-creator [-h]
(--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)
[--iso ISO] [--iso-only] [--iso-name ISO_NAME] [--ks KS] [--image-only]
[--no-virt] [--proxy PROXY] [--anaconda-arg ANACONDA_ARGS]
[--armplatform ARMPLATFORM] [--location LOCATION] [--logfile LOGFILE]
[--lorax-templates LORAX_TEMPLATES] [--tmp TMP] [--resultdir RESULT_DIR]
[--macboot] [--nomacboot] [--extra-boot-args EXTRA_BOOT_ARGS] [-r RELEASE]
[-t VARIANT] [-b URL] [--isfinal] [--disk-image DISK_IMAGE] [--keep-image]
[--fs-image FS_IMAGE] [--image-name IMAGE_NAME]
[--tar-disk-name TAR_DISK_NAME] [--fs-label FS_LABEL]
[--image-size-align IMAGE_SIZE_ALIGN] [--image-type IMAGE_TYPE]
[--qemu-arg QEMU_ARGS] [--qcow2] [--qcow2-arg QEMU_ARGS]
[--compression COMPRESSION] [--compress-arg COMPRESS_ARGS]
[--app-name APP_NAME] [--app-template APP_TEMPLATE] [--app-file APP_FILE]
[--ram MEMORY] [--cpu CPU] [--vcpus VCPUS] [--vnc VNC] [--arch ARCH]
[--kernel-args KERNEL_ARGS] [--firmware FW_PATH] [--virt-uefi] [--no-kvm]
[--with-rng WITH_RNG] [--dracut-conf DRACUT_CONF] [--dracut-arg DRACUT_ARGS]
[--live-rootfs-size LIVE_ROOTFS_SIZE] [--live-rootfs-keep-size]
[--oci-config OCI_CONFIG] [--oci-runtime OCI_RUNTIME]
[--vagrant-metadata VAGRANT_METADATA] [--vagrantfile VAGRANTFILE]
[--project PRODUCT] [-p PRODUCT] [--releasever RELEASEVER] [--volid VOLID]
[--squashfs-only] [--rootfs-type ROOTFSTYPE] [--timeout TIMEOUT] [-V]
see that big parenthesised pile up top? you have to pick exactly one of those mode flags. that's your main character decision. everything else is optional garnish β¨
β¨ OPTIONS β¨
π Named Arguments π
the modes first, because they're the moment:
--make-isoβ Build a live iso. Default:False--make-diskβ Build a partitioned disk image. Default:False--make-fsimageβ Build a filesystem image. Default:False--make-applianceβ Build an appliance image and XML description. Default:False--make-amiβ Build an ami image. Default:False--make-tarβ Build a tar of the root filesystem. Default:False--make-tar-diskβ Build a tar of a partitioned disk image. Default:False--make-pxe-liveβ Build a live pxe boot squashfs image. Default:False--make-ostree-liveβ Build a live pxe boot squashfs image of Atomic Host. Default:False--make-ociβ Build an Open Container Initiative image. Default:False--make-vagrantβ Build a Vagrant Box image. Default:False
then the rest of the gang:
--isoβ Anaconda installation.isopath to use for qemu. π«Ά--iso-onlyβ Remove all iso creation artifacts except theboot.iso, combine with--iso-nameto rename theboot.iso. Default:False--iso-nameβ Name of output iso file for--iso-only. Default isboot.iso--ksβ Kickstart file defining the install. (yes. this is THE one you actually care about π )--image-onlyβ Exit after creating fs/disk image. Default:False--no-virtβ Run anaconda directly on host instead of using qemu. Default:False--proxyβ proxy URL to use for the install--anaconda-argβ Additional argument to pass to anaconda (no-virt mode). Pass once for each argument--armplatformβ the platform to use when creating images for ARM, i.e.,highbank,mvebu,omap,tegra, etc.--locationβ location of iso directory tree withinitrd.imgandvmlinuz. Used to run qemu with a newer initrd than the iso.--logfileβ Name and path for primary logfile, other logs will be created in the same directory. Default:./livemedia.log--lorax-templatesβ Path to mako templates for lorax--tmpβ Top level temporary directory. Default:/var/tmp--resultdirβ Directory to copy the resulting images and iso into. Defaults to the temporary working directory--macbootβ Make the iso bootable on UEFI based Mac systems. Default:True--nomacbootβ Do not create a Mac bootable iso. Default:False--extra-boot-argsβ Extra arguments to add to the bootloader kernel cmdline in the templates. Default:""-r,--releaseβ release information. Default:""-t,--variantβ variant name. Default:""-b,--bugurlβ bug reporting URL for the product. Default:"your distribution provided bug reporting tool"--isfinalβ Default:False--projectβ substituted for@PRODUCT@in bootloader config files. Default:"Linux"-p,--productβ Alias for--project. Default:""--releaseverβ substituted for@VERSION@in bootloader config files. Default:"41"--volidβ volume id--squashfs-onlyβ Ignored, provided for backward compatibility. Default:False--rootfs-typeβ Type of rootfs:squashfs,squashfs-ext4,erofs,erofs-ext4. Default:"squashfs"--timeoutβ Cancel installer after X minutes-Vβ show program's version number and exit
fr fr, that's a LOT of flags and you will not need all of them at once. breathe. πΈ
π½ disk/fs image arguments
--disk-imageβ Path to existing disk image to use for creating final image.--keep-imageβ Keep raw disk image after.isocreation. Default:False--fs-imageβ Path to existing filesystem image to use for creating final image.--image-nameβ Name of output file to create. Used for tar, fs and disk image. Default is a random name.--tar-disk-nameβ Name of the archive member formake-tar-disk.--fs-labelβ Label to set on fsimage, default is 'Anaconda'. Default:"Anaconda"--image-size-alignβ Create a disk image with a size that is a multiple of this value in MiB. Default:0--image-typeβ Create an image withqemu-img. Seeqemu-img --helpfor supported formats.--qemu-argβ Arguments to pass toqemu-img. Pass once for each argument, they will be used for ALL calls toqemu-img. Default:[]--qcow2β Create qcow2 image instead of raw sparse image when making disk images. Default:False--qcow2-argβ Arguments to pass toqemu-img. Pass once for each argument, they will be used for ALL calls toqemu-img. Default:[]--compressionβ Compression binary formake-tar.xz,lzma,gzip, andbzip2are supported.xzis the default. Default:"xz"--compress-argβ Arguments to pass to compression. Pass once for each argument. Default:[]
π appliance arguments π
--app-nameβ Name of appliance to pass to template--app-templateβ Path to template to use for appliance data.--app-fileβ Appliance template results file. Default:"appliance.xml"
π₯οΈ qemu arguments π₯οΈ
--ramβ Memory to allocate for installer in megabytes. Default:2048--cpuβ Passed to qemu-cpucommand. Default is to use-cpu host.--vcpusβ Passed to qemu-smpcommand. Number of virtual cpus.--vncβ Passed to qemu-displaycommand. eg.vnc=127.0.0.1:5, default is to choose the first unused vnc port.--archβ System arch to build for. Used to selectqemu-system-*command. Defaults toqemu-system-<arch>--kernel-argsβ Additional argument to pass to the installation kernel--firmware,--ovmf-pathβ Path to top of the EDK2 UEFI firmware directory tree. Default:"/usr/share/edk2/"--virt-uefiβ Use UEFI firmware to boot the VM in UEFI mode. Default:False--no-kvmβ Skip using kvm with qemu even if it is available. Default:False--with-rngβ RNG device for QEMU (none for no RNG). Default:"/dev/random"
π§ dracut arguments: (default: ) π§
--dracut-confβ Path to adracut.conffile to use instead of the default arguments. See thedracut.conf(5)manpage.--dracut-argβ Argument to pass to dracut when rebuilding the initramfs. Pass this once for each argument. NOTE: this overrides the defaults.
heads up bestie: --dracut-arg overrides the defaults. not "adds to", not "nudges" β overrides. π
π pxe to live arguments π
--live-rootfs-sizeβ Size of root filesystem of live image in GiB. Default:0--live-rootfs-keep-sizeβ Keep the original size of root filesystem in live image. Default:False
π¦ OCI arguments π¦
--oci-configβconfig.jsonOCI configuration file--oci-runtimeβruntime.jsonOCI configuration file
π Vagrant arguments π
--vagrant-metadataβ optionalmetadata.jsonfile--vagrantfileβ optional vagrantfile
π QUICKSTART π
okay so you wanna make a bootable live iso? run this, it's literally the whole vibe:
sudo livemedia-creator --make-iso \
--iso=/extra/iso/boot.iso --ks=./docs/fedora-livemedia.ks
and you can run it straight out of the lorax git repo like this, no install needed:
sudo PATH=./src/sbin/:$PATH PYTHONPATH=./src/ ./src/sbin/livemedia-creator \
--make-iso --iso=/extra/iso/boot.iso \
--ks=./docs/fedora-livemedia.ks --lorax-templates=./share/
you can watch the installation happen over vnc π the logs will show what port was chosen, or you can use a specific port by passing it. eg. --vnc vnc:127.0.0.1:5
this is usually a good idea when testing changes to the kickstart. lmc tries to monitor the logs for fatal errors, but may not catch everything.
translation: watch it with your own eyeballs, don't just trust the logs to tell you something went sideways π
β¨ HOW ISO CREATION WORKS β¨
okay bestie, deep breath, this is the lore π there are literally 2 stages and once u get them u get everything:
- the install stage β this is the one that spits out a disk or filesystem image as its output
- the boot media creation β this one takes that image and uses it as its input
normally you'd run both stages, no thoughts, just vibes. but you can also stop after the install stage if u want, by using --image-only. OR you can skip the install stage entirely and just use a disk image you made earlier by passing --disk-image or --fs-image. mix and match, ur the main character π«Ά
When creating an iso, qemu boots using the Anaconda installer iso you passed it, and installs the system based on the kickstart. The %post section of the kickstart is what customizes the installed system, in the exact same way that current spin-kickstarts do. slay.
livemedia-creator monitors the install process for problems by watching the install logs. they get written to the current directory, or to the base directory you specified with the --logfile command. you can also monitor the install with a vnc client β and honestly? recommended when you're first modifying a kickstart, because there are still places where Anaconda may get stuck without the log monitor catching it π like it'll just be sitting there. vibing. not installing. so use vnc bestie.
The output from this process is a partitioned disk image. kpartx can be used to mount and examine it when there's a problem with the install. It can also be booted using kvm π
When creating an iso, the disk image's / partition is copied into a formatted filesystem image, which is then used as the input to lorax for creation of the final media.
The final image is created by lorax, using the templates in /usr/share/lorax/live/ or the live directory below the directory specified by --lorax-templates. The templates are written using the Mako template system with some extra commands added by lorax β¨
NOTE: The output from--make-isoincludes the artifacts used to create theboot.isoβ the kernel, initrd, the squashfs filesystem, etc. If you only want theboot.isoyou can pass--iso-onlyand the other files will be removed. You can also name the iso by using--iso-name my-live.iso. π
πΈ KICKSTARTS πΈ
The docs/ directory includes several example kickstarts β one to create a live desktop iso using GNOME, and another to create a minimal disk image. When you're making your own kickstarts you should start with the minimal example, it includes several needed packages that are not always included by dependencies. (rude of the dependencies tbh.)
Or you can use existing spin kickstarts to create live media with a few changes. Here are the steps I used to convert the Fedora XFCE spin, fr fr:
- Flatten the xfce kickstart using
ksflatten - Add
zerombrso you don't get the disk init dialog - Add
clearpart --all - Add swap partition
bootloadertarget- Add
shutdownto the kickstart - Add
network --bootproto=dhcp --activateto activate the network. This works for F16 builds but for F15 and before you need to pass something on the cmdline that activates the network, like sshd:
livemedia-creator --kernel-args="sshd"
- Add a root password:
rootpw rootme
network --bootproto=dhcp --activate
zerombr
clearpart --all
bootloader --location=mbr
part swap --size=512
shutdown
- In the
livesysscript section of the%post, remove the root password. This really depends on how the spin wants to work. You could add the live user that you create to the%wheelgroup so thatsudoworks, if you wanted to:
passwd -d root > /dev/null
- Remove
/etc/fstabin%post, dracut handles mounting the rootfs:
cat /dev/null > /dev/fstab
Do this only for live iso's β the filesystem will be mounted read only if there is no /etc/fstab
- Don't delete initramfs files from
/bootin%post - When creating live iso's you need to have, at least, these packages in the
%packagesection:
dracut-config-generic
dracut-live
-dracut-config-rescue
grub2-efi
syslinux
NOTE: The kickstart must containpart / --size=1024in order to set the size of the root filesystem's disk image. Other partitions may be included, depending on the image type being created.autopartcannot be supported due to lmc needing to create the disk image file before running the installer on it. π« so yeah, noautopartbestie, we're doing this by hand.
π User created repositories
If you're using your own repositories and installing groups (eg. @core) make sure you create the repodata with groups like this: createrepo -g /path/to/groups.xml /path/to/rpms
π Using a Proxy with repos
One drawback to using qemu is that it pulls the packages from the repo each and every time you run it π to speed things up you either need a local mirror of the packages, or you can use a caching proxy. When using a proxy you pass it to livemedia-creator like this:
--proxy=http://proxy.yourdomain.com:3128
You also need to use a specific mirror instead of mirrormanager so that the packages will get cached, so your kickstart url would look like:
url --url="http://dl.fedoraproject.org/pub/fedora/linux/development/rawhide/x86_64/os/"
You can also add an update repo, but don't name it updates. Add --proxy to it as well. You can use all of the kickstart commands in your kickstart. Make sure there is only one url command β other repos have to use the repo command and cannot be named updates, which is reserved for Anaconda's use. eg.:
url --url=PRIMARY-REPO-URL --proxy=PROXY-URL
repo --name="repo1" --baseurl=FIRST-REPO-URL --proxy=PROXY-URL
repo --name="repo2" --baseurl=SECOND-REPO_URL --proxy=PROXY-URL
π¦ ANACONDA IMAGE INSTALL (NO-VIRT) π¦
You can create images without using qemu by passing --no-virt on the cmdline. This will use Anaconda's directory install feature to handle the install. There are a couple of things to keep in mind when doing this, and bestie, listen up:
- It will be most reliable when building images for the same release that the host is running. Because Anaconda has expectations about the system it's running under, you may encounter strange bugs if you try to build newer or older releases. π
- It may totally trash your host. So far I haven't had this happen, but the possibility exists that a bug in Anaconda could result in it operating on real devices. I recommend running it in a virt or on a system that you can afford to lose all data from. π not me saying back up ur stuff, but like. back up ur stuff.
The logs from anaconda will be placed in an ./anaconda/ directory, in either the current directory or in the directory used for --logfile
Example cmdline:
sudo livemedia-creator --make-iso --no-virt --ks=./fedora-livemedia.ks
NOTE: Using no-virt to create a partitioned disk image (eg.--make-diskor--make-vagrant) will only create disks usable on the host platform (BIOS or UEFI). You can create BIOS partitioned disk images on UEFI by using virt. π§
NOTE: As of version 30.7 SELinux can be set to Enforcing. The current state is logged for debugging purposes and if there are SELinux denials they should be reported as a bug. π
π AMI IMAGES π
Amazon EC2 images can be created by using the --make-ami switch and an appropriate kickstart file. All of the work to customize the image is handled by the kickstart. The example currently included was modified from the cloud-kickstarts version so that it would work with livemedia-creator.
Example cmdline:
sudo livemedia-creator --make-ami --iso=/path/to/boot.iso --ks=./docs/fedora-livemedia-ec2.ks
This will produce an ami-root.img file in the working directory. β¨
At this time I have not tested the image with EC2. Feedback would be welcome π (pls someone test it, i'm curious)
π APPLIANCE CREATION π
livemedia-creator can now replace appliance-tools by using the --make-appliance switch. This will create the partitioned disk image and an XML file that can be used with virt-image to setup a virtual system. iconic tbh.
The XML is generated using the Mako template from /usr/share/lorax/appliance/libvirt.xml. You can use a different template by passing --app-template <template path>
Documentation on the Mako template system can be found at the Mako site.
The name of the final output XML is appliance.xml, this can be changed with --app-file <file path>
The following variables are passed to the template:
disksβ A list ofdisk_infoabout each disk. Each entry has the following attributes:nameβ base name of the disk image fileformatβ"raw"checksum_typeβ"sha256"checksumβ sha256 checksum of the disk image
nameβ Name of appliance, from--app-nameargumentarchβ Architecturememoryβ Memory in KB (from--ram)vcpusβ from--vcpusnetworksβ list of networks from the kickstart or[]projectβ from--projectreleaseverβ from--releasever
The created image can be imported into libvirt using:
virt-image appliance.xml
You can also create qcow2 appliance images using --image-type=qcow2, for example:
sudo livemedia-creator --make-appliance --iso=/path/to/boot.iso --ks=./docs/fedora-minimal.ks \
--image-type=qcow2 --app-file=minimal-test.xml --image-name=minimal-test.img
π FILESYSTEM IMAGE CREATION π
livemedia-creator can be used to create un-partitined filesystem images using the --make-fsimage option. As of version 21.8 this works with both qemu and no-virt modes of operation. Previously it was only available with no-virt. glow up β¨
Kickstarts should have a single / partition with no extra mountpoints:
livemedia-creator --make-fsimage --iso=/path/to/boot.iso --ks=./docs/fedora-minimal.ks
You can name the output image with --image-name and set a label on the filesystem with --fs-label
π TAR FILE CREATION π
The --make-tar command can be used to create a tar of the root filesystem. By default it is compressed using xz, but this can be changed using the --compression and --compress-arg options. This option works with both virt and no-virt install methods. π«Ά
As with --make-fsimage the kickstart should be limited to a single / partition.
For example:
livemedia-creator --make-tar --iso=/path/to/boot.iso --ks=./docs/fedora-minimal.ks \
--image-name=fedora-root.tar.xz
β LIVE IMAGE FOR PXE BOOT β
The --make-pxe-live command will produce a squashfs image containing a live root filesystem that can be used for pxe boot. Directory with results will contain the live image, kernel image, initrd image and template of pxe configuration for the images. it's giving complete package π
π ATOMIC LIVE IMAGE FOR PXE BOOT π
The --make-ostree-live command will produce the same result as --make-pxe-live for installations of Atomic Host. Example kickstart for such an installation using Atomic installer iso with local repo included in the image can be found in docs/rhel-atomic-pxe-live.ks.
The PXE images can also be created with --no-virt by using the example kickstart in docs/fedora-atomic-pxe-live-novirt.ks. This also works inside the mock environment. π₯
π§± USING MOCK AND --NO-VIRT TO CREATE IMAGES π§±
okay so bestie, listen β since lorax version 22.2 you can run livemedia-creator plus anaconda version 22.15 inside a mock chroot, using --make-iso and --make-fsimage. no cap, it's a whole vibe. π
NOTE: β¨ as of mock version 2.0 you do not need to pass--old-chrootanymore. but you will need to pass--enable-networkso the mock container can download packages, bestie. don't forget it or it's giving sad empty chroot energy. π
Older versions of mock, between 1.3.4 and 2.0, do need--old-chrootwith mock. those versions now default to usingsystemd-nspawnwhich literally cannot create the needed loop device nodes. passing--old-chrootuses the old system where/dev/loop*is set up for you. πΈ
SELinux and mock do not work well together, and I mean at all. inside mock, SELinux is reported as disabled, so the images you produce will not have the correct SELinux labels. if that matters to you (and honestly? it might), run livemedia-creator on the host, or in a VM. periodt. π
On the host system, do these in order:
yum install -y mock- Add a user to the mock group to use for running mock. eg.
builder - Create a new
/etc/mock/config file based on the rawhide one, or modify the existing one so that the following options are setup:
config_opts['chroot_setup_cmd'] = 'install @buildsys-build anaconda-tui lorax'
# build results go into /home/builder/results/
config_opts['plugin_conf']['bind_mount_opts']['dirs'].append(('/home/builder/results','/results/'))
If you are creating images for a branched release of Fedora you should also enable the updates-testing repository so that you get the latest builds in your mock chroot. π¦
The following steps are run as the builder user who is a member of the mock group.
- Make a directory for results matching the bind mount above
mkdir ~/results/ - Copy the example kickstarts
cp /usr/share/docs/lorax/*ks . - Make sure
taranddracut-networkare in the%packagessection and that the url points to the correct repo - Init the mock
mock -r fedora-rawhide-x86_64 --init - Copy the kickstart inside the mock
mock -r fedora-rawhide-x86_64 --copyin ./fedora-minimal.ks /root/ - Make a minimal iso:
mock -r fedora-rawhide-x86_64 --enable-network --chroot -- livemedia-creator --no-virt \
--resultdir=/results/try-1 --logfile=/results/logs/try-1/try-1.log \
--make-iso --ks /root/fedora-minimal.ks
Results will be in ./results/try-1 and logs under /results/logs/try-1/ including anaconda logs and livemedia-creator logs. The new iso will be located at ~/results/try-1/images/boot.iso, and the ~/results/try-1/ directory tree will also contain the vmlinuz, initrd, etc. π
π₯οΈ USING MOCK AND QEMU TO CREATE IMAGES π₯οΈ
Version 25.0 of livemedia-creator switches to using qemu for virtualization. This allows creation of all image types, and use of the KVM on the host if /dev/kvm is present in the mock environment. iconic behaviour honestly. π
On the host system:
yum install -y mock- Add a user to the mock group to use for running mock. eg.
builder - Create a new
/etc/mock/config file based on the rawhide one, or modify the existing one so that the following options are setup:
config_opts['chroot_setup_cmd'] = 'install @buildsys-build lorax qemu'
# build results go into /home/builder/results/
config_opts['plugin_conf']['bind_mount_opts']['dirs'].append(('/home/builder/results','/results/'))
If you are creating images for a branched release of Fedora you should also enable the updates-testing repository so that you get the latest builds in your mock chroot. β¨
The following steps are run as the builder user who is a member of the mock group.
- Make a directory for results matching the bind mount above
mkdir ~/results/ - Copy the example kickstarts
cp /usr/share/docs/lorax/*ks . - Make sure
taranddracut-networkare in the%packagessection and that the url points to the correct repo - Init the mock
mock -r fedora-rawhide-x86_64 --init - Copy the kickstart inside the mock
mock -r fedora-rawhide-x86_64 --copyin ./fedora-minimal.ks /root/ - Copy the Anaconda
boot.isoinside the mockmock -r fedora-rawhide-x86_64 --copyin ./boot.iso /root/ - Make a minimal iso:
mock -r fedora-rawhide-x86_64 --enable-network --chroot -- livemedia-creator \
--resultdir=/results/try-1 --logfile=/results/logs/try-1/try-1.log \
--make-iso --ks /root/fedora-minimal.ks --iso /root/boot.iso
Results will be in ./results/try-1 and logs under /results/logs/try-1/ including anaconda logs and livemedia-creator logs. The new iso will be located at ~/results/try-1/images/boot.iso, and the ~/results/try-1/ directory tree will also contain the vmlinuz, initrd, etc. π
This will run qemu without kvm support, which is going to be very slow. You can add mknod /dev/kvm c 10 232; to create the device node before running lmc. like, do it, your future self will thank you. π
βοΈ OPENSTACK IMAGE CREATION βοΈ
OpenStack supports partitioned disk images so --make-disk can be used to create images for importing into glance, OpenStack's image storage component. You need to have access to an OpenStack provider that allows image uploads, or setup your own using the instructions from the RDO Project. π
The example kickstart, fedora-openstack.ks, is only slightly different than the fedora-minimal.ks one. It adds the cloud-init and cloud-utils-growpart packages. OpenStack supports setting up the image using cloud-init, and cloud-utils-growpart will grow the image to fit the instance's disk size. so helpful, honestly. π«Ά
Create a qcow2 image using the kickstart like this:
sudo livemedia-creator --make-disk --iso=/path/to/boot.iso
--ks=/path/to/fedora-openstack.ks --image-type=qcow2
NOTE: on the RHEL7 version of lmc, --image-type isn't supported. You can only create a bare partitioned disk image. sad but true bestie. π
Import the resulting disk image into the OpenStack system, either via the web UI, or glance on the cmdline:
glance image-create --name "fedora-openstack" --is-public true --disk-format qcow2 \
--container-format bare --file ./fedora-openstack.qcow2
If qcow2 wasn't used then --disk-format should be set to raw. π
π³ DOCKER IMAGE CREATION π³
Use lmc to create a tarfile as described in the TAR File Creation section, but substitute the fedora-docker.ks example kickstart which removes the requirement for core files and the kernel. lowkey genius.
You can then import the tarfile into docker like this (as root):
cat /var/tmp/fedora-root.tar.xz | docker import - fedora-root
And then run bash inside of it:
sudo docker run -i -t fedora-root /bin/bash
slay. π
π¦ OPEN CONTAINER INITIATIVE IMAGE CREATION π¦
The OCI is a new specification that is still being worked on. You can read more about it at the Open Container Initiative website. You can create OCI images using the following command:
sudo livemedia-creator --make-oci --oci-config /path/to/config.json --oci-runtime /path/to/runtime.json \
--iso=/path/to/boot.iso --ks=/path/to/fedora-minimal.ks
You must provide the config.json and runtime.json files to be included in the bundle, their specifications can be found on the OCI github project. output will be in the results directory with a default name of bundle.tar.xz. π₯
This will work with --no-virt and inside a mock since it doesn't use any partitioned disk images. so chill of it honestly. π§
π VAGRANT IMAGE CREATION π
Vagrant images can be created using the following command:
sudo livemedia-creator --make-vagrant --vagrant-metadata /path/to/metadata.json \
--iso=/path/to/boot.iso --ks=/path/to/fedora-vagrant.ks
The image created is a vagrant-libvirt provider image and needs to have vagrant setup with libvirt before you can use it. β¨
The --vagrant-metadata file is optional, it will create a minimal one by default, and if one is passed it will make sure the disk size is setup correctly. If you pass a --vagrant-vagrantfile it will be included in the image verbatim. By default no vagrantfile is created. π¦
There is an example Vagrant kickstart file in the docs directory that sets up the vagrant user with the default insecure SSH pubkey and a few useful utilities.
This also works with --no-virt, but will not work inside a mock due to its use of partitioned disk images and qcow2. π«Ά
π€ CREATING UEFI DISK IMAGES WITH VIRT π€
Partitioned disk images can only be created for the same platform as the host system (BIOS or UEFI). You can use virt to create BIOS images on UEFI systems, and it is also possible to create UEFI images on BIOS systems using OVMF firmware and qemu. okay that's actually kind of iconic. π
Install the lorax-lmc-virt package, this will install qemu and the OVMF firmware files.
Now you can run livemedia-creator with --virt-uefi to boot and install using UEFI:
sudo livemedia-creator --make-disk --virt-uefi --iso=/path/to/boot.iso \
--ks=/path/to/fedora-minimal.ks
Make sure that the kickstart you are using creates a /boot/efi partition by including this:
part /boot/efi --fstype="efi" --size=500
Or use reqpart in the kickstart and Anaconda will create the required partitions. πΈ
NOTE: the--virt-uefimethod is currently only supported on thex86_64architecture. π
π DEBUGGING PROBLEMS π
ok so sometimes an install justβ¦ gets stuck. it happens bestie, it's not you. when you're using qemu the logs go to ./virt-install.log and like, most of the time whatever went wrong is chillin' near the end of that file. lmc does try to catch common errors and it will cancel the install when they pop off, but not everything can be caught π. so when you're making a new kickstart it's genuinely helpful to use vnc so you can watch the install happen live, and if it gets stuck without lmc noticing, you can switch to tty1 and poke at the system directly. very main character of you tbh.
if you're sus that %pre or %post sections are the problem, you can redirect the output to the terminal and examine it by logging into the VM. like this, eg.:
%pre
chvt
exec < /dev/tty3 > /dev/tty3 2>/dev/tty3
#do stuff
echo hello world
%end
and if it does get stuck, the best way to cancel is to hit the qemu pid with kill -9 β lmc will clock that the process died and clean up after itself β¨.
if lmc didn't handle the cleanup for some reason (rude of it), you can do this:
sudo umount /tmp/lmc-XXXXto unmount the iso from its mountpoint.sudo rm -rf /tmp/lmc-XXXXsudo rm /var/tmp/lmc-disk-XXXXXto remove the disk image.
ngl,lmcuses thelmc-prefix for all of its temporary files and directories so it's way easier to find and clean up the leftovers. iykyk π§
the logs from the qemu run are stored in virt-install.log, logs from livemedia-creator are in livemedia.log and program.log.
you can add --image-only to skip the .iso creation entirely and just examine the resulting disk image. or you can pass --keep-image to keep it around after the iso has been created π«Ά.
cleaning up aborted --no-virt installs can sometimes be accomplished by running the anaconda-cleanup script. as of Fedora 18 anaconda is multi-threaded and it can sometimes become stuck and refuse to exit π. when that happens you can usually clean up by first killing the anaconda process then running anaconda-cleanup.
π HACKING π
development on this will take place as part of the lorax project, and on the anaconda-devel-list mailing list, and on github π
feedback, enhancements and bugs are welcome. you can use bugzilla to report bugs against the lorax component. pls do, we love hearing from you π
π AUTHOR π
Weldr Team
β COPYRIGHT β
2024, Red Hat, Inc.
ok that's the whole page bestie, you made it to the end π this was LIVEMEDIA-CREATOR(1), source/version 41.3, dated Aug 12, 2024 β go make something iconic with it, no cap πβ¨
π¦ where this page comes from
- fedora 43: lorax 43.11-3.fc43 Β· GPL-2.0-or-later
- fedora 43: lorax 43.12-1.fc43 Β· GPL-2.0-or-later
- fedora 44: lorax 44.6-1.fc44 Β· GPL-2.0-or-later
- fedora 44: lorax 44.7-1.fc44 Β· GPL-2.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms