PDA

View Full Version : Making a Live Custom-Iso Using Livemedia-Creator



donatom
22nd March 2017, 10:22 PM
NOTE: As of July, 2017 the following no longer works. Mock has been borked. To make a custom live iso, follow the instructions on the latest lorax livemedia creator wiki (as of this date the fedora livemedia-creator wiki no longer works). I now use livemedia-creator directly without use of mock (you should use a VM system because your system could become borked ). This is the command I used to get a generic custom fedora 26 iso:


# livemedia-creator --make-iso --no-virt --iso-only --iso-name Fedora-Custom.iso --releasever 26 --project Fedora-Custom --ks flat-fedora-live-xfce.ks


This is how I was able to cobble together an up-to-date live Fedora 25 using livemedia-creator:

Follow all the instructions in the Fedora wiki on using livemedia-creator:

After you have installed "mock", initiated the version you want to use and installed the required software using mock (i.e., lorax-lmc-novirt git vim-minimal pykickstart), started the mock shell and cloned the mock kickstart files, choose the file that appeals to you (I chose "fedora-live-xfce.ks"). Then "flatten" the kickstart file which creates a single kickstart file (most require other files). DO NOT use the kickstart files from the normal fedora repository (i.e., /usr/share/spin-kickstarts); these are made for livecd-creator not livemedia-creator -- you would have to make a lot more changes to get them to work on livemedia-creator.

Take the flattened file and begin to edit it. You will need to change your location from the default " US/Eastern" to the appropriate time-zone (I changed mine to US/Pacific). Change your language and country from "lang en_US.UTF-8" to the appropriate combination and change keyboard to the proper language if necessary.

There are several changes that I found that must be made in order for the app not to throw an error and stop (I believe I got this info from the Lorax wiki): disable selinux (selinux --disabled), add a root password (rootpw rootme) -- I'm not sure that this is necessary but I made all recommended changes (from Lorax) because the program kept stalling; change the partition size unless the iso you are creating is smaller than 5000 mega-bytes which is the default (part / --fstype="ext4" --size=8192 is how I changed my partition size); then add the command "/dev/null > /etc/fstab" just after %post which follows all the personal configurations (again I'm not sure this is necessary but after making changes suggested by Lorax I was able to successfully create my customized iso).

Here is a copy of my changes to the initial personal configurations mentioned above:

#version=DEVEL
# X Window System configuration information
xconfig --startxonboot
# Keyboard layouts
keyboard 'us'
# Root password
rootpw --iscrypted --lock locked
# Use network installation
url --mirrorlist="https://mirrors.fedoraproject.org/metalink?repo=fedora-25&arch=$basearch"
# System language
lang en_US.UTF-8
# Firewall configuration
firewall --enabled --service=mdns

repo --name="fedora" --mirrorlist=https://mirrors.fedoraproject.org/metalink?repo=updates-released-f25&arch=$basearch
repo --name=rpmfusionfree --mirrorlist=http://mirrors.rpmfusion.org/mirrorlist?repo=free-fedora-25&arch=$basearch
repo --name=rpmfusionfreeup --mirrorlist=http://mirrors.rpmfusion.org/mirrorlist?repo=free-fedora-updates-released-25&arch=$basearch
repo --name=rpmfusionnonfree --mirrorlist=http://mirrors.rpmfusion.org/mirrorlist?repo=nonfree-fedora-25&arch=$basearch
repo --name=rpmfusionnonfreeup --mirrorlist=http://mirrors.rpmfusion.org/mirrorlist?repo=nonfree-fedora-updates-released-25&arch=$basearch
repo --name=google --baseurl=http://dl.google.com/linux/chrome/rpm/stable/x86_64


# Shutdown after installation
shutdown
# Network information
network --bootproto=dhcp --device=link --activate
# System timezone
timezone US/Pacific
# System authorization information
auth --useshadow --passalgo=sha512
# SELinux configuration
selinux --disabled
#root password
rootpw rootme
# System services
services --disabled="sshd" --enabled="NetworkManager,ModemManager"
# System bootloader configuration
bootloader --location=none
# Clear the Master Boot Record
zerombr
# Partition clearing information
clearpart --all
# Disk partitioning information
part / --fstype="ext4" --size=8192


