Operating System - Linux
1827882 Members
1189 Online
109969 Solutions
New Discussion

/sbin/ifup: line 268: [: : integer expression expected

 
SOLVED
Go to solution
Maaz
Valued Contributor

/sbin/ifup: line 268: [: : integer expression expected

Hello Dear Gurus
OS of dhcp client: rhl 9
OS of dhcp server: rhl 9

cat /etc/sysconfig/network-scripts/ifcfg-eth0
DEVICE=eth0
ONBOOT=yes
BOOTPROTO=dhcp

#ifdown eth0; ifup eth0

Determinig Ip info for eth0... done.
/sbin/ifup: line 268: [: : integer expression expected
#

although dhcp clients gets all ip info from dhcp server suucesfuly, but the mesage "/sbin/ifup: line 268: [: : integer expression expected " seem odd to me.
I wana know what does this messege means ? is this an error/warning ?

Regards
Maaz
7 REPLIES 7
Alex Lavrov.
Honored Contributor

Re: /sbin/ifup: line 268: [: : integer expression expected

ifup is just a script, so there is some misconfiguration in your system that leads to this error in this script.

Can you please post here a few lines before and after line 268?
I don't give a damn for a man that can only spell a word one way. (M. Twain)
Stuart Browne
Honored Contributor
Solution

Re: /sbin/ifup: line 268: [: : integer expression expected

If it's up to date, it'll be something like this:

# DHCP likes to create duplicate routes. Fix that up.
NUMDEFROUTES=`ip -o route | \
grep "^default" | \
awk '{ nlines++ } END { print nlines }'`
if [ -n "$NUMDEFROUTES" -a "$NUMDEFROUTES" -gt 1 ]; then
# remove the default route for the new device (old route wins)
ip route del default dev ${DEVICE}
fi
# end dynamic device configuration

Which would mean that therere absolutely *NO* default routes, the '"$NUMDEFROUTES" -gt 1' section failed.

Why aren't there any default routes?

In any case, the fix is to alter the NUMDEFROUTES= line to:
NUMDEFROUTES=`ip -o route | \
grep "^default" | \
awk 'BEGIN { nlines = 0 } { nlines++ } END { print nlines }'`


This forces NUMDEFROUTES to have an interger value, regardless of whether there is or is not any default routes.
One long-haired git at your service...
Maaz
Valued Contributor

Re: /sbin/ifup: line 268: [: : integer expression expected

Thanks Alex, and Stuart, for the help.
I m at home, so i'll reply when i m at office.

Thanks
Maaz
Sergejs Svitnevs
Honored Contributor

Re: /sbin/ifup: line 268: [: : integer expression expected

Probably it is a bug. This message appears in the log file when there is no default route.
Check out the following link:
https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=102199

At first try to set default gw on your system.

Regards,
Sergejs
Gopi Sekar
Honored Contributor

Re: /sbin/ifup: line 268: [: : integer expression expected


It should work regardless of whether route information is given or not. have you done any manual editing of files in network-scripts directory.

better would be to re-run netconfig which will present you with a text based user interface for you to give network related information.

once it is configured restart network service by, service network restart, command.

And if you are still getting the error then go by other member´s reply of editing the file.


Regards,
Go
Never Never Never Giveup
Stuart Browne
Honored Contributor

Re: /sbin/ifup: line 268: [: : integer expression expected

As he's using DHCP, it's not his local network settings at fault.

It's the settings of the DHCP server, not forking over a 'router' (default route).
One long-haired git at your service...
Maaz
Valued Contributor

Re: /sbin/ifup: line 268: [: : integer expression expected

Thanks Dear Alex Lavrov, Stuart Browne, Sergejs Svitnevs, and Gopi Sekar for the help.

I folowed the instructions provided by Stuart Browne, and this "/sbin/ifup: line 268: [: : integer expression expected" message GONE. ;)

Solution:
--------
Either dhcp server provides Default Gateways ip, or if dhcp server doesnt provides the Gateways ip then edit the /sbin/ifup as Stuart has instruct, this mesage wont recieve ;)

Thanks to every1 a lot
Regards
Maaz