post installation section of the Kickstart file

Issues related to configuring your network
supertight
Posts: 92
Joined: 2017/02/07 21:47:51

post installation section of the Kickstart file

Postby supertight » 2017/09/03 07:10:34

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.

User avatar
jlehtone
Posts: 1798
Joined: 2007/12/11 08:17:33
Location: Finland

Re: post installation section of the Kickstart file

Postby jlehtone » 2017/09/03 09:41:12

Why does your initial network configuration in kickstart lead to a need to change things in postinstall?

hunter86_bg
Posts: 690
Joined: 2015/02/17 15:14:33
Location: Bulgaria
Contact:

Re: post installation section of the Kickstart file

Postby hunter86_bg » 2017/09/03 12:00:17

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.

User avatar
TrevorH
Forum Moderator
Posts: 20282
Joined: 2009/09/24 10:40:56
Location: Brighton, UK

Re: post installation section of the Kickstart file

Postby TrevorH » 2017/09/03 12:35:36

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.
CentOS 5 died in March 2017 - migrate NOW!
Full time Geek, part time moderator. Use the FAQ Luke

supertight
Posts: 92
Joined: 2017/02/07 21:47:51

Re: post installation section of the Kickstart file

Postby supertight » 2017/09/03 15:10:13

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$$".

supertight
Posts: 92
Joined: 2017/02/07 21:47:51

Re: post installation section of the Kickstart file

Postby supertight » 2017/09/03 15:12:00

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$$".

supertight
Posts: 92
Joined: 2017/02/07 21:47:51

Re: post installation section of the Kickstart file

Postby supertight » 2017/09/03 15:15:42

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

User avatar
TrevorH
Forum Moderator
Posts: 20282
Joined: 2009/09/24 10:40:56
Location: Brighton, UK

Re: post installation section of the Kickstart file

Postby TrevorH » 2017/09/03 15:22:01

Then you need to provide biosdevname=0 net.ifnames=0 on the kernel command line to the installer before it boots.
CentOS 5 died in March 2017 - migrate NOW!
Full time Geek, part time moderator. Use the FAQ Luke

aks
Posts: 2489
Joined: 2014/09/20 11:22:14

Re: post installation section of the Kickstart file

Postby aks » 2017/09/03 17:18:47

... of can't you "just" use ifrename ....
(part of wireless-tools, at least it's supposed to "keep up" with name changes).

supertight
Posts: 92
Joined: 2017/02/07 21:47:51

Re: post installation section of the Kickstart file

Postby supertight » 2017/09/04 16:30:08

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.


Return to “CentOS 7 - Networking Support”

Who is online

Users browsing this forum: No registered users and 2 guests