Cobbler Not Parsing Kickstart Profile

Tuesday, April 1, 2014

After installing Cobbler and importing the Ubuntu Server 12.04.4 LTS ISO, I copied the Cobbler Profile created on import to a new Cobbler Profile named ubuntu-12.04.4-server-x86_64-ks with the intention of pointing it to the following Kickstart Profile (yes, Ubuntu supports Kickstart Profiles but only so much):


url --url=$tree

lang en_US.UTF-8
keyboard us

network --device eth0 --bootproto dhcp

timezone --utc UTC

clearpart --all --initlabel
bootloader --location=mbr

part /boot --fstype=ext3 --size=256 --asprimary
part pv.01 --size=1024 --grow --asprimary
volgroup vg_root pv.01
logvol swap --fstype swap --name=lv_swap --vgname=vg_root --size=1024
logvol / --fstype=ext4 --name=lv_root --vgname=vg_root --size=1024 --grow

auth --enableshadow --enablemd5

rootpw --iscrypted CHANGE_ME
user --disabled

firewall --disabled




I saved the Kickstart Profile above to /var/lib/cobbler/kickstarts/ubuntu-server-12.04.ks and ran the following command to point Cobbler Profile ubuntu-12.04.4-server-x86_64-ks at the Kickstart Profile:

cobbler profile edit --name=ubuntu-12.04.4-server-x86_64-ks --kickstart=/var/lib/cobbler/kickstarts/ubuntu-server-12.04.ks

The above command completed successfully but just to verify the modification worked, I ran cobbler profile dumpvars --name=ubuntu-12.04.4-server-x86_64-ks | grep kickstart, and sure enough, the kickstart attribute now pointed to /var/lib/cobbler/kickstarts/ubuntu-server-12.04.ks.

However, when attempting to PXE boot a server, the server would reboot, go into PXE boot mode, get an IP from the DHCP server, but skip the actual PXE booting and boot to the local hard drive.

To make sure the Kickstart Profile was actually being downloaded, I opened /var/lib/tftpboot/pxelinux.cfg/default looked for the LABEL ubuntu-12.04.4-server-x86_64-ks line and copied the URL after auto url=.

I ran that URL through curl with the following command:


The curl output returned the following error:

<title>500 Internal Server Error</title>
<h1>Internal Server Error</h1>
<p>The server encountered an internal error or
misconfiguration and was unable to complete
your request.</p>
<p>Please contact the server administrator,
 webmaster@localhost and inform them of the time the error occurred,
and anything you might have done that may have
caused the error.</p>
<p>More information about this error may be available
in the server error log.</p>
<address>Apache/2.2.22 (Ubuntu) Server at Port 80</address>

Clearly something was wrong with the Kickstart Profile, because when the same Cobbler Profile used the sample.ks Kickstart Profile instead of my own, the curl command would output the Kickstart Profile contents fully parsed.

I ran cobbler validateks but it did not return any invalid syntax.

Finally, when I ran cobbler profile getks --name=ubuntu-12.04.4-server-x86_64-ks it returned the following error:

<type 'exceptions.UnicodeDecodeError'>:'ascii' codec can't decode byte 0xe2 in position 472: ordinal not in range(128)

Something appeared to be wrong with the formatting of the file. Opening the file with vim and setting it to show invisible characters did not reveal anything out of the ordinary.

So, I ran file /var/lib/cobbler/kickstarts/ubuntu-server-12.04.ks, and it returned UTF-8 Unicode text. However, running file /var/lib/cobbler/kickstarts/sample.ks returned ASCII English text. I did not understand what was causing the ubuntu-server-12.04.ks file to be encoded as UTF-8 Unicode text, so I proceeded to figure out how to convert UTF-8 to ACSII.

After reading through the above post, I ran iconv -f utf8 -t ascii ubuntu-server-12.04.ks. It parsed and outputted some of the file but errored out halfway with the following error:

iconv: illegal input sequence at position 447

Where the iconv command stopped parsing was the key to figuring out what was wrong.

The iconv command stopped parsing on the auth line right after the word auth, so this told me something was wrong with the hyphens. Upon closer inspection of the hyphens, they were indeed wrong.

Take a look at the following screenshot:

Kickstart profile screenshot in vim

Go to the auth line and look very closely at the first hyphen for enableshadow and enablemd5. They are slightly longer than the second hyphen.

Those elongated hyphens are apparently not ASCII encoded text and somehow stuck around during the copy and pasting lifetime of this Kickstart Profile. The moment I removed those hypens, re-typed them, and saved the file, the file was now encoded as ASCII English text (I didn’t need to use the iconv command) and the PXE boot process worked.

comments powered by Disqus