Acknowledgements
Thanks to the clarification of kickstart disk-related commands provided by Nazunalika and
Ritov, the subject development could be attempted without fear of damaging existing installations
on a multi-partition host machine.
The repository definitions used were from Nazunalika’s .ks file, rocky-8-xfce-elrepo.ks.
Development and Test Platforms
The development machine was a HP Pavilion Media Center m8247C with SATA disk controllers
and nvidia graphics card, with rocky-8-xfce-elrepo.iso as the installed development distro.
The test machine for newly-created .iso installation was a HP Compaq DC5800 which has
predominately-Intel device controllers and graphics card.
Suitable Example Kickstarts
A group of fedora kickstarts provided some suitable configurations for adaptation. They are
readily available by downloading and local-installing 2 recent fedora packages,
spin-kickstarts-0.36.0-0.4.fc38.noarch.rpm and fedora-kickstarts-0.36.0-0.4.fc38.noarch.rpm.
These packages are installed without incident because they have no dependencies, and their
sole effect is to create 2 directories, /usr/share/spin-kickstarts, which contains many sample .ks
files, and /usr/share/doc/spin-kickstarts, which contains a README.md file and 2 other files.
Plan/Intent
The goal was to create an .iso which would implement the configuration described in
the post:
Kickstart Selection and Modification
Five fedora kickstarts were selected for the implementation. Copies were made of them
with a single-digit prefix to the name of the copy, the number 1 indicating the lowest-level
file, 2 the next one up the hierarchy and numbers 5, 6 and 7 completing the selection. (It
turned out that files numbered 3 and 4 constituted an alternate path and were dropped from
consideration).
The comments in the file fedora-disk-base.ks, "Defines the basics for all kickstarts in the fedora-live branch”, identified it as essential to any final kickstart. Examination of it showed that it
included fedora-repo.ks which contains logic to select either fedora-repo-not-rawhide.ks or
fedora-repo-rawhide.ks, both of which contain appropriate repo definitions. Given that
Nazunalika’s repository definitions in his rocky-8-xfce-elrepo.ks were the only ones
relevant to this situation, 1fedora-repo-not-rawhide.ks was modified to contain them, and
2fedora-disk-base.ks was modified to include that .ks directly.
The code for 1fedora-repo-not-rawhide.ks is:
# Use network installation
url --url https://download.rockylinux.org/stg/rocky/8/BaseOS/$basearch/os/
repo --name="BaseOS" --baseurl=http://dl.rockylinux.org/pub/rocky/8.7/BaseOS/$basearch/os/ --cost=200
repo --name="AppStream" --baseurl=http://dl.rockylinux.org/pub/rocky/8.7/AppStream/$basearch/os/ --cost=200
repo --name="PowerTools" --baseurl=http://dl.rockylinux.org/pub/rocky/8.7/PowerTools/$basearch/os/ --cost=200
repo --name="extras" --baseurl=http://dl.rockylinux.org/pub/rocky/8.7/extras/$basearch/os --cost=200
repo --name="epel" --baseurl=https://dl.fedoraproject.org/pub/epel/8/Everything/$basearch/ --cost=200
repo --name="epel-modular" --baseurl=https://dl.fedoraproject.org/pub/epel/8/Modular/$basearch/ --cost=200
# elrepo repository - required for kmods
repo --name="elrepo" --baseurl=https://elrepo.org/linux/elrepo/el8/$basearch/ --cost=200
# Local repo
repo --name="Local" --baseurl=file:///var/lib/rpm/Local/ --cost=200
The Local repo was added for the e16 and icewm-related packages
Its contents are:
e16-1.0.27-1.x86_64.rpm
lxterminal-0.3.2-4.D20190717gitcb2992e.el8.x86_64.rpm
repodata
ted-2.23-1.x86_64.rpm
vte-0.28.2-29.el8.x86_64.rpm
vte-devel-0.28.2-29.el8.x86_64.rpm
The Local.repo file in /etc/yum.repos.d contains:
[Local]
name=Local repo
baseurl=file:///var/lib/rpm/Local
enabled=1
gpgcheck=0
The code for 2fedora-disk-base.ks is:
# fedora-disk-base.ks
#
# Defines the basics for all kickstarts in the fedora-live branch
# Does not include package selection (other then mandatory)
# Does not include localization packages or configuration
#
# Does includes "default" language configuration (kickstarts including
# this template can override these settings)
# commented out; problem for livecd-creator
# text
#
lang en_US.UTF-8
keyboard us
timezone US/Eastern
selinux --enforcing
firewall --enabled --service=mdns
services --enabled=sshd,NetworkManager,chronyd
network --bootproto=dhcp --device=link --activate
# need root password to login
rootpw ABCDEFGH
# rootpw --lock --iscrypted locked
#
shutdown
bootloader --timeout=1
zerombr
clearpart --all --initlabel --disklabel=msdos
# make sure that initial-setup runs and lets us do all the configuration bits
firstboot --reconfig
%include 1fedora-repo-not-rawhide.ks
%packages
@core
@standard
@hardware-support
kernel
# on 32bit arm make sure we only install one kernel
-kernel-lpae
# remove this in %post
dracut-config-generic
-dracut-config-rescue
# install tools needed to manage and boot arm systems
# no such group
# @arm-tools
#
chrony
# not available
# bcm283x-firmware
#
initial-setup
# Intel wireless firmware assumed never of use for disk images
-iwl*
-ipw*
-usb_modeswitch
-generic-release*
# make sure all the locales are available for inital-setup and anaconda to work
glibc-all-langpacks
%end
%post
# Find the architecture we are on
arch=$(uname -m)
# Setup Raspberry Pi firmware
if [[ $arch == "aarch64" ]] || [[ $arch == "armv7l" ]]; then
if [[ $arch == "aarch64" ]]; then
cp -P /usr/share/uboot/rpi_3/u-boot.bin /boot/efi/rpi3-u-boot.bin
cp -P /usr/share/uboot/rpi_4/u-boot.bin /boot/efi/rpi4-u-boot.bin
else
cp -P /usr/share/uboot/rpi_2/u-boot.bin /boot/efi/rpi2-u-boot.bin
cp -P /usr/share/uboot/rpi_3_32b/u-boot.bin /boot/efi/rpi3-u-boot.bin
cp -P /usr/share/uboot/rpi_4_32b/u-boot.bin /boot/efi/rpi4-u-boot.bin
fi
fi
releasever=$(rpm --eval '%{fedora}')
rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY-fedora-$releasever-primary
echo "Packages within this disk image"
rpm -qa --qf '%{size}\t%{name}-%{version}-%{release}.%{arch}\n' |sort -rn
# remove random seed, the newly installed instance should make it's own
rm -f /var/lib/systemd/random-seed
# The enp1s0 interface is a left over from the imagefactory install, clean this up
rm -f /etc/NetworkManager/system-connections/*.nmconnection
dnf -y remove dracut-config-generic
# insert python2 setup ASAP to ensure lxterminal installs ok
dnf -y install python2
alternatives --set python /usr/bin/python2
#
# Remove machine-id on pre generated images
rm -f /etc/machine-id
touch /etc/machine-id
# Note that running rpm recreates the rpm db files which aren't needed or wanted
rm -f /var/lib/rpm/__db*
%end
********************************************************************************The code in 5fedora-disk-xbase.ks had only 1 change.
Changes in any .ks were flagged by comment (#) lines preceding and following the change,
and the one change in this .ks illustrates the approach:
el8 group name is different
@printing
@print-client
(The fedora group name is @printing, but the el8 group name is @print-client)
%packages
@base-x
@fonts
@input-methods
@multimedia
# el8 group name is different
# @printing
@print-client
#
cups
-@guest-desktop-agents
initial-setup-gui
# Need aajohan-comfortaa-fonts for the SVG rnotes images
aajohan-comfortaa-fonts
# anaconda needs the locales available to run for different locales
glibc-all-langpacks
%end
%post
# Explicitly set graphical.target as default as this is how initial-setup detects which version to run
ln -sf /lib/systemd/system/graphical.target /etc/systemd/system/default.target
%end
(Fortunately, naming the cups package explicitly was a harmless residual error).
The code in 6fedora-workstation-common.ks was unchanged from the original
Testing Complications
“livemedia-creator does not support %include in kickstart files” - quotation from RHEL-related
documentation.
livecd-creator does support the nesting of kickstart files using the %include mechanism.
Not knowing in advance which package might deliver the best results, it was desirable to use both
packages during testing iterations.
Fortunately, a workaround is available in the ksflatten package.
sudo yum install pykickstart creates the /usr/bin/ksflatten binary.
With the 5 component .ks files headed by 7fedora-disk-workstation.ks collected in one directory,
sudo ksflatten --config=7fedora-disk-workstation.ks --output=flatfedora-disk-workstation.ks
creates the flatfedora single, contiguous .ks file usable by livemedia-creator, and also by
livecd-creator.
livemedia-creator seemed to be better in detecting syntax errors in the .ks files, and was fussier
about what packages needed to be included but were not referenced.
The best command line for livemedia-creator, running in the directory /usr/share/doc/livecd-tools,
was: sudo livemedia-creator --make-iso --no-virt --anaconda-arg="–product Rocky Linux”
–ks=flatfedora-disk-workstation.ks
NB: of the 5 lorax packages available, lorax, lorax-templates-generic, lorax-composer,
lorax-lmc-novirt, lorax-lmc-virt, only the first 2 were installed by default.
To be certain, install the other 3 also.
The corresponding command line for livecd-creator was:
sudo livecd-creator --config=/usr/share/doc/livecd-tools/flatfedora-disk-workstation.ks
With this extensive usage of livecd-creator, when corrections were required, there was
a double-entry process of correcting flatfedora-disk-workstation.ks and also correcting
the original 1 or 2 or 5 or 6 or 7 numbered component, a method prone to errors.
This method was abandoned when it became apparent that livemedia-creator would not
complete the .iso creation without error. Invariably, livemedia-creator would fail with
a “template command error in x86.tmpl”. The template definition is provided by the
Rocky-logos package, and the directories inherent in the Rocky-logos package differ
from those provided by the Fedora-logos package.
With livecd-creator as the default package for .iso creation, it was preferable to update
and retain the 5 component packages for clarity, rather than stay with the flatfedora .ks
file. The final test run utilized the 5 component .ks files.
With the 5 component packages collected in /usr/share/doc/livecd-tools, the command was
invoked in that directory:
sudo livecd-creator --config=/usr/share/doc/livecd-tools/7fedora-disk-workstation.ks
Recommended Testing Approach
Because livemedia-creator is useful for debugging, when any changes are required
in the 5 component .ks files, ksflatten should be run to create a fresh flatfedora .ks
file to run with livemedia-creator.
When livemedia-creator successfully finishes syntax checking of the flatfedora .ks
file, it begins to download the required rpms. At that point, the run can be cancelled
and any further runs should be performed by livecd-creator using the 5 component .ks
files.
The contents of the updated 7fedora-disk-workstation.ks file is:
%include 2fedora-disk-base.ks
%include 5fedora-disk-xbase.ks
%include 6fedora-workstation-common.ks
# livemedia-creator ran out of disk space
# autopart --type=ext4 --noswap
# Disk partitioning information
part / --fstype="ext4" --size=5120
part / --size=6144
#
%packages
-initial-setup
-initial-setup-gui
# needed for livecd creation
anaconda
anaconda-live
@anaconda-tools
#
chkconfig
# needed for livecd creation
dracut
dracut-live
#
dracut-config-generic
elrepo-release
epel-release
gparted
# livemedia-creator needs this package
# which supercedes grub-efi
grub2-efi-x64
#
# needed by livemedia-creator
hfsplus-tools
#
kernel
kernel-modules
kernel-modules-extra
# for machines with SATA disks
# and Nvidia ethernet controller
kmod-forcedeth
kmod-sata_nv
#
memtest86+
# large number of packages
# depend on this one
rocky-logos
#
syslinux
# needed by livemedia-creator
xfsprogs
#
# this subset of packages (ted and k3b are
# additions) is the specific component
# for the e16 and icewm DE's
e16
k3b
lightdm
lxterminal
vte
vte-devel
ted
dbus-x11
pluma
caja
mate-polkit
gparted
icewm
#
%end
When the livecd is booted up, it gives a login prompt.
The only approach that was obvious to work was to define
a root password in the 2fedora-disk-base.ks file.
A simple choice was made, ABCDEFGH, because
the live installer dialog allows the usual flexibility for
secure root and user passwords.
The live installer is invoked from the command line,
in directory /usr/bin, sudo liveinst
Len E.