PDA

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



donatom
22nd March 2017, 10:22 PM
Note: this thread has been updated and will work for Fedora 28 or Rawhide. (May 25, 2018)



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

Follow all the instructions in the Fedora wiki on using livemedia-creator: https://fedoraproject.org/wiki/Livemedia-creator-_How_to_create_and_use_a_Live_CD
Note: In the wiki listed above, they refer to Fedora 27; make sure you change this to the Fedora version you want (Fedora 28, 29, etc.).

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) and you should not use older kickstart files because the developers tend to change things (for improvement) and you could be faced with the program halting with an error. For instance, the kickstart for Fedora 27 placed repos BEFORE the url for the basic system which was the opposite of what was done in Fedora 26 (where the repos came AFTER the url for the basic system.

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
repo --name="fedora" --baseurl=http://mirrorservice.org/sites/dl.fedoraproject.org/pub/fedora/linux/releases/28/Everything/x86_64/os/
repo --name="fedora-updates" --baseurl=http://mirrorservice.org/sites/dl.fedoraproject.org/pub/fedora/linux/updates/28/x86_64/
repo --name=rpmfusionfree --mirrorlist=http://mirrors.rpmfusion.org/mirrorlist?repo=free-fedora-28&arch=x86_64
repo --name=rpmfusionfreeupdates --mirrorlist=http://mirrors.rpmfusion.org/mirrorlist?repo=free-fedora-updates-released-28&arch=x86_64
repo --name="rpmfusion-nonfree" --mirrorlist=http://mirrors.rpmfusion.org/mirrorlist?repo=nonfree-fedora-28&arch=x86_64
repo --name="rpmfusionnon-freeupdates" --mirrorlist=http://mirrors.rpmfusion.org/mirrorlist?repo=nonfree-fedora-updates-released-28&arch=x86_64
repo --name="google-chrome" --baseurl=http://dl.google.com/linux/chrome/rpm/stable/x86_64

# Use network installation
url --mirrorlist=https://mirrors.fedoraproject.org/mirrorlist?repo=fedora-28&arch=x86_64
# System language
lang en_US.UTF-8
# Firewall configuration
firewall --enabled --service=mdns

# 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/mirrorlist?repo=fedora-28&arch=x86_64

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, 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

Morro Bay

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


CARPINTERIA

Wifi Access Point (wifi router): att101
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 upgraded my iso system (not sure if this actually works) 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. If you choose some non-free programs, make sure to include the repos for rpmfusion.

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
ffmpeg.x86_64
gedit.x86_64
tar
#dracut-network
lorax.x86_64
lorax-lmc-novirt
pykickstart
k3b.x86_64
ImageMagick
mock
git
@virtualization
vim
mplayer
pavucontrol
blueberry
dvd+rw-tools.x86_64
sudo
%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.

Note: On two of my systems Livemedia-creator stopped and complained about "software 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)


"Software 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.