I have a kickstart file which I want to use for machines with different numbers of network interfaces. When I have a KS file with multiple network clauses for multiple interfaces, anaconda refuses to run it on a machine with fewer network interfaces than that, because the higher-numbered interfaces are not found.

What I would like to do is have network clauses for the higher numbered network interfaces which are applied when those interfaces are present, but silently dropped if there is no such interface.

Is there a way to express that in a kickstart file?


Do you run Kickstart over HTTP? You can manage your Kickstart file as a PHP script and pass it the number of Ethernet interfaces as an argument. Then, in the script you can use conditional statements to either echo the configuration or not based on this. It would like something like this:

header(“Content-type: text/plain”);
if (!isset($_GET[‘ethcount’])) $ethcount = “1”;
else $ethcount = $_GET[‘ethcount’];
network --device=eth0 --bootproto=dhcp ...etc
if ($ethcount == “2”) {
echo “network --device=eth1 --bootproto=dhcp ...etc”

Then, when you call your Kickstart script, you specify the count.


Note, I've set a default value to 1 if it's not defined in the URL it would default to eth0 only.


The options are limitless. I use this for the CPU architecture, distribution, the load (Gnome or headless), etc...


As you can find in the mailing list post, there is another option:

You can use a pre script to detect if is previously partitioned or not and then use something similar to:


Discover condition

if condition;
    echo "part /boot --fstype ext3 --size=100 -- >> /tmp/part-include
    echo "part pv.100000 --size=1 --grow -- >>  /tmp/part-include
    echo "volgroup Merca --pesize=32768 pv.100000" >> /tmp/part-include
    echo "logvol swap --fstype swap --name=Swap --vgname=Merca --size=2047" >> /tmp/part-include
    echo "logvol  / --fstype ext4 --name=root --vgname=Merca --size=2048" >> /tmp/part-include
    echo "logvol /home --fstype ext4 --size=1000 --name=home --vgname=Merca" >> /tmp/part-include
    echo "part /boot --fstype ext3 --size=100 -- >> /tmp/part-include
    echo "volgroup Merca --pesize=32768 --useexisting --noformat" >> /tmp/part-include
    echo "logvol swap --fstype swap --name=Swap --vgname=Merca --size=2047 --useexisting --noformat" >> /tmp/part-include
    echo "logvol  / --fstype ext4 --name=root --vgname=Merca --size=2048 --useexisting --noformat" >> /tmp/part-include
    echo "logvol /home --fstype ext4 --size=1000 --name=home --vgname=Merca --useexisting --noformat" >> /tmp/part-include

Later in the partitioning section use %include /tmp/part-include

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.