Search code examples
linuxcentosredhatfedora

%pre section doesn't work in kickstart installation


During kickstart installation i try to configure network in %pre section but it doesn't work.

When i configure network in main body of kickstart file it works (as below):

firewall --disabled
network --device=ens3f1 --hostname=foo --bootproto=static --ip=10.xxx.xxx.xxx --netmask=255.255.255.224 --gateway=10.xxx.xxx.xxx --nameserver=10.xxx.xxx.xxx --ipv6=auto --activate

But when i use %pre as below, it doesn't work:

%include /tmp/network-include

%pre
NETWORKFILE="/tmp/network-include"
touch $NETWORKFILE

echo "network --device=ens3f1 --hostname=foo --bootproto=static --ip=10.xxx.xxx.xxx --netmask=255.255.255.224 --gateway=10.xxx.xxx.xxx --nameserver=10.xxx.xxx.xxx --ipv6=auto --activate" > $NETWORKFILE
%end

I don't know the reason. Maybe it's not allowed, or maybe i'm using an option in a wrong way.


Solution

  • Ok, if someone wants to make network work in %pre section of kickstart file, a runtime image should be added in ISO and inst.stage2 should point to that image.

    If I'm not wrong commands in kickstart's main body is taken in consideration in stage1. But the commands/scripts in %pre run in stage2. As the installer needs an image to pass from stage1 to stage2, network directions in %pre need a runtime image.