View Issue Details

IDProjectCategoryView StatusLast Update
0018107CentOS-8dhcppublic2021-03-16 18:37
Reporterfoonyx Assigned To 
PriorityimmediateSeveritymajorReproducibilityunable to reproduce
Status newResolutionopen 
PlatformVMWAREOSCentOS 8OS Version8
Product Version8.3.2011 
Summary0018107: Job for dhcpd.service failed because the control process exited with error code. See "systemctl status dhcpd.service" and "journ
DescriptionI was setting up a PXE boot environment and to do that I have to manually edit my dhcpd.conf file.
Here is what I edited.
#
# DHCP Server Configuration file.
# see /usr/share/doc/dhcp-server/dhcpd.conf.example
# see dhcpd.conf(5) man page
#

allow booting;
allow bootp;

set vendorclass = option vendor-class-identifier;
option pxe-system-type code 93 = unsigned integer 16;
set pxetype = option pxe-system-type;
option space pxelinux;
option pxelinux.magic code 208 = string;
option pxelinux.configfile code 209 = text;
option pxelinux.pathprefix code 210 = text;
option pxelinux.reboottime code 211 = unsigned integer 32;
#option architecture-type code 93 = unsigned integer 16;


subnet 192.168.80.0 netmask 255.255.255.0 {
 

  option routers 192.168.80.1;
  range 192.168.80.190 192.168.80.200;
  default-lease-time 14400;
  max-lease-time 28800;
  if substring(vendorclass, 0, 9)="PXEClient" {
    next-server 192.168.80.128;
        filename "pxelinux/pxelinux.0";
    }
  }
}

this is my dhcpd.conf file


Steps To ReproduceI tried restarting netowrkmanager
I tried running my exp3.sh file which i create to make a pxeboot environment by configuring tftp and dhcp
Additional Informationoutput when checking status of dhcp service

dhcpd.service - DHCPv4 Server Daemon
   Loaded: loaded (/usr/lib/systemd/system/dhcpd.service; enabled; vendor preset: disabled)
   Active: failed (Result: exit-code) since Tue 2021-03-16 10:46:11 PDT; 21s ago
     Docs: man:dhcpd(8)
           man:dhcpd.conf(5)
  Process: 7289 ExecStart=/usr/sbin/dhcpd -f -cf /etc/dhcp/dhcpd.conf -user dhcpd -group dhcpd --no-pid $DHCPDARGS (code=exited, status=1/FAILURE)
 Main PID: 7289 (code=exited, status=1/FAILURE)

Mar 16 10:46:11 localhost.localdomain dhcpd[7289]: have been made to the base software release in order to make
Mar 16 10:46:11 localhost.localdomain dhcpd[7289]: it work better with this distribution.
Mar 16 10:46:11 localhost.localdomain dhcpd[7289]:
Mar 16 10:46:11 localhost.localdomain dhcpd[7289]: Please report issues with this software via:
Mar 16 10:46:11 localhost.localdomain dhcpd[7289]: https://bugs.centos.org/
Mar 16 10:46:11 localhost.localdomain dhcpd[7289]:
Mar 16 10:46:11 localhost.localdomain dhcpd[7289]: exiting.
Mar 16 10:46:11 localhost.localdomain systemd[1]: dhcpd.service: Main process exited, code=exited, status=1/FAILURE
Mar 16 10:46:11 localhost.localdomain systemd[1]: dhcpd.service: Failed with result 'exit-code'.
Mar 16 10:46:11 localhost.localdomain systemd[1]: Failed to start DHCPv4 Server Daemon.
~
Tags#centos8 #dhcpv4 #dhcp.service #dhcpd.conf

Activities

foonyx

foonyx

2021-03-16 18:37

reporter  

exp3.sh (8,027 bytes)   
#!/bin/bash
#experiment 3, Kindly run this script as superuser
#create tmp_directory
mkdir -p /tmp_directory

