Kickstart - moving on from %pre?
I've used %pre to run a small script to change the IP address. That script appears to have run correctly, as the address is changed, but the system also isn't moving on with the install. I appended --erroronfail and --log=/mnt/sysimage/root/ks-pre.log That log file has been touched but is empty. I don't remember having to add anything in %pre to say, "OK, you're good, time to move on!" What do I need to do to have kickstart continue to run?
Responses
Instead of %pre use the following between install and %packages:
network --bootproto static --ip=1.2.3.1 --netmask=255.255.255.0 --gateway=1.2.3.1 --nameserver=1.2.3.2,1.2.3.3 --hostname server01.example.com --device=00:11:22:33:44:55
This will configure the interface and bring it up with the new config.
Copy the resolv.conf in %post --nochroot first:
%post --nochroot
exec < /dev/tty3 > /dev/tty3
#changing to VT 3 so that we can see whats going on....
/usr/bin/chvt 3
(
cp -va /etc/resolv.conf /mnt/sysimage/etc/resolv.conf
/usr/bin/chvt 1
) 2>&1 | tee /mnt/sysimage/root/install.postnochroot.log
%end
Later in %post you need the following to make the network config permanent:
%post
logger "Starting anaconda postinstall"
exec < /dev/tty3 > /dev/tty3
#changing to VT 3 so that we can see whats going on....
/usr/bin/chvt 3
(
# eth0 interface
real=`ip -o link | grep 00:11:22:33:44:55 | awk '{print $2;}' | sed s/:$//`
# ifcfg files are ignored by NM if their name contains colons so we convert colons to underscore
sanitized_real=$real
cat << EOF > /etc/sysconfig/network-scripts/ifcfg-$sanitized_real
BOOTPROTO="none"
IPADDR="1.2.3.4"
NETMASK="255.255.255.0"
GATEWAY="1.2.3.1"
DEVICE=$real
HWADDR="00:11:22:33:44:55"
ONBOOT=yes
PEERDNS=yes
PEERROUTES=yes
DNS1=1.2.3.2
DNS2=1.2.3.3
EOF
) 2>&1 | tee /root/install.post.log
exit 0
%end
Check the network option in Kickstart Syntax reference.
I hope it helps.
Franky
Welcome! Check out the Getting Started with Red Hat page for quick tours and guides for common tasks.
