SVN-Update: Error in creating dhcpd.conf
-
@Sebastian-Roth thanks - I tried that but it is still showing me the error.
Setting up and starting DHCP Server…/lib/common/functions.sh: line 186: addr:192: syntax error in expression (error token is “:192”)
Failed!
I changed the lines and there are now only the IP-addresses -
@Oleg said:
I changed the lines and there are now only the IP-addresses
Which lines (in which file) do you mean?
-
@Oleg if you can update to the latest via SVN, the installer should now auto-correct these older settings types for the router and dns addresses in the .fogsettings file.
-
@Sebastian-Roth I mean the lines you told me in .fogsettings :
routeraddress="192.168.94.1"; ... dnsaddress="192.168.94.1";
@Wayne-Workman
The installer give me the same error and say!!! No router address found !!! !!! No dns address found !!!
My .fogsettings file is this now:
## Created by the FOG Installer ## Version: 6476 ## Install time: Fri 11 Dec 2015 12:19:03 PM CET ipaddress="192.168.94.111"; interface="eth0"; submask="255.255.255.0"; routeraddress="192.168.94.1"; plainrouter="192.168.94.1"; dnsaddress="192.168.94.1"; dnsbootimage="192.168.94.1"; password='XXXXX'; osid="2"; osname="Debian"; dodhcp="y"; bldhcp="1"; blexports="1"; installtype="N"; snmysqluser="" snmysqlpass='XXXXX'; snmysqlhost=""; installlang="1"; donate="0"; storageLocation="/images"; fogupdateloaded="1"; storageftpuser="fog"; storageftppass='XXXXX'; docroot="/var/www/html/"; webroot="fog/"; caCreated="yes"; startrange="192.168.94.97"; endrange="192.168.94.99"; bootfilename="undionly.kpxe"; packages="apache2 php5 php5-json php5-gd php5-cli php5-curl mysql-server mysql-client isc-dhcp-server tftpd-hpa tftp-hpa nfs-kernel-server vsftpd net-tools wget xinetd sys$ noTftpBuild='' notpxedefaultfile='' sslpath='/opt/fog/snapins/ssl/'
And when I start the installer everything seems ok because both entries are listed correctly:
... * DHCP router Address: 192.168.94.1 * DHCP DNS Address: 192.168.94.1
Thanks
-
@Oleg said:
Version: 6476
I think you may need to reset your trunk folder.
The version appears to be an indicator to me. Considering the warnings you saw above weren’t even introduced until sometime yesterday (well into the 6600 version numbers).
-
How can I reset the trunk folder?
Thanks -
@Oleg It’s easiest to just remove the current and recheck out. It sounds like other files have been being edited.
You could try running:
svn revert -R *
from the root of the trunk folder, but I still think starting fresh would be best. -
@Oleg said:
And when I start the installer everything seems ok because both entries are listed correctly:
If it’s fine now, don’t worry about it. Just update periodically (I update usually daily).
-
sorry but I completly removed FOG and try to install it again but it doesn’t work.
I get this error:* Setting up and starting DHCP Server.........................../lib/common/functions.sh: line 186: addr:192: syntax error in expression (error token is ":192") ../lib/common/functions.sh: line 288: let: octet4+=: syntax error: operand expected (error token is "+=") !!! No router address found !!! !!! No dns address found !!! Failed!
Thanks
-
I’m looking at this, looks like the
serverip
variable inside oflib/common/functions.sh
is never getting set for theconfigureDHCP
function.I’ve made a few adjustments to show this, along with the contents before/after for the router and dns stuff.
What’s most concerning is the
addr:
part in the output…serverip=addr:192.168.94.111
configureDHCP() { dots "Setting up and starting DHCP Server" case $bldhcp in 1) [[ -f $dhcpconfig ]] && cp -f $dhcpconfig ${dhcpconfig}.fogbackup echo "--------------------------------------" echo interface=$interface echo serverip=$serverip echo submask=$submask echo "---------------------------" serverip=$(ip addr show $interface | awk -F'[ /]' '/([0-9][0-9]?[0-9]?\.){3}([0-9][0-9]?[0-9]?){1}/ {print $6}') [[ -z $serverip ]] && serverip=$(/sbin/ifconfig $interface | awk '/inet[:]?.*(cast)/ {print $2}') [[ -z $serverip ]] && serverip=$(/sbin/ip -4 addr show $interface | awk -F'[ /]+' '/global/ {print $3}') [[ -z $submask ]] && submask=$(cidr2mask $(getCidr $interface)) echo "------------------------" echo serverip=$serverip echo "-------------------" network=$(mask2network $serverip $submask) [[ -z $startrange ]] && startrange=$(addToAddress $network 10) [[ -z $endrange ]] && endrange=$(subtract1fromAddress $(echo $(interface2broadcast $interface))) [[ -f $dhcpconfig ]] && dhcptouse=$dhcpconfig [[ -f $dhcpconfigother ]] && dhcptouse=$dhcpconfigother if [[ -z $dhcptouse || ! -f $dhcptouse ]]; then echo "Failed" echo "Could not find dhcp config file" exit 1 fi [[ -z $bootfilename ]] && bootfilename="undionly.kpxe" echo "# DHCP Server Configuration file\n#see /usr/share/doc/dhcp*/dhcpd.conf.sample" > $dhcptouse echo "# This file was created by FOG" >> "$dhcptouse" echo "#Definition of PXE-specific options" >> "$dhcptouse" echo "# Code 1: Multicast IP Address of bootfile" >> "$dhcptouse" echo "# Code 2: UDP Port that client should monitor for MTFTP Responses" >> "$dhcptouse" echo "# Code 3: UDP Port that MTFTP servers are using to listen for MTFTP requests" >> "$dhcptouse" echo "# Code 4: Number of seconds a client must listen for activity before trying" >> "$dhcptouse" echo "# to start a new MTFTP transfer" >> "$dhcptouse" echo "# Code 5: Number of seconds a client must listen before trying to restart" >> "$dhcptouse" echo "# a MTFTP transfer" >> "$dhcptouse" echo "option space PXE;" >> "$dhcptouse" echo "option PXE.mtftp-ip code 1 = ip-address;" >> "$dhcptouse" echo "option PXE.mtftp-cport code 2 = unsigned integer 16;" >> "$dhcptouse" echo "option PXE.mtftp-sport code 3 = unsigned integer 16;" >> "$dhcptouse" echo "option PXE.mtftp-tmout code 4 = unsigned integer 8;" >> "$dhcptouse" echo "option PXE.mtftp-delay code 5 = unsigned integer 8;" >> "$dhcptouse" echo "option arch code 93 = unsigned integer 16;" >> "$dhcptouse" echo "use-host-decl-names on;" >> "$dhcptouse" echo "ddns-update-style interim;" >> "$dhcptouse" echo "ignore client-updates;" >> "$dhcptouse"\ echo "next-server $ipaddress;" >> "$dhcptouse" echo "# Specify subnet of ether device you do NOT want service." >> "$dhcptouse" echo "# For systems with two or more ethernet devices." >> "$dhcptouse" echo "# subnet 136.165.0.0 netmask 255.255.0.0 {}" >> "$dhcptouse" echo "subnet $network netmask $submask{" >> "$dhcptouse" echo " option subnet-mask $submask;" >> "$dhcptouse" echo " range dynamic-bootp $startrange $endrange;" >> "$dhcptouse" echo " default-lease-time 21600;" >> "$dhcptouse" echo " max-lease-time 43200;" >> "$dhcptouse" echo "-----------------------------" echo dnsaddress=$dnsaddress echo routeraddress=$routeraddress echo "--------------------------------------" [[ ! $(validip $routeraddress) -eq 0 ]] && routeraddress=$(echo $routeraddress | grep -oE "\b([0-9]{1,3}\.){3}[0-9]{1,3}\b") [[ ! $(validip $dnsaddress) -eq 0 ]] && dnsaddress=$(echo $dnsaddress | grep -oE "\b([0-9]{1,3}\.){3}[0-9]{1,3}\b") [[ $(validip $routeraddress) -eq 0 ]] && echo " option routers $routeraddress;" >> "$dhcptouse" || echo " #option routers 0.0.0.0" >> "$dhcptouse" && echo " !!! No router address found !!!" [[ $(validip $dnsaddress) -eq 0 ]] && echo " option domain-name-servers $dnsaddress;" >> "$dhcptouse" || echo " #option routers 0.0.0.0" >> "$dhcptouse" && echo " !!! No dns address found !!!" echo "-----------------------------" echo dnsaddress=$dnsaddress echo routeraddress=$routeraddress echo "--------------------------------------" echo " class \"Legacy\" {" >> "$dhcptouse" echo " match if substring(option vendor-class-identifier, 0, 20) = \"PXEClient:Arch:00000\";" >> "$dhcptouse" echo " filename \"undionly.kkpxe\";" >> "$dhcptouse" echo " }" >> "$dhcptouse" echo " class \"UEFI-32-2\" {" >> "$dhcptouse" echo " match if substring(option vendor-class-identifier, 0, 20) = \"PXEClient:Arch:00002\";" >> "$dhcptouse" echo " filename \"i386-efi/ipxe.efi\";" >> "$dhcptouse" echo " }" >> "$dhcptouse" echo " class \"UEFI-32-1\" {" >> "$dhcptouse" echo " match if substring(option vendor-class-identifier, 0, 20) = \"PXEClient:Arch:00006\";" >> "$dhcptouse" echo " filename \"i386-efi/ipxe.efi\";" >> "$dhcptouse" echo " }" >> "$dhcptouse" echo " class \"UEFI-64-1\" {" >> "$dhcptouse" echo " match if substring(option vendor-class-identifier, 0, 20) = \"PXEClient:Arch:00007\";" >> "$dhcptouse" echo " filename \"ipxe.efi\";" >> "$dhcptouse" echo " }" >> "$dhcptouse" echo " class \"UEFI-64-2\" {" >> "$dhcptouse" echo " match if substring(option vendor-class-identifier, 0, 20) = \"PXEClient:Arch:00008\";" >> "$dhcptouse" echo " filename \"ipxe.efi\";" >> "$dhcptouse" echo " }" >> "$dhcptouse" echo " class \"UEFI-64-3\" {" >> "$dhcptouse" echo " match if substring(option vendor-class-identifier, 0, 20) = \"PXEClient:Arch:00009\";" >> "$dhcptouse" echo " filename \"ipxe.efi\";" >> "$dhcptouse" echo " }" >> "$dhcptouse" echo "}" >> "$dhcptouse" case $systemctl in yes) systemctl enable $dhcpd >>$workingdir/error_logs/fog_error_${version}.log 2>&1 systemctl stop $dhcpd >>$workingdir/error_logs/fog_error_${version}.log 2>&1 sleep 2 systemctl start $dhcpd >>$workingdir/error_logs/fog_error_${version}.log 2>&1 sleep 2 systemctl status $dhcpd >>$workingdir/error_logs/fog_error_${version}.log 2>&1 ;; *) case $osid in 1) chkconfig $dhcpd on >>$workingdir/error_logs/fog_error_${version}.log 2>&1 service $dhcpd stop >>$workingdir/error_logs/fog_error_${version}.log 2>&1 sleep 2 service $dhcpd start >>$workingdir/error_logs/fog_error_${version}.log 2>&1 sleep 2 service status $dhcpd >>$workingdir/error_logs/fog_error_${version}.log 2>&1 ;; 2) sysv-rc-conf $dhcpd on >>$workingdir/error_logs/fog_error_${version}.log 2>&1 /etc/init.d/$dhcpd stop >>$workingdir/error_logs/fog_error_${version}.log 2>&1 sleep 2 /etc/init.d/$dhcpd start >>$workingdir/error_logs/fog_error_${version}.log 2>&1 && sleep 2 ;; esac ;; esac errorStat $? ;; *) echo "Skipped" ;; esac }
This is the output:
* Creating auth pub key and cert..............................OK * Resetting SSL Permissions...................................OK * Setting up SSL FOG Server...................................OK * Restarting Apache2 for fog vhost............................OK * Changing permissions on apache log files....................OK * Backing up database.........................................OK * You still need to install/update your database schema. * This can be done by opening a web browser and going to: http://192.168.94.111/fog/management * Press [Enter] key when database is updated/installed. * Setting up storage..........................................OK * Setting up and starting DHCP Server.........................-------------------------------------- interface=eth0 serverip= submask=255.255.255.0 --------------------------- ------------------------ serverip=addr:192.168.94.111 ------------------- ../lib/common/functions.sh: line 186: addr:192: syntax error in expression (error token is ":192") ../lib/common/functions.sh: line 288: let: octet4+=: syntax error: operand expected (error token is "+=") ----------------------------- dnsaddress=192.168.94.1 routeraddress=192.168.94.1 -------------------------------------- !!! No router address found !!! !!! No dns address found !!! ----------------------------- dnsaddress=192.168.94.1 routeraddress=192.168.94.1 -------------------------------------- Failed!
-
@Wayne-Workman said:
ip addr show $interface | awk -F’[ /]’ ‘/([0-9][0-9]?[0-9]?.){3}([0-9][0-9]?[0-9]?){1}/ {print $6}’
Found a few issues with how the controls were in place and added elements to make corrections as needed. This should be fixed now.
-
Now it’s better - I still get the Info
* Setting up storage..........................................OK * Setting up and starting DHCP Server......................... !!! No router address found !!! !!! No dns address found !!! OK * Setting up and starting TFTP and PXE Servers................OK
but the script continues and everything seems to be ok.
-
@Oleg Can you please check to see if there is a Router/DNS address set inside of
/etc/dhcp/dhcpd.conf
? Also, what are the router and DNS values inside of/opt/fog/.fogsettings
now? -
@Wayne-Workman
yes in both files are the addresses set correctly -
@And if you re-run the installer, you should no longer get those messages
!!! No dns address found !!!
If you do not see those messages anymore, then this issue is resolved.
-
@Wayne-Workman I really don’t want to dissapoint you
I’ve updated now to the svn 6755 and still get the ! ! ! No router address found ! ! ! and ! ! ! No dns address found ! ! !
How I said before - the setup is complete and everything seems to work. I only get these two “warnings”Here is my .fogsettings:
## Start of FOG Settings ## Created by the FOG Installer ## Version: 6755 ## Install time: Sat 12 Mar 2016 05:58:49 PM CET ipaddress='192.168.94.111' interface='eth0' submask='255.255.255.0' routeraddress='192.168.94.1' plainrouter='192.168.94.1' dnsaddress='192.168.94.1' dnsbootimage='192.168.94.1' username='fog' password="XXXXXX" osid='2' osname='Debian' dodhcp='Y' bldhcp='1' blexports='1' installtype='N' snmysqluser='' snmysqlpass="" snmysqlhost='' installlang='' donate='0' storageLocation='/images' fogupdateloaded=1 docroot='/var/www/html/' webroot='fog/' caCreated='yes' startrange='192.168.94.60' endrange='192.168.94.99' bootfilename='undionly.kpxe' packages='apache2 php5 php5-json php5-gd.... noTftpBuild='' notpxedefaultfile='' sslpath='/opt/fog/snapins/ssl/' ## End of FOG Settings
And this is the dhcpd.conf:
... next-server 192.168.94.111; # Specify subnet of ether device you do NOT want service. # For systems with two or more ethernet devices. # subnet 136.165.0.0 netmask 255.255.0.0 {} subnet 192.168.94.0 netmask 255.255.255.0{ option subnet-mask 255.255.255.0; range dynamic-bootp 192.168.94.60 192.168.94.99; default-lease-time 21600; max-lease-time 43200; option routers 192.168.94.1; option domain-name-servers 192.168.94.1; ...
-
Confirmed, found, here is the fix:
diff --git a/lib/common/functions.sh b/lib/common/functions.sh index 5b3431d..15640c5 100755 --- a/lib/common/functions.sh +++ b/lib/common/functions.sh @@ -1834,8 +1834,8 @@ configureDHCP() { echo " max-lease-time 43200;" >> "$dhcptouse" [[ ! $(validip $routeraddress) -eq 0 ]] && routeraddress=$(echo $routeraddress | grep -oE "\b([0-9]{1,3}\.){3}[0-9]{1,3}\b") [[ ! $(validip $dnsaddress) -eq 0 ]] && dnsaddress=$(echo $dnsaddress | grep -oE "\b([0-9]{1,3}\.){3}[0-9]{1,3}\b") - [[ $(validip $routeraddress) -eq 0 ]] && echo " option routers $routeraddress;" >> "$dhcptouse" || echo " #option routers 0.0.0.0" >> "$dhcptouse" && echo " !!! No router address found !!!" - [[ $(validip $dnsaddress) -eq 0 ]] && echo " option domain-name-servers $dnsaddress;" >> "$dhcptouse" || echo " #option routers 0.0.0.0" >> "$dhcptouse" && echo " !!! No dns address found !!!" + [[ $(validip $routeraddress) -eq 0 ]] && echo " option routers $routeraddress;" >> "$dhcptouse" || ( echo " #option routers 0.0.0.0" >> "$dhcptouse" && echo " !!! No router address found !!!" ) + [[ $(validip $dnsaddress) -eq 0 ]] && echo " option domain-name-servers $dnsaddress;" >> "$dhcptouse" || ( echo " #option routers 0.0.0.0" >> "$dhcptouse" && echo " !!! No dns address found !!!" ) echo " class \"Legacy\" {" >> "$dhcptouse" echo " match if substring(option vendor-class-identifier, 0, 20) = \"PXEClient:Arch:00000\";" >> "$dhcptouse" echo " filename \"undionly.kkpxe\";" >> "$dhcptouse"
Sorry @Tom-Elliott for just posting this here but I don’t think this is worth a pull request…
-
@Sebastian-Roth That’s fine, but it doesn’t appear to have all the data.
-
Yeah, just noticed…updated my post. Essentially it’s just some brackets missing to make the logic work like it should
[[ ...]] && ... || ( ... && ...)
-
@Sebastian-Roth Added to the code and pushed.