Kickstarting and Provisioning Ubuntu systems with Spacewalk

In the comments of my last article someone asked about provisioning Ubuntu clients with Spacewalk. As I never tried this it got me curious.So I played around with it. It was a bit tricky but in the end I got it working pretty well.

First of all you need a Ubuntu repository and channel in your Spacewalk like describes in this article.

Now for some prerequisites

yum install cobbler-loaders
# SELinux should be disabled in general for Spacewalk to avoid several problems
setenforce 0

Edit /etc/xinetd.d/tftp and set “disable = no”

service xinetd restart

The “cobbler sync” command should be running successful by now.

You will also need a DHCP server running which points to Spacewalk in the “next-server” parameter. If you dont have a DHCP you can have Cobbler manage DHCP for you:

– Edit /etc/cobbler/settings and set “manage_dhcp: 1”
– Edit /etc/cobbler/dhcp.template to fit your network. You need to serve IPs which can reach Spacewalk

Now we need to setup the installation media. Here is where the tricky part starts. Well for me it was. For you its easy now 😉

# Get ISO images we need
mkdir -p /var/iso-images; cd /var/iso-images
# get server or alternative image, NOT desktop because the latter doesnt support preseeding
wget http://releases.ubuntu.com/12.04/ubuntu-12.04.5-server-amd64.iso
wget http://centos.mirrors.as250.net/7.0.1406/isos/x86_64/CentOS-7.0-1406-x86_64-Minimal.iso
mkdir /tmp/ubuntu
mount -oloop /var/iso-images/ubuntu-12.04.5-server-amd64.iso /tmp/ubuntu/
# Populate our installation media folders
mkdir -p /var/distro-trees/ubuntu-12.0.4.5-amd64
cp -a /tmp/ubuntu/ /var/distro-trees/ubuntu-12.0.4.5-amd64/
# Create data to fool Spacewalk thinking it is a valid CentOS image
mkdir /tmp/centos
mount -oloop /var/iso-images/CentOS-7.0-1406-x86_64-Minimal.iso
mkdir -p /var/distro-trees/images/pxeboot/
cp /tmp/centos/images/pxeboot/{initrd.img,vmlinuz} /var/distro-trees/images/pxeboot/
# /tmp and /var/iso-images could be cleaned up now

Now in Spacewalk got to Systems->Kickstart->Distributions and create a new one with Tree Path set to /var/distro-trees/ubuntu-12.0.4.5-amd64 and Base Channel set to your Ubuntu main channel.
Since we copied CentOS kernel and initrd there it will accept the distribution.
Spacewalk now calls Cobbler and generates profiles with hardcoded redhat parameters. We will fix this later.

Now go to Systems->Kickstart->Profiles and create a new Kickstart profile by clicking on “upload new Kickstart file” where you can enter Ubuntu Kickstart OR Ubuntu Preseed commands or upload such a file.

Now go back to the console and do a

# get the --name from 'cobbler list'
cobbler distro report --name=Ubuntu-1204-amd64:1:SpacewalkDefaultOrganization

you will see it created the distribution with hardcoded breed=redhat value. So we gonna fix this now:

cobbler distro edit --name Ubuntu-1204-amd64:1:SpacewalkDefaultOrganization --breed=ubuntu --os-version=jaunty --initrd=/var/distro-trees/ubuntu-12.0.4.5-amd64/install/initrd.gz --kernel=/var/distro-trees/ubuntu-12.0.4.5-amd64/install/vmlinuz

Now thats it! I can now netinstall from this.

If you want to use Ubuntu Kickstart and not Ubuntu Preseed, then you need to edit  /var/lib/tftpboot/pxelinux.cfg/default  and change the “append” line from “url=” to “ks=”
everytime you add/edit a kickstart profile !

    • drel
    • July 10th, 2015 2:33pm

    Hello,

    Can you clarify on which version of Spacewalk you have achieved a successful kickstart?

    I am running 2.3 and have several CentOS profiles, which work flawlessly, but following this guide gets me to a point where cobbler does not allow me to set –os-version to anything after jaunty. That leads to the installer refusing to accept the distribution as it expects jaunty string in the Release files. Changing the strings has no effect as the integrity check fails afterwards.

    Any help will be greatly appreciated.

    Thank you in advance.
    D

    • Thomas
    • July 29th, 2015 12:10pm

    Hi,
    I tried the above procedure to kickstart Ubuntu Trusty. Since I’m not allowed to use PXE (used by the Microsoft addicted group) and set up DHCP I need to built a cobbler ISO image to boot the client and install it. This is no problem with CentOS but it turned out to be a show stopper for Ubuntu.

    A “cobbler buildiso” crates an ISO image with my Ubuntu-Deskop profile in the menu. The kernel command line looks fine, so I tried to boot the machine and install it by using my spacewalk server. After a short while I noticed, that the network interface was not konfigured, so the kickstart file could not be loaded. I tried to install on a Dell Laptop, that simply needs the e1000e network driver. But this driver is not available in the initrd.gz (it was also not available un 12.04).

    So I tried to built a standalone ISO (cobbler buildiso –standalone –distro=Ubuntu-Trusty…).. That worked. The kickstart profile is included in the ISO. But also the whole server-kickstart tree is included. Therefore I’m not installing from the Spacewalk server but simply the Ubuntu server. At least, the network driver was found.

    Maybe I’m missing something (I’m quite sure I am). But my guess is: it’s not as easy as described in the (very helpful by the way) post above.

    So short version: Everything works as described. Kickstart does not seem to work.

    Thomas

    • Jack
    • May 20th, 2016 5:59pm

    I think you may have an error in your screen shot above the following text:

    “Now in Spacewalk got to Systems->Kickstart->Distributions and create a new one with Tree Path set to /var/distro-trees/ubuntu-12.0.4.5-amd64 and Base Channel set to your Ubuntu main channel.”

    Yet your screen shot shows

    “cp /tmp/centos/images/pxeboot/{initrd.img,vmlinuz} /var/distro-trees/images/pxeboot/”

    Should it not read

    “cp /tmp/centos/images/pxeboot/{initrd.img,vmlinuz} /var/distro-trees/ubuntu-12.0.4.5-amd64/”

      • phil
      • May 20th, 2016 6:34pm

      Its been quite a while and I cant look it up anymore (not using kickstarting) but afair my version should be correct.
      That part is only for spoofing Spacewalk to think its a CentOS image. But if its not working for you with my version but does with your version, you are likely right 😛
      So lemme know what actually worked and I’ll update the post 🙂

  1. No trackbacks yet.