Page 1 of 1

post installation section of the Kickstart file

Posted: 2017/09/03 07:10:34
by supertight
I have the following code in the post installation section of my kickstart file.

Code: Select all

cat <<EOF >/etc/sysconfig/network-scripts/ifcfg-eth0
DEVICE=ethO
BOOTPROTO=dhcp
ONBOOT=yes
EOF

rm -f /etc/sysconfig/network-scripts/ifcfg-enp0s25
My entire kickstart file is working great, except these two items.
The goal is to remove the ifcfg-enp0s25 config file from /etc/sysconfig/netwrok-scripts/ folder and create a config file for the eth0 interface.
neither item is working.

Thanks for reading.

Re: post installation section of the Kickstart file

Posted: 2017/09/03 09:41:12
by jlehtone
Why does your initial network configuration in kickstart lead to a need to change things in postinstall?

Re: post installation section of the Kickstart file

Posted: 2017/09/03 12:00:17
by hunter86_bg
Have you checked that after instalation, you really have that eth0 device?
By default, RHEL7/CentOS7 uses the new naming convention and I have seen 'eth' devices only when using 'virtio' in qemu KVM machines.

Re: post installation section of the Kickstart file

Posted: 2017/09/03 12:35:36
by TrevorH
And if you're using the FAQ entry to change the naming convention back to the old one, then you should do that with the installer kernel too so you name your devices the same in the kickstart as they end up afterwards.

Re: post installation section of the Kickstart file

Posted: 2017/09/03 15:10:13
by supertight
jlehtone wrote:Why does your initial network configuration in kickstart lead to a need to change things in postinstall?
I want the old naming convention "eth$" vs "enp$s$$$$" or some other long combination. The interface name is changing under my current setup, but not creating a config file. There is however a config file for the old name "enp$s$$".

Re: post installation section of the Kickstart file

Posted: 2017/09/03 15:12:00
by supertight
hunter86_bg wrote:Have you checked that after instalation, you really have that eth0 device?
By default, RHEL7/CentOS7 uses the new naming convention and I have seen 'eth' devices only when using 'virtio' in qemu KVM machines.

Yes the scrip on my KS file does indeed change the interface name to "eth0". It's does not however create a config file "eth0". It creates the config file for "enp$s$$".

Re: post installation section of the Kickstart file

Posted: 2017/09/03 15:15:42
by supertight
TrevorH wrote:And if you're using the FAQ entry to change the naming convention back to the old one, then you should do that with the installer kernel too so you name your devices the same in the kickstart as they end up afterwards.
Here is my entire ks file. I don't know where the installer kernel is located here.

Code: Select all

#platform=x86, AMD64, or Intel EM64T
#version=DEVEL
# Install OS instead of upgrade
install
# Keyboard layouts
keyboard 'us'
# Root password
rootpw --iscrypted $1$D1mCjihx$ThW2CLJTbst4Aen0CoJTQ1
# Use network installation
url --url="http://172.16.1.11/7.3/os/x86_64"
# System language
lang en_US
# Firewall configuration
firewall --enabled --ssh
# System authorization information
auth  --useshadow  --passalgo=sha512 --enablemd5
# Use text mode install
text
# SELinux configuration
selinux --disabled
# Do not configure the X Window System
skipx

# Network information
network  --bootproto=dhcp --device=eth0 --onboot=yes
# Reboot after installation
reboot
# System timezone
timezone America/Los_Angeles
# System bootloader configuration
bootloader --location=mbr --driveorder=sda --append="crashkernel=auth rhgb"
# Clear the Master Boot Record
zerombr
# Partition clearing information
clearpart --all --initlabel
# Disk partitioning information
part / --asprimary --fstype="ext4" --grow --size=1
part swap --fstype="swap" --size=6144


# Package Selection
%packages --nobase --excludedocs
@core
-*firmware
-iscsi*
-fcoe*
-b43-openfwwf
kernel-firmware
-efibootmgr
-biosdevname
wget
sudo
perl
vim
samba
%end
%pre
%end
%post --log=/root/install-post.log
(
PATH=/bin:/sbin:/usr/bin:/usr/sbin
export PATH

) 2>&1 >/root/install-post-sh.log
EOF

echo "Updating YUM Repositories"
cd /etc/yum.repos.d
perl -npe '/mirrorlist=.*repo=os/ && s/^/#/' -i /etc/yum.repos.d/CentOS-Base.repo
perl -npe '/mirrorlist=.*repo=updates/ && s/^/#/' -i /etc/yum.repos.d/CentOS-Base.repo
perl -npe '/^#baseurl=.*\/os\// && s/^#//' -i CentOS-Base.repo
perl -npe '/^#baseurl=.*\/updates\// && s/^#//' -i CentOS-Base.repo
perl -npe '/^baseurl/ && s/mirror.centos.org/172.16.1.11/ext/v/' -i CentOS-Base.repo
EOF

echo "
[Login]
#NAutoVTs=6
#ReserveVT=6
#KillUserProcesses=no
#KillOnlyUsers=
#KillExcludeUsers=root
#InhibitDelayMaxSec=5
HandlePowerKey=poweroff
HandleSuspendKey=ignore
HandleHibernateKey=ignore
HandleLidSwitch=ignore
HandleLidSwitchDocked=ignore
#PowerKeyIgnoreInhibited=no
#SuspendKeyIgnoreInhibited=no
#HibernateKeyIgnoreInhibited=no
#LidSwitchIgnoreInhibited=yes
IdleAction=ignore
#IdleActionSec=30min
#RuntimeDirectorySize=10%
#RemoveIPC=no
" > /etc/systemd/logind.conf
EOF

sed -i 's/rhgb quiet/net.ifnames=0 biosdevname=0 ipv6.disable=1/' /etc/default/grub
  grub2-mkconfig -o /boot/grub2/grub.cfg
  if [ -d /boot/efi/EFI/redhat ]; then
    grub2-mkconfig -o /boot/efi/EFI/redhat/grub.cfg

cat <<EOF >/etc/sysconfig/network-scripts/ifcfg-eth0
DEVICE=ethO
BOOTPROTO=dhcp
ONBOOT=yes
EOF

rm -f /etc/sysconfig/network-scripts/ifcfg-enp0s25

%end

Re: post installation section of the Kickstart file

Posted: 2017/09/03 15:22:01
by TrevorH
Then you need to provide biosdevname=0 net.ifnames=0 on the kernel command line to the installer before it boots.

Re: post installation section of the Kickstart file

Posted: 2017/09/03 17:18:47
by aks
... of can't you "just" use ifrename ....
(part of wireless-tools, at least it's supposed to "keep up" with name changes).

Re: post installation section of the Kickstart file

Posted: 2017/09/04 16:30:08
by supertight
TrevorH wrote:Then you need to provide biosdevname=0 net.ifnames=0 on the kernel command line to the installer before it boots.

Thanks everyone for the reply's. My pxe boot server is up and running better than ever.