%post
cat /dev/null > /dev/fstab
# FIXME: it'd be better to get this installed from a package
cat > /etc/rc.d/init.d/livesys << EOF

I changed the url for the download of the fedora files from "rawhide" to the url of the stable version:

url --mirrorlist="https://mirrors.fedoraproject.org/metalink?repo=fedora-25&arch=$basearch"

You must change "repo" to "url" for the first repository; otherwise, the program will throw an error (fedora has changed it for you on this mock kickstart file). You can add other repositories but you must change the name from "--name=SomeName-updates" to something other than "updates". I have included rpmfusion and google-chrome repositories, all of which must begin with “repo” (just like livecd-creator ) as you can see in the personal configuration lines shown above.

If you want to add files, start apps (like firefox), do so at the end of the %post section of the flattened kickstart, right before where it says "#this goes at the end after all other changes" (these changes, etc. will show up whenever you start your customized live iso -- this works in fedora-live-xfce.ks, at least).

Here is what my file looks like with the files, changes mentioned above:


#update applications
dnf -y upgrade
#start firefox (open it on desktop upon booting)
firefox

#Add wifi passwd file
echo 'Wifi info for users

VENTURA

Wifi Access Point (WIFI ROUTER): ATT77746v4
password: 2a693#999999


CARPINTERIA

Wifi Access Point (wifi router): att198
password: 5425000000' > /home/liveuser/Desktop/WifiPasswd



# this goes at the end after all other changes.
chown -R liveuser:liveuser /home/liveuser
restorecon -R /home/liveuser

EOF


%end


Notice I started firefox, upgraded my iso system and inserted a file called "WIFI INFO for Users" into the Desktop directory.

Now go towards the end of the file (in vi type :G and then hit enter key), go up to the beginning of %packages section. These are programs that will be installed. You can add your own (gparted, etc) or remove programs that are default programs (-dialup will keep the dialup program from being installed). You can delete the minus sign (-) in front of programs that are being eliminated in order to retain them on your system.

Here are programs that I added to the end of the %package section:



%packages
******* (this just indicates that there are more packages listed above this spot -- do not include on file)
NetworkManager.x86_64
NetworkManager-wifi.x86_64
gcc.x86_64
vlc.x86_64
akmod-wl.x86_64
kernel-devel.x86_64
kernel-headers.x86_64
@libreoffice
gparted
google-chrome-stable.x86_64
-fedora-logos.x86_64
-fedora-release.noarch
-fedora-release-notes.noarch
generic-release.noarch
generic-logos.noarch
generic-release-notes.noarch
%end

Notice that I am getting rid of the fedora logos, etc using minus sign and adding generic logos, etc, since the iso technically is no longer a fedora system because it has non-free programs (vlc, gparted, etc.) If you add non-free programs to your iso, you MUST get rid of Fedora logos, etc -- unless you are not going to distribute the iso to others. Nobody wants to get the Fedora community mad.

Hopefully this info will help those that are having trouble putting together a customized iso (based on fedora) using livemedia-creator.

If there is an error (or two) thrown, look at the terminal for hints. Avoid leaving space between programs (and maybe even comments, i.e., #rebranding system). Livemedia-creator will complain that the %package-section has not been properly completed and will stop.

Note: On two of my systems Livemedia-creator stopped and complained about "softeware spoke not completed". I obviously had either a repo that had an error or I had a program that was mislabeled, etc. I ended up cloning the ks file from the system that ran correctly to the other systems. I could have, of course, created a new flattened ks file. In any case, livemedia-creator now runs successfully to completion on all of my systems (4 -- three desktops and a HP laptop)


"Softeware spoke not completed" I believe means that one or more repos are not configured correctly or that the software you are adding does not exist in any of your repos.

antikythera
22nd March 2017, 11:38 PM
Thanks for posting, very useful information

donatom
23rd March 2017, 01:01 AM
Antikythera,

You are quite welcome.