#move all repo files from /etc/yum.repos.d to /tmp_directory
mv /etc/yum.repos.d/*.repo /tmp_directory/

#setup local repository
#do not mount if u r using a vm. Just add iso in cd/dvd of vm settings and it will have 
#its location as /run/media/CentOS_Automation/CentOS-8-1-1911-x86_64-dvd
# use this instead of /media
#define it under a variable like
media="/run/media/CentOS_Automation/CentOS-8-1-1911-x86_64-dvd"
#then use it like cd $media

mkdir -p /centos8_kickstart_configs
#no need to mount cause In vmware it is mounted from host
# mount /dev/sr0 $media
mkdir -p /centos8_distro
cp -ar $media/. /centos8_distro
echo "[centos_base]" >> /etc/yum.repos.d/centos.repo
echo "name=centos base os local repository" >> /etc/yum.repos.d/centos.repo
echo "baseurl=file:///centos8_distro/BaseOS/" >> /etc/yum.repos.d/centos.repo
echo "enabled=1" >> /etc/yum.repos.d/centos.repo
echo "gpgcheck=0" >> /etc/yum.repos.d/centos.repo
echo "[centos_appstream]" >> /etc/yum.repos.d/centos.repo
echo "name= centos appstream local repository" >> /etc/yum.repos.d/centos.repo
echo "baseurl=file:///centos8_distro/AppStream/" >> /etc/yum.repos.d/centos.repo
echo "enabled=1" >> /etc/yum.repos.d/centos.repo
echo "gpgcheck=0" >> /etc/yum.repos.d/centos.repo
yum clean all
yum repolist all

#Install the required software package

#Installation of tftp, xinetd servers#
yum install -y tftp tftp-server* xinetd*
systemctl enable tftp
systemctl start tftp
#systemctl status tftp
systemctl enable xinetd
systemctl start xinetd
#systemctl status xinetd

firewall-cmd --add-service tftp
firewall-cmd --add-service tftp --permanent 

#Setup PXE Boot Environment

#copy syslinux package to /var/lib/tftpboot/pxelinux
#assuming /dev/sr0 is mounted onto media 
#get syslinux rpm
# remember that to check if $ can be used in single quotes or double quotes
syslinux_rpm=`ls $media/BaseOS/Packages/syslinux-tftpboot*`
rpm2cpio $syslinux_rpm | cpio -dim
cp -r tftpboot /tmp_directory/
mkdir /var/lib/tftpboot/pxelinux
cp /tmp_directory/tftpboot/pxelinux.0 /var/lib/tftpboot/pxelinux
cp /tmp_directory/tftpboot/menu.c32 /var/lib/tftpboot/pxelinux
cp /tmp_directory/tftpboot/ldlinux.c32 /var/lib/tftpboot/pxelinux
cp /tmp_directory/tftpboot/libutil.c32 /var/lib/tftpboot/pxelinux

# 
mkdir /var/lib/tftpboot/pxelinux/pxelinux.cfg

#copy boot images 

mkdir -p /var/lib/tftpboot/pxelinux/centos8/
cp $media/images/pxeboot/{vmlinuz,initrd.img} /var/lib/tftpboot/pxelinux/centos8/

#Install and enable PXE enabled DHCP server

#Insatllation of DHCP server

yum install -y dhcp-server

#extract required information from configuration file
net_device=`nmcli con show | grep ens33 | awk '{print $4}'`
net_device_config=`echo /etc/sysconfig/network-scripts/ifcfg-$net_device`
ip_addr0=`cat $net_device_config | grep IPADDR`
ip_addr1=`echo $ip_addr0 | cut -d "=" -f2 | sed 's/"//g'`
first_octate=`echo $ip_addr1 | cut -d "=" -f2 | cut -d "." -f1`
second_octate=`echo $ip_addr1 | cut -d "=" -f2 | cut -d "." -f2`
third_octate=`echo $ip_addr1 | cut -d "=" -f2 | cut -d "." -f3`
subnet0="$first_octate.$second_octate.$third_octate"
router0="$subnet0.1"
range1="$subnet0.190"
range2="$subnet0.200"
SUBNET="$subnet0.0"
#

#configuration of dhcp-server

cd /etc/dhcp
echo 'option space pxelinux;' >> dhcpd.conf
echo 'option pxelinux.magic code 208 = string;' >> dhcpd.conf
echo 'option pxelinux.configfile code 209 = text;' >> dhcpd.conf
echo 'option pxelinux.pathprefix code 210 = text;' >> dhcpd.conf
echo 'option pxelinux.reboottime code 211 = unsigned integer 32;' >> dhcpd.conf
echo 'option architecture-type code 93 = unsigned integer 16;' >> dhcpd.conf
echo "subnet $SUBNET netmask 2555.255.255.0 {" >> dhcpd.conf
echo "option routers $router0;" >> dhcpd.conf
echo "range $range1 $range2;" >> dhcpd.conf
echo "option subnet-mask 255.255.255.0" >> dhcpd.conf
echo 'class "pxeclients" {' >> dhcpd.conf
echo '	match if substring (option vendor-class-identifier, 0, 9) =' >> dhcpd.conf
echo '"PXEClient";' >> dhcpd.conf
echo "	next-server $ip_addr1;" >> dhcpd.conf
echo ' filename "pxelinux/pxelinux.0";' >> dhcpd.conf
echo '	}' >>dhcpd.conf
echo '}' >> dhcpd.conf

#install nfs-utils package
yum install -y nfs-utils

#enable and start nfs server 
systemctl enable nfs-server rpcbind
systemctl start nfs-server rpcbind

#Add centos8_distro to NFS shares. Provide readonly permisison
echo "/centos8_distro *(ro)" >> /etc/exports
# reload exportsfs filesystem
exportfs -r

#Configure PXE boot menu

#configuration of pxelinux.cfg/default
cd /var/lib/tftpboot/pxelinux/pxelinux.cfg
echo "default menu.c32" > default
echo "prompt 0" >> default
echo "timeout 600" >> default
echo "display boot.msg" >> default
echo "label linux_nfs" >> default
echo "	menu label ^Install rhel system from NFS source" >> default 
echo "	kernal centos8/vmlinuz" >> default
# Error might occur below 
echo "	append initrd=centos/initrd.img 
inst.ks=nfs://$ip_addr1/centos8_kickstart_configs/centos8_kickstart_install_nfs 
inst.repo=nfs://$ip_addr1/centos8_distro" >> default

#Create automated kickstart configuartion file

#create /centos_kickstart_configs folder
mkdir -p /centos_kickstart_configs

#change the directory to /centos_kickstart_configs folder
cd /centos8_kickstart_configs
echo "#version=RHEL8" >> centos8_kickstart_install_nfs
echo "ignoredisk --only-use=sda" >> centos8_kickstart_install_nfs
echo "# Partition clearing information" >> centos8_kickstart_install_nfs
echo "clearpart --none -initlabel" >> centos8_kickstart_install_nfs
echo "# System bootlaoder configuration" >> centos8_kickstart_install_http
echo "bootloader --location=mbr --boot-drive=sda" >> centos8_kickstart_install_http
echo "# Clear Master Boot Record" >> centos8_kickstart_install_http
echo "zerombr" >> centos8_kickstart_install_http
echo "# Partition Clearing Information" >> centos8_kickstart_install_http
echo "# Disk partitioning information" >> centos8_kickstart_install_http
#replace " to '
echo 'autopart --type=plain --fstype="xfs"' >> centos8_kickstart_install_http
echo "#Use graphical install" >> centos8_kickstart_install_nfs
echo "graphical" >> centos8_kickstart_install_nfs
echo "#Use NFS installation media" >> centos8_kickstart_install_nfs
echo "nfs --server=$ip_addr1 --dir=/centos8_distro/" >> centos8_kickstart_install_nfs
echo "#keyboard layouts" >> centos8_kickstart_install_nfs
echo "keyboard --vckeymap=us --xlayout='us'" >> centos_kickstart_install_nfs
echo "#system language" >> centos8_kickstart_install_nfs
echo "lang en_US.UTF-8" >> centos8_kickstart_install_nfs
echo "#Network information" >> centos8_kickstart_install_nfs
echo "network --bootproto=dhcp --device=ens33 --ipv6=auto --activate" >> centos8_kickstart_install_nfs
echo "network --hostname=localhost.localdomain" >> centos8_kickstart_install_nfs
echo "#root password" >> centos8_kickstart_install_nfs
#replaced " to '
echo 'rootpw --iscrypted $1$T71kt3wR$0ck/7BosKqQ8ceHrWXyxw0' >> centos8_kickstart_install_nfs
echo "#Run Setup agent on first boot" >> centos8_kickstart_install_nfs
echo "firstboot --enable" >> centos8_kickstart_install_nfs
echo "#do not configure X Window System" >> centos8_kickstart_install_nfs
echo "skipx" >> centos8_kickstart_install_nfs
echo "#System timezone" >> centos8_kickstart_install_nfs
echo "timezone Asia/Kolkata --isUtc" >> centos8_kickstart_install_nfs
echo "%packages" >> centos8_kickstart_install_nfs
echo "@^minimal-environment" >> centos8_kickstart_install_nfs
echo "kexec-tools" >> centos8_kickstart_install_nfs
echo "%end" >> centos8_kickstart_install_nfs

#Start tftp service and dhcpd service 
#start tftp service 
systemctl enable tftp
systemctl restart tftp

#start dhcp service 

systemctl enable dhcpd
systemctl start dhcpd

#CleanUp temp files created by the above steps.

#restore repp files to /etc/yum.repos.d/

cd /etc/yum.repos.d/
mv /tmp_directory/*.repo .

#clean up /tmp_directory directory

cd /
rm -rf /tmp_directory/

#End of Exercise



exp3.sh (8,027 bytes)   

Issue History

Date Modified Username Field Change
2021-03-16 18:37 foonyx New Issue
2021-03-16 18:37 foonyx Tag Attached: #centos8 #dhcpv4 #dhcp.service #dhcpd.conf
2021-03-16 18:37 foonyx File Added: exp3.sh