Tuesday, October 20, 2009

SBR600: Creating a Proper Fedora LiveCD


From my last blog about creating a LiveCd, my professor Chris Tyler noted that I should use the LiveCd Kickstart files found in the /usr/share/spin-kickstarts/ instead of the anaconda-ks.cfg found in the /root/ home directory as it is more optimized.

So off I go again, I decided to grab the fedora-livecd-desktop.ks and edited it. Again, I added my repository line, my package, as well this time I added the generic packages to replace the Fedora trademarks.

by adding the following lines into the kick start file

# add generic branding
generic-release
generic-logos
generic-release-notes

#Remove Fedora Branding
-fedora-release
-fedora-logos
-fedora-release-notes

This time, I used the time command to count how long it takes to create my LiveCD and this was the output when everything was said and done.

real 18m7.821s
user 12m10.108s
sys 1m48.200s

Next, time to try with the Virtual Machine. And it worked brilliantly, to ensure that my package was installed.

I issued the command rpm -qi irssi and surprisingly it installed my package. I could tell by the grammatical errors in the description


.
Here Again Are my "FINAL" finished files

My KickStart = Here
My LiveCd = Here (This time only 686 MB)

Sunday, October 18, 2009

SBR600: Building Fedora LiveCD - Success Finally -- Failure

After some more troubleshooting with my professor Chris Tyler. I finally managed to create my very own Fedora LiveCd.

Template for my KickStart File: anaconda-ks.cfg
Can be found in the /root/ directory, copy that and place it in your home directory
and change the owner of the file so you can edit it.
chown 'username':'groupname' anaconda-ks.cfg

In my case
chown bchao:bchao anaconda-ks.cfg

Here are the problems I came across when incorporating my package into the KickStart file.

1. Forgot how to add my package and repo information into the kickstart
2. The Architecture of my package is different
3. Repo Directory Config.

Solutions
1. My professor advised me to add the following line in my kickstart file

repo --name="Repo Name" --baseurl='repo url'
in my case
repo --name="Boris Chao Repo" --baseurl=http://scotland.proximity.on.ca/bchaorepo/

