From Fedora Project Wiki

(More update to 39)
 
(41 intermediate revisions by 13 users not shown)
Line 1: Line 1:
{{admon/note | Note | for older method (namely for Fedora 23) using livecd-tools ('''livecd-creator''') visit https://fedoraproject.org/wiki/How_to_create_and_use_a_Live_CD}}
{{admon/note | Note | If you simply want to burn a pre-made ISO to a disc, visit http://fedoraproject.org/en/get-fedora to download a LiveCD or LiveDVD, then see the [http://docs.fedoraproject.org/install-guide/ install guide] or [http://docs.fedoraproject.org/readme-burning-isos/ burning how-to] for further instructions.}}
{{admon/note | Note | If you simply want to burn a pre-made ISO to a disc, visit http://fedoraproject.org/en/get-fedora to download a LiveCD or LiveDVD, then see the [http://docs.fedoraproject.org/install-guide/ install guide] or [http://docs.fedoraproject.org/readme-burning-isos/ burning how-to] for further instructions.}}


{{admon/note | Note | for f25 (rawhide) livemedia-creator see https://wiki.sugarlabs.org/go/Fedora_25#livemedia-creator }}


=='''livemedia-creator'''==
=='''livemedia-creator'''==
=== Documentation ===
* Livemedia Creator: http://weldr.io/lorax/livemedia-creator.html
* Kickstart: https://github.com/rhinstaller/pykickstart/blob/master/docs/kickstart-docs.rst
=== Setup Environment ===
==== Cloud Base/Vagrant ====
If using the cloud base or vagrant images, install the needed kernel modules:
# dnf install kernel-modules-$(uname -r)


==== Install Mock ====
You should always do all work in mock, this will allow you to ensure that the compose environment matches the target environment.


# dnf install mock
# usermod -a -G mock <user>


*Examples in f24 root terminal:
=== Setup Build Environment ===
===Install files===
To setup a Fedora 39 x86_64 environment use mock to setup and install tools.
*'''livemedia-creator and ksflatten are part of lorax'''


  # dnf install lorax virt-install libvirt-daemon-config-network pykickstart
==== Init Environment ====
  $ mock -r fedora-39-x86_64 --init
$ mock -r fedora-39-x86_64 --install lorax-lmc-novirt vim-minimal pykickstart livecd-tools


*Must be done first:
==== Get kickstarts ====
The official Fedora kickstarts are stored in [https://pagure.io/fedora-kickstarts a git repository]. The 'master' branch is for Rawhide; there are branches for each release as well. You can use a kickstart from this repository (on the correct branch for whatever release you want your live image to be) as a base. You could also take a fully flattened kickstart from [http://koji.fedoraproject.org/koji/tasks?state=closed&view=flat&method=createLiveMedia&order=-id a recent official live image compose task] as a base.


:'''You must be in the same fedora version (f24) first. This is so that packages can be installed to livecd without SELinux errors and is relabeled at boot time.'''
If you wanted a different arch or release you would use the correct mock configuration file.
setenforce 0


===Notes===
==== SELinux ====
*Important
If your system is using SELinux, it needs to be set to Permissive mode while running lorax.
: http://lorax.readthedocs.io/en/latest/livemedia-creator.html


*Older posts
$ sudo setenforce 0
:https://www.brianlane.com/creating-live-isos-with-livemedia-creator.html
:https://jbwillia.wordpress.com/2014/10/29/how-to-build-updated-fedora-live-iso-for-yourself/


*Jun 28, 2016 at 12:28:27PM -0500, Bruno Wolff III wrote:
=== Running a Compose ===
"In --no-virt mode it's calling anaconda
Go into your prepared environment to do a compose.
directly so kickstart processing of the %include may work, depending on
the location of the files. But if you're using it in virt mode only the
top level ks gets passed into the vm so ksflatten is required in that
case."


===pagure kickstarts Links===
$ mock -r fedora-39-x86_64 --shell --enable-network --isolation=simple
<mock-chroot> sh-5.2#


:https://pagure.io/fedora-kickstarts/tree/f24
If you need to copy files into mock then you can do that with


::alternately: git clone the repo and not get each piece manually
$ mock -r fedora-39-x86_64 --copyin filename /builddir


:Kickstarts need to flattened before use:
Copying to builddir puts the file in the working dir of the mock environment.
:: hit raw tab and '''save-page-as''' to a local directory (/home/(user)/Downloads/pagure/)


:https://pagure.io/fedora-kickstarts/blob/f24/f/fedora-live-soas.ks
==== Flatten a Kickstart ====
:https://pagure.io/fedora-kickstarts/blob/f24/f/fedora-live-base.ks
The official Fedora spins are composed from templates. Flattening fully resolves the templates to a valid kickstart which can be fed to livemedia-creator. After copying a base kickstart into the mock environment, you can flatten it with e.g.:
:https://pagure.io/fedora-kickstarts/blob/f24/f/fedora-live-minimization.ks
:https://pagure.io/fedora-kickstarts/blob/f24/f/fedora-repo.ks
:https://pagure.io/fedora-kickstarts/blob/f24/f/fedora-repo-not-rawhide.ks
:https://pagure.io/fedora-kickstarts/blob/f24/f/fedora-repo-rawhide.ks
:https://pagure.io/fedora-kickstarts/blob/f24/f/fedora-soas-packages.ks


*switch root terminal to the local directory with the kickstart files (/home/(user)/Downloads/pagure/)
<mock-chroot> sh-5.2# ksflatten --config fedora-live-soas.ks -o flat-fedora-live-soas.ks


=== ksflatten ===  
==== Create the Live Image ====
::updated 06/28/2016
Run livemedia-creator with the flattened kickstart and relevant options. This creates a Sugar on a Stick live iso that also has EFI/Mac booting support.


<mock-chroot> sh-5.2# livemedia-creator --ks flat-fedora-live-soas.ks --no-virt --resultdir /var/lmc --project Fedora-soas-Live --make-iso --volid Fedora-SoaS-39 --iso-only --iso-name Fedora-SoaS-39-x86_64.iso --releasever 39 --macboot


ksflatten -v, --config fedora-live-soas.ks -o flat-fedora-live-soas.ks --version F24
===== Example Output =====
===livemedia-creator example===
  <mock-chroot> sh-5.2# livemedia-creator --ks /flat-fedora-live-soas.ks --no-virt --resultdir /var/lmc --project Fedora-soas-Live --make-iso --volid Fedora-Soas-39 --iso-only --iso-name Fedora-Soas-39-x86_64.iso --releasever 39 --macboot
  livemedia-creator --ks /home/(user)/Downloads/pagure/flat-fedora-live-soas.ks --no-virt --resultdir /var/lmc --project Fedora-soas-Live --make-iso --volid Fedora-SoaS-f24 --iso-only --iso-name Fedora-SoaS-f24.iso --releasever 24 --title Fedora-SoaS-live --macboot
2023-11-22 16:41:11,591: Starting installer, one moment...
2023-11-22 16:41:11,591: terminal size detection failed, using default width
2023-11-22 16:41:11,591: anaconda 39.32.6-2.fc39 for Fedora-soas-Live 39 (pre-release) started.
2023-11-22 16:41:11,591: 16:41:11 Not asking for VNC because of an automated install
2023-11-22 16:41:11,591: 16:41:11 Not asking for VNC because we don't have Xvnc
2023-11-22 16:41:13,369: Processing logs from ('127.0.0.1', 38824)
2023-11-22 16:42:20,119: Starting automated install..................................................................
2023-11-22 16:42:20,119:
2023-11-22 16:42:20,119: ================================================================================
2023-11-22 16:42:20,119: ================================================================================
2023-11-22 16:42:20,119: Installation
2023-11-22 16:42:20,119:
2023-11-22 16:42:20,119: 1) [x] Language settings                2) [x] Time settings
2023-11-22 16:42:20,119:        (English (United States))                (US/Eastern timezone)
2023-11-22 16:42:20,119: 3) [x] Installation source              4) [x] Software selection
2023-11-22 16:42:20,119:        (https://mirrors.fedoraproject.o        (Sugar Desktop Environment)
2023-11-22 16:42:20,119:        rg/mirrorlist?repo=rawhide&arch=
2023-11-22 16:42:20,119:        $basearch)
2023-11-22 16:42:20,119: 5) [ ] User creation
2023-11-22 16:42:20,119:        (No user will be created)
2023-11-22 16:42:20,119:
2023-11-22 16:42:20,119: ================================================================================
2023-11-22 16:42:20,119: ================================================================================
2023-11-22 16:42:20,120: Progress
2023-11-22 16:42:20,120:
2023-11-22 16:42:20,120: Setting up the installation environment
2023-11-22 16:42:20,120: .
2023-11-22 16:42:20,120: Configuring storage
2023-11-22 16:44:24,665: .
2023-11-22 16:44:24,666: Running pre-installation scripts
2023-11-22 16:44:24,666: .
2023-11-22 16:44:24,666: Running pre-installation tasks
2023-11-22 17:15:31,230: Rebuilding initrds
2023-11-22 17:15:31,230: dracut args = ['--xz', '--add', 'livenet dmsquash-live dmsquash-live-ntfs convertfs pollcdrom qemu  qemu-net', '--no-hostonly', '--debug', '--no-early-microcode']
2023-11-22 17:15:31,251: rebuilding boot/initramfs-6.7.0-0.rc2.22.fc40.x86_64.img
2023-11-22 17:16:44,012: Building boot.iso
2023-11-22 17:16:44,052: running x86.tmpl
2023-11-22 17:17:15,011: Disk image erased
2023-11-22 17:17:27,071: SUMMARY
2023-11-22 17:17:27,071: -------
2023-11-22 17:17:27,071: Logs are in /builddir
2023-11-22 17:17:27,071: Results are in /var/lmc


=== Make a remix ===
==== Compose Results ====
*edit the bottom of the flat-fedora-live-soas.ks
The resulting images will be located in the mock chroot. Copy them somewhere outside of the mock-chroot.
:that you produce with ksflatten  (above)
:in this section of the flattened.ks:
%packages
:add a program  (add name)
:'''-''' delete a program ( put - in front)
:put '''#''' in front of listed program to not install it


====kickstart-docs====
$ cp /var/lib/mock/fedora-39-x86_64/root/var/lmc/*.iso $HOME
* https://github.com/rhinstaller/pykickstart/blob/master/docs/kickstart-docs.rst


====livemedia-creator terminal output====
Note: The location will be different based on your mock configuration.
:Build takes a long time wait for completion
:ends with:
..........clip........
..........clip........
2016-07-08 11:50:37,613: Disk Image install successful
2016-07-08 11:50:37,613: working dir is /var/tmp/lmc-work-ey7rlb4p
2016-07-08 12:02:35,166: Rebuilding initrds
2016-07-08 12:02:35,166: dracut args = ['--xz', '--add', 'livenet dmsquash-live convertfs pollcdrom qemu qemu-net', '--omit', 'plymouth', '--no-hostonly', '--debug', '--no-early-microcode']
2016-07-08 12:02:35,167: rebuilding boot/initramfs-4.6.3-300.fc24.x86_64.img
2016-07-08 12:03:57,231: Building boot.iso
2016-07-08 12:03:57,328: running x86.tmpl
2016-07-08 12:04:37,262: Disk image erased
2016-07-08 12:04:37,945: SUMMARY
2016-07-08 12:04:37,945: -------
2016-07-08 12:04:37,946: Logs are in /home/satellit/Downloads/pagure
2016-07-08 12:04:37,946: Results are in /var/lmc


===Retrieve finished live.iso===
=== Cleanup ===
"Results are in /tmp/lmc"
We can now safely clean up the build environment and set SELinux back to enforcing.
*start files application
*click on '''Files system'''
:open  temp folder
:open lmc folder
*click on  the '''.....iso''' you just built
'''copy to''' (mouse right click) '''Home''' with files application
*Check that it is in Home
===Clean Up===
* delete the instance in /var
:delete the /var/lmc directory  (cannot run new build unless this is done?)


  [root@localhost pagure]# cd /var
  $ mock -r fedora-39-x86_64 --clean
[root@localhost var]# ls
  $ sudo setenforce 1
account  adm  cache  crash  db  empty  ftp  games  gopher  kerberos  lib  lmc  local  lock  log  mail  nis  opt  preserve  run  spool  tmp  www  yp
[root@localhost var]# rm -r lmc
rm: descend into directory 'lmc'? y
rm: remove regular file 'lmc/Fedora-SoaS-f24.iso'? y
rm: remove directory 'lmc'? y
  [root@localhost var]#

Latest revision as of 17:30, 20 December 2023

Note.png
Note
If you simply want to burn a pre-made ISO to a disc, visit http://fedoraproject.org/en/get-fedora to download a LiveCD or LiveDVD, then see the install guide or burning how-to for further instructions.


livemedia-creator

Documentation

Setup Environment

Cloud Base/Vagrant

If using the cloud base or vagrant images, install the needed kernel modules:

# dnf install kernel-modules-$(uname -r)

Install Mock

You should always do all work in mock, this will allow you to ensure that the compose environment matches the target environment.

# dnf install mock
# usermod -a -G mock <user>

Setup Build Environment

To setup a Fedora 39 x86_64 environment use mock to setup and install tools.

Init Environment

$ mock -r fedora-39-x86_64 --init
$ mock -r fedora-39-x86_64 --install lorax-lmc-novirt vim-minimal pykickstart livecd-tools

Get kickstarts

The official Fedora kickstarts are stored in a git repository. The 'master' branch is for Rawhide; there are branches for each release as well. You can use a kickstart from this repository (on the correct branch for whatever release you want your live image to be) as a base. You could also take a fully flattened kickstart from a recent official live image compose task as a base.

If you wanted a different arch or release you would use the correct mock configuration file.

SELinux

If your system is using SELinux, it needs to be set to Permissive mode while running lorax.

$ sudo setenforce 0

Running a Compose

Go into your prepared environment to do a compose.

$ mock -r fedora-39-x86_64 --shell --enable-network --isolation=simple
<mock-chroot> sh-5.2#

If you need to copy files into mock then you can do that with

$ mock -r fedora-39-x86_64 --copyin filename /builddir

Copying to builddir puts the file in the working dir of the mock environment.

Flatten a Kickstart

The official Fedora spins are composed from templates. Flattening fully resolves the templates to a valid kickstart which can be fed to livemedia-creator. After copying a base kickstart into the mock environment, you can flatten it with e.g.:

<mock-chroot> sh-5.2# ksflatten --config fedora-live-soas.ks -o flat-fedora-live-soas.ks

Create the Live Image

Run livemedia-creator with the flattened kickstart and relevant options. This creates a Sugar on a Stick live iso that also has EFI/Mac booting support.

<mock-chroot> sh-5.2# livemedia-creator --ks flat-fedora-live-soas.ks --no-virt --resultdir /var/lmc --project Fedora-soas-Live --make-iso --volid Fedora-SoaS-39 --iso-only --iso-name Fedora-SoaS-39-x86_64.iso --releasever 39 --macboot
Example Output
<mock-chroot> sh-5.2# livemedia-creator --ks /flat-fedora-live-soas.ks --no-virt --resultdir /var/lmc --project Fedora-soas-Live --make-iso --volid Fedora-Soas-39 --iso-only --iso-name Fedora-Soas-39-x86_64.iso --releasever 39 --macboot
2023-11-22 16:41:11,591: Starting installer, one moment...
2023-11-22 16:41:11,591: terminal size detection failed, using default width
2023-11-22 16:41:11,591: anaconda 39.32.6-2.fc39 for Fedora-soas-Live 39 (pre-release) started.
2023-11-22 16:41:11,591: 16:41:11 Not asking for VNC because of an automated install
2023-11-22 16:41:11,591: 16:41:11 Not asking for VNC because we don't have Xvnc
2023-11-22 16:41:13,369: Processing logs from ('127.0.0.1', 38824)
2023-11-22 16:42:20,119: Starting automated install..................................................................
2023-11-22 16:42:20,119: 
2023-11-22 16:42:20,119: ================================================================================
2023-11-22 16:42:20,119: ================================================================================
2023-11-22 16:42:20,119: Installation
2023-11-22 16:42:20,119: 
2023-11-22 16:42:20,119: 1) [x] Language settings                 2) [x] Time settings
2023-11-22 16:42:20,119:        (English (United States))                (US/Eastern timezone)
2023-11-22 16:42:20,119: 3) [x] Installation source               4) [x] Software selection
2023-11-22 16:42:20,119:        (https://mirrors.fedoraproject.o         (Sugar Desktop Environment)
2023-11-22 16:42:20,119:        rg/mirrorlist?repo=rawhide&arch=
2023-11-22 16:42:20,119:        $basearch)
2023-11-22 16:42:20,119: 5) [ ] User creation
2023-11-22 16:42:20,119:        (No user will be created)
2023-11-22 16:42:20,119: 
2023-11-22 16:42:20,119: ================================================================================
2023-11-22 16:42:20,119: ================================================================================
2023-11-22 16:42:20,120: Progress
2023-11-22 16:42:20,120: 
2023-11-22 16:42:20,120: Setting up the installation environment
2023-11-22 16:42:20,120: .
2023-11-22 16:42:20,120: Configuring storage
2023-11-22 16:44:24,665: .
2023-11-22 16:44:24,666: Running pre-installation scripts
2023-11-22 16:44:24,666: .
2023-11-22 16:44:24,666: Running pre-installation tasks
2023-11-22 17:15:31,230: Rebuilding initrds
2023-11-22 17:15:31,230: dracut args = ['--xz', '--add', 'livenet dmsquash-live dmsquash-live-ntfs convertfs pollcdrom qemu  qemu-net', '--no-hostonly', '--debug', '--no-early-microcode'] 
2023-11-22 17:15:31,251: rebuilding boot/initramfs-6.7.0-0.rc2.22.fc40.x86_64.img
2023-11-22 17:16:44,012: Building boot.iso
2023-11-22 17:16:44,052: running x86.tmpl
2023-11-22 17:17:15,011: Disk image erased
2023-11-22 17:17:27,071: SUMMARY
2023-11-22 17:17:27,071: -------
2023-11-22 17:17:27,071: Logs are in /builddir
2023-11-22 17:17:27,071: Results are in /var/lmc

Compose Results

The resulting images will be located in the mock chroot. Copy them somewhere outside of the mock-chroot.

$ cp /var/lib/mock/fedora-39-x86_64/root/var/lmc/*.iso $HOME

Note: The location will be different based on your mock configuration.

Cleanup

We can now safely clean up the build environment and set SELinux back to enforcing.

$ mock -r fedora-39-x86_64 --clean
$ sudo setenforce 1