Building a custom CentOS 7 kickstart disc, part 3

Note: this series of articles applies to CentOS 7; for CentOS 6, see
this series

Now that you’ve compiled your RPMs, you need to build a disk image from which to
perform the kickstart.

Create the repository

Install createrepo so that you can create a repository. If you’ve copied all the
RPMs to ~kickstart_build/all_rpms as suggested
earlier, just do this:

You need to build the repodata for your install disc. These files provide the
installer information about the available packages. On your build machine, you should
have already copied the repodata/comps.xml file
from the CentOS disc to ~/kickstart_build.
Use createrepo to build the repository

This will create a repodata directory under
~/kickstart_build/isolinux with the repository
data files in it.

Note: in CentOS 6, you had to use the contents of .discinfo to set
the baseurl (declare -x discinfo=head -1 .discinfo; createrepo -u "media://$discinfo" ...);
you don’t do this any more. In fact, if you do, your kickstart will bail out at some
point, saying something like “RepoError after 10 retries: Insufficient space in download
directory /run/install/repo/Packages”. It seems that having this media://
baseurl in the repo causes yum to try to update the repo on your DVD, which it can’t do,
since the filesystem is read-only and is technically full (thus the “insufficient space”
error message). I was stuck on this for a few hours before I stumbled across the fix.

Build the ISO

Install the genisoimage package so that you can create an ISO.

We’re finally ready to build the ISO image that we can burn to CD.

You should now have an ISO image in custom.iso.

Testing the ISO

Rather than spending the time to burn a DVD and perform a physical installation,
you can test the ISO using a virtual machine, which you can run under a program like

When the system (virtual or physical) boots up, you’ll see your standard CentOS
installation prompt. Before the countdown expires, hit ESC and type

Note that there have been substantial changes to the format of the value used with
the ks option in CentOS 7.

  • The new option is inst.ks instead of just ks,
    but ks will still work; use inst.ks for future-proofing
  • The new value has three parts; the first specifies that we want to install from
    a cdrom; the second specifies the device, and is technically optional (if you only
    have a single cdrom/dvd drive, the installer should use that). However, I
    have found that if you don’t specify /dev/cdrom, your kickstart installation
    will fail horribly, dropping to a dracut emergency shell with errors like
    /dev/root does not exist. And while you may find examples online that
    specify it as something like /dev/sr0, rest assured that this will not
    work — you must use /dev/cdrom. This cost me countless hours
    of experimentation and reading hundreds of forum posts and bug reports. This time
    is my gift to you.

If you specify the options correctly, your installation should proceed automatically.

Note that if you really want to make your kickstart easy, you can add an entry to
the isolinux/isolinux.cfg file like this:

This will put an entry into the boot menu so you can just select it to run your kickstart
without having to manually type the boot options.

Next steps

Now you have a working custom kickstart disc. To really take advantage of the power
of kickstart, you’ll most likely need a custom postinstallation script to configure the
system according to your specs. We’ll cover that in the next installment in this

Part 1
Part 2
Part 3 •
Part 4