and place your package in the packages section.
%packages
@base
@system-tools
@text-internet
@base-x
...
irssi <-- my package 2. Because the CDOT machine HongKong is running Fedora 11, and my package was made under Fedora 10, the dependencies for the my package would be different for both machines. Thanks to my professor for realizing my mistake, he advised me to grab the source rpm and rebuild it. Here is the snippet of my conversation on irc. 22:52 <> this is what i get when i run the livecdcreator command
22:52 <> Error creating Live CD : Failed to build transaction : Missing
Dependency: libcrypto.so.7()(64bit) is needed by package
irssi-0.8.14-1.fc10.x86_64 (Boris Chao Repo)
22:53 <@ctyler> where are you building?
22:53 <> When i checked which package that file belonged to it referred
to the openssl package
22:53 <> hongkong
22:53 <> i checked hongkong and the openssl package was installed
22:54 <@ctyler> you're probably building an F11 live CD then, and your irssi
package was build for f10, so it may be looking for a version
of that library that doesn't exist in F11.
22:54 <@ctyler> just to a quick rebuild of the srpm on hongkong to update it
for F11, and then use that.
22:54 <> oh..ok thanks...didn't think of that
22:55 <@ctyler> rpmbuild --rebuild irssi*src.rpm
22:55 <@ctyler> (make sure you've done the rpmdev-setuptree thing first)
22:57 <> ok

After following those steps, I was on my way to building my LiveCD

3. Since I added New RPMs in my repository directory, I would have had to re-create the repo data for that directory and sign the files. Of course, I forgot recreate the repo data, after my 2 attempt to create my LiveCd, I realized it was still grabbing from my old repo data. Luckily this was only a simple command away.

rpm --addsign *.rpm <- to sign the rpm packages createrepo . <- to create repo data After this little bump, my LiveCd became a LiveDVD as the final product as the size was 1.2GB wow... I will later on try with QEMU ( virtual machine ) to see if my DVD works or not. My Files Boris-LiveDVD = Here
Kickstart File = Here

Building A Live CD - Failures

For Week6, our task was to create a Fedora LiveCD, from scratch.

So Following the Tutorial From Fedora's Wiki site and as well notes our professor Chris Tyler placed on our class Wiki Site I was able to install the needed tools, and tried running the following command

livecd-creator --config=/usr/share/spin-kickstarts/fedora-livecd-desktop.ks --fslabel=Boris-LiveCd --cache=/var/cache/live

and recieved the following error:

Traceback (most recent call last):
File "/usr/bin/livecd-creator", line 140, in
sys.exit(main())
File "/usr/bin/livecd-creator", line 114, in main
creator = imgcreate.LiveImageCreator(ks, name, fs_label)
File "/usr/lib/python2.6/site-packages/imgcreate/live.py", line 47, in __init_ _
LoopImageCreator.__init__(self, *args)
File "/usr/lib/python2.6/site-packages/imgcreate/creator.py", line 795, in __i nit__
ImageCreator.__init__(self, ks, name)
File "/usr/lib/python2.6/site-packages/imgcreate/creator.py", line 76, in __in it__
self.__sanity_check()
File "/usr/lib/python2.6/site-packages/imgcreate/creator.py", line 404, in __s anity_check
raise CreatorError("SELinux requested but not enabled on host")
imgcreate.errors.CreatorError/usr/lib/python2.6/site-packages/imgcreate/errors.p y:40: DeprecationWarning: BaseException.message has been deprecated as of Python 2.6
return str(self.message)
: SELinux requested but not enabled on host

So...I logged onto the CDOT machine HongKong and ran the same command it completed successfully

So next, it was time to try the image on a virtual machine. To do so, I entered the following command

qemu -kvm -m 512 -cdrom "image file"


Sadly I received the following error.


Well, for now I will leave it at that and will ask Chris on Tuesday about these errors, maybe he would have some insight to this.

Next Task, adding my own package to the LiveCd.

Chao...

Thursday, October 15, 2009

Finding The Optimal J Value For Building Packages

Our task for week 6 was to find the optimal j value for one of the cdot systems, so when we start to build Fedora we would know which value to use to help speed up the build process.

The machine I decided to work on was Hong Kong, and my package I used to help me time the speed was seahorse.

We created a script would would run and replicate the build processes on the package and provide us a time it finishes a cycle.

Here is the script I used.

------------------------------------------------------------------------------------------------------

#!/bin/bash
rm -f build.log

#Setting the j value, starting from 5 to 15
for ((j=5; j<=15; j++))
do
mv ~/.rpmmacros ~/.rpmmacros.old
#Looks for the smp_flag in the .rpmmacros file and replaces the j value.
grep -v smp_flags ~/.rpmmacros.old >~/.rpmmacros
echo "%_smp_mflags -j$j" >> ~/.rpmmacros

#Run the Build 3 times and Outputting the values to a log
for ((x=1; x<=3; x++))
do
echo "Building...j:$j x:$x"
echo "Time for j value $j Number of Tries: $x" >> build.log
echo "" >>build.log
/usr/bin/time -f "%e %U %s" -o build.log -a rpmbuild -ba /home/bchao/rpmbuild/SPECS/seahorse.spec >/dev/null 2>&1
echo "" >> build.log
done


done

----------------------------------------------------------------------------

Here are my results.


Number of Tries

J Value 1 2 3
5 38.55 45.11 0 37.93 45.26 0 37.99 45.26 0
6 37.00 45.35 0 37.46 45.19 0 37.25 45.45 0
7 36.80 45.49 0 37.20 45.57 0 37.15 45.35 0
8 36.26 45.48 0 36.04 45.32 0 36.37 45.47 0
9 36.03 45.59 0 36.00 45.31 0 36.23 45.63 0
10 36.32 45.44 0 36.02 45.51 0 36.11 45.65 0
11 35.88 45.25 0 36.04 45.47 0 36.20 45.72 0
12 36.42 45.64 0 36.01 45.55 0 36.10 45.40 0
13 36.31 45.40 0 36.12 45.69 0 35.98 45.56 0
14 36.12 45.63 0 36.62 45.50 0 36.01 45.56 0
15 36.03 45.72 0 36.11 45.69 0 36.14 45.84 0

As you can see using the j value 5 gave us the slowest speed of 38 seconds, the fastest time recorded was with the j value 11 at 35.88. The j value where everything basically averages out is 9 with the time of 36 seconds.

So when we do any Fedora builds on Hong Kong, I know which value I would use which is 9.

Tuesday, October 6, 2009

Making A Repository for Our Packages

After successfully passing my koji build test, my next step was to create a repository to store my package so everyone else can download it and install it on their system.

So using the steps my professor Chris, told us : Steps to create repo


Creating a RPM package for your repo file

The way I created my repo file, was looking up an existing repo file in yum.repos.d and downloaded their source.

So on the scotland machine in CDOT, I used the livna repo as my template.

I used the following command to download the source code
yumdownloader --source livna

once downloaded issue the command
rpmdev-setuptree (if you don't already have the rpmbuild directory)

if so type in rpm -i "package name"

in the /rpmbuild/SOURCES directory edit and rename the .repo file so it contain the information for your repo: example

Place your Public GPG key in the /rpmbuild/SOURCES directory as well

After, Edit the Spec file, then use the command : Example

rpmbuild -ba "your new repopackage name"


After completion, do a rpmlint on your new rpm.

rpmlint "your new RPM package"

Upload it to a server and try it out.

Here are a few screen shots of my work



The following picture shows, the installation of my rpm repo with GUI



As You can see from the above picture, it notifies the user if he would like to add my GPG key, and install the irssi package from my repository to their system

This actually took me a long time to figure out if my GPG signature was added, so I jumped on IRC and asked my fellow users in the seneca channel, and my Prof. was luckily there and helped me solve that worry. I just needed to use

rpm -qip
"rpm file"


The above picture shows, the successful installation of my rpm package from the repository

Link To My RPM Repo : REPO

If you would like to try to install my package use the following command
yum install --disablerepo=fedora,updates irssi