Red Hat Bugzilla – Bug 62156
ifup-post writes too many "search" lines in resolv.conf
Last modified: 2014-03-16 22:26:28 EDT
Description of Problem:
Upon execution, /etc/sysconfig/network-scripts/ifup-post will write a "search"
line in resolv.conf (if DOMAIN is defined in a ifcfg file, e.g. ifcfg-eth0)
for every line it will find in an existing resolv.conf file, plus 2 more times
at the end. 3 lines are misplaced in this file:
--- ifup-post.old Thu Mar 28 01:06:17 2002
+++ ifup-post.fixed Thu Mar 28 01:05:10 2002
@@ -62,10 +62,10 @@
echo "$answer" >> $tr
- if [ -n "$DOMAIN" ]; then
- echo "search $DOMAIN $search" >> $tr
+ if [ -n "$DOMAIN" ]; then
+ echo "search $DOMAIN $search" >> $tr
# backup resolv.conf
cp -af /etc/resolv.conf /etc/resolv.conf.save
The if statement above checks if DOMAIN is null, If not, it writes a "search"
line to the temporary resolv.conf it is compiling. The search line should be
perhaps a "domain" line (considering the DOMAIN variable), but anyway that's
not such a big issue.
Since this if statement is placed within the while loop, it is executed for
every line that is read from the existing /etc/resolv.conf, plus two more
times at the end (because EOF is echoed twice):
(cat /etc/resolv.conf ; echo EOF ; echo EOF) | while read answer ; do
if [ -n "$DOMAIN" ]; then
echo "search $DOMAIN $search" >> $tr
As shown above, it should be placed after the end of the loop.
That will fix this tiny little problem :)
Version-Release number of selected component (if applicable):
Closing bugs on older, no longer supported, releases. Apologies for any lack of
If this persists on a current release, such as Fedora Core 4, please open a new bug.