Join the Conversation


  1. Thanks for the extensive guide. However there is an unclear point to me. What is kickstart and how it is used in this example ? The “kickstart” word appears many time but remains for me a mystery Could you point me to some documentation or a full example.

    1. (sorry for the delay — your post got caught in my spam filter)

      A kickstart is an automated installation method that RedHat developed. Essentially, you start the install, and you can walk away; all the package selections, network configuration, drive partitioning, etc. are preconfigured. So if you have a bunch of similar machines, you can kickstart them all in parallel and quickly bring up a bunch of systems.

      1. hi priebe,
        i have built the custom iso successfully. Thanks.
        But when i finished installation, i found one line in red “welcom … centos7” and progress bar at the bottom of screen. I’m tring to modify them and googling over and over again. There’s no standard or specific instructions to know them well. So Would you like to instruct me or enlighten me?
        Thanks. Looking forward to your reply: )

  2. Hi,

    append initrd=initrd.img inst.stage2=hd:LABEL=CentOSx207x20x86_64 inst.ks=cdrom:/dev/cdrom:/ks/ks.cfg

    This command does not work, it throws a dracut error /dev/root does not exists. Even the ISO is corrupted and the installation fails.
    Any help with that?


    1. I ran into similar issues when testing. See the bullet list under “Testing the ISO”. Maybe you need to tweak those arguments for your specific system…

      1. Testing with virtual box 4.1.12 I ran into similar issue too.

        I solved the issue by changing the storage setting of the virtual machine by setting the CD/DVD Drive to “IDE Primary master” and selecting the check box “Live CD/DVD”

        Thank to priebe for the hint.

  3. Hi Priebe,

    thanks for you comment. I got it to boot now and the system installs according to the kickstart file. The problem is now that when all is installed and i reboot the system the screen just stays blank. When i look into the anaconda log i can see that no grub/mbr is installed.

    Any idea?

    Thanks in advance

  4. Hi Guys,

    i finally figured out whats wrong, i got a working ISO now.

    1. The guide is missing all “\” in the code section so be careful with the commands and add the \ at the missing places
    2. does NOT copy all required rpms, the kernel part is completley missing, therefore the installation will NOT work!
    You have to resolve all kernel related dependencies manually!

    I hope this feedback helps someone in the future 🙂


    1. Thanks for pointing this out, Vavie. When I changed my CMS earlier this year, a lot of things broke in the transition. I will correct the missing backslashes.

      I will try to take a look at as well.

  5. Excellent post ! The detailed instructions proved to be invaluable.

    I got past the /dev/root issue, successfully, by changing the line
    append initrd=initrd.img inst.stage2=hd:LABEL=CentOSx207x20x86_64 inst.ks=cdrom:/dev/cdrom:/ks/ks.cfg


    append initrd=initrd.img inst.stage2=hd:LABEL=CentOS\x207\x20x86_64 inst.ks=cdrom:/dev/cdrom:/ks/ks.cfg

    i.e. I added a \ in front of each x20.

    However, on the reboot after installation, I get a blank screen with a stuck cursor.

    I did add the kernel-*x86-64 rpms in the Packages directory while building the ISO.
    I ran yumdownloader –resolve kernel to download and resolve dependencies.

    Any ideas on what I am doing wrong or how to troubleshoot further ?
    I did boot into “rescue installation” but don’t know what to look for.

    Any pointers will be greatly appreciated

    1. Tarang, it sounds as if your BIOS might be set to boot with UEFI and you installed an MBR bootloader or vice versa. Do you know if a regular unmodified CentOS installer leaves your machine unbootable as well?

      Try booting up and holding F8 or F11 (depends on hardware) to get a boot menu and see if your hard drive is listed twice, once as “make/model” and once as “UEFI (make/model)” and see if the fresh install will boot from either of those.

      Failing that, plunk your motherboard model along with a couple of words like “boot kickstart” into Google and you’ll likely find the info you need on the first page of results. The bootloader that gets installed is controlled by the bootloader line in the Kickstart file (ks.cfg).

    2. Hey Tarang,

      try to copy all rpms from the dvd into the Packages directory. The run the createrepo command again.
      That solved the blank screen problem for me


      1. hi Vavie,
        On VMware workstation8:
        i copy all rpms from centos7-minimal-1511.iso into the isolinux/Packages. Then i did like you said. It did work(no problem occurs). Then i burned the iso into USB and tried to install custom.iso in server or any other computers(not virtual machine). But i failed : (
        Is the kickstart or anaconda.cfg wrong ? Does the iso not meet physical machine basic requirements. Looking forward to your reply : )

  6. Thanks Mike
    I should have clarified that I am trying to boot up a VirtualBox VM with the custom ISO I created.
    I am able to create a new VM with a standard CentOS ISO. In fact, I used said VM to follow and execute the steps listed in the blog.

    In VirtualBox, when I press F12 on the custom ISO bootup, I see only 1 HDD listed.


  7. I can’t seem to use createrepo in building the repository info. I keep the error “must specify a directory to index” and it says usage : [options]

  8. How if I want to build as a new OS?
    So I can setup password root or installation media manually, but the installed packet application still automatically. Like remastering.

  9. Insufficient space in download directory /run/install/repo/Packages

    That was kicking my butt for so long until the 2nd or 3rd time I read this article! It was buried in a paragraph that I missed the first time(s) I read it.

    createrepo -u”media://head -1 /tmp/z/.discinfo” -g /tmp/my-custom.xml /tmp/z/

    createrepo -g /tmp/my-custom.xml /tmp/z/

    solved it for me.

    Thank you for writing this tutorial and including that insight!

Leave a comment

Your email address will not be published. Required fields are marked *