Bug 470928 - dhclient-script in dhcp-4.0.0-30 destroys /etc/ntp.conf and /etc/resolv.conf
Summary: dhclient-script in dhcp-4.0.0-30 destroys /etc/ntp.conf and /etc/resolv.conf
Keywords:
Status: CLOSED NEXTRELEASE
Alias: None
Product: Fedora
Classification: Fedora
Component: dhcp
Version: 10
Hardware: All
OS: Linux
medium
medium
Target Milestone: ---
Assignee: Dave Cantrell
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks: 471126
TreeView+ depends on / blocked
 
Reported: 2008-11-10 21:54 UTC by Sami Farin
Modified: 2009-05-03 18:16 UTC (History)
3 users (show)

Fixed In Version:
Clone Of:
Environment:
Last Closed: 2008-12-07 04:15:35 UTC
Type: ---
Embargoed:


Attachments (Terms of Use)

Description Sami Farin 2008-11-10 21:54:56 UTC
Description of problem:
dhcp-4.0.0-18 behaved when I had in /etc/sysconfig/network-scripts/ifcfg-eth0 :
DEVICE=eth0
ONBOOT=no
BOOTPROTO=dhcp
NOZEROCONF=yes
PEERDNS=no
PEERNTP=no
PEERNIS=no
PERSISTENT_DHCLIENT=yes
MTU=1472
IPV6TO4INIT=no
IPV6INIT=no

But dhcp-4.0.0-30 tries to be smart and overwrites them.

Version-Release number of selected component (if applicable):
4.0.0-30

How reproducible:
always

Steps to Reproduce:
1. ifup eth0
2.
3.
  
Actual results:
dhclient-script ignore PEERDNS and PEERNTP.

Expected results:
Not writing crap to my /etc/resolv.conf and /etc/ntp.conf .

Additional info:

Comment 1 Dave Cantrell 2008-11-10 22:10:23 UTC
I see what's happening here.  A change went in to the -24 release to suppress errors from source_config() in instances where ifcfg-DEVICE did not exist, but ${CONFIG} is not the full path to the ifcfg-DEVICE file. Here's the fix:

Index: dhclient-script
===================================================================
RCS file: /cvs/pkgs/rpms/dhcp/F-10/dhclient-script,v
retrieving revision 1.3
diff -u -p -r1.3 dhclient-script
--- dhclient-script	1 Oct 2008 22:38:30 -0000	1.3
+++ dhclient-script	10 Nov 2008 22:06:32 -0000
@@ -452,10 +452,7 @@ fi
 
 CONFIG="${interface}"
 need_config ${CONFIG}
-
-if [ -f "${CONFIG}" ]; then
-    source_config
-fi
+source_config >/dev/null 2>&1
 
 if [ -n "${new_subnet_mask}" ]; then
     new_prefix="$(ipcalc -p ${new_ip_address} ${new_subnet_mask} | cut -d '=' -f 2)"

Can you make this change locally to your /sbin/dhclient-script and test it out?

Comment 2 Sami Farin 2008-11-10 22:18:46 UTC
Did not help, unfortunately.

root     16124  0.0  0.0  16880   824 ?        Ss   Nov10   0:00 /sbin/dhclient -q -lf /var/lib/dhclient/dhclient-eth0.leases -pf /var/run/dhclient-eth0.pid eth0
[root@safari /sbin]# kill 16124
[root@safari /sbin]# cd /etc
[root@safari /etc]# chattr -i ntp.conf resolv.conf
[root@safari /etc]# l ntp.conf resolv.conf
-rw------- 1 root root  2559 2006-06-16 00:09:25.447898000 +0300 ntp.conf
-rw-r--r-- 1 root xuser   22 2008-11-10 23:33:26.026538779 +0200 resolv.conf
[root@safari /etc]# /sbin/dhclient -q -lf /var/lib/dhclient/dhclient-eth0.leases -pf /var/run/dhclient-eth0.pid eth0&
[2] 18386
[root@safari /etc]# l ntp.conf resolv.conf
-rw-r--r-- 1 root xuser 2726 2008-11-11 00:14:01.639538809 +0200 ntp.conf
-rw-r--r-- 1 root xuser  108 2008-11-11 00:14:01.597539991 +0200 resolv.conf

Comment 3 Dave Cantrell 2008-11-11 04:23:20 UTC
Can you try this patch:

Index: dhclient-script
===================================================================
RCS file: /cvs/pkgs/rpms/dhcp/F-10/dhclient-script,v
retrieving revision 1.3
diff -u -p -r1.3 dhclient-script
--- dhclient-script	1 Oct 2008 22:38:30 -0000	1.3
+++ dhclient-script	11 Nov 2008 04:20:53 -0000
@@ -451,10 +451,10 @@ if [ -f /etc/sysconfig/networking/networ
 fi
 
 CONFIG="${interface}"
-need_config ${CONFIG}
-
-if [ -f "${CONFIG}" ]; then
-    source_config
+if [ -d /etc/sysconfig/network-scripts ]; then
+    cd /etc/sysconfig/network-scripts
+    need_config ${CONFIG}
+    source_config >/dev/null 2>&1
 fi
 
 if [ -n "${new_subnet_mask}" ]; then

Comment 4 Sami Farin 2008-11-11 10:31:24 UTC
Now it works, my config files survived!  Thanks.

Comment 5 Dave Cantrell 2008-11-11 19:42:38 UTC
Thanks for helping with testing out the patches.  I will put this fix in to an update for F-10.  The update should be available when F-10 ships.

Comment 6 Sami Farin 2008-11-11 21:52:13 UTC
But when I reboot, it still tries to overwrite /etc/ntp.conf.

Comment 7 Fedora Update System 2008-11-22 16:46:10 UTC
dhcp-4.0.0-32.fc10 has been pushed to the Fedora 10 testing repository.  If problems still persist, please make note of it in this bug report.
 If you want to test the update, you can install it with 
 su -c 'yum --enablerepo=updates-testing update dhcp'.  You can provide feedback for this update here: http://admin.fedoraproject.org/updates/f10/FEDORA-2008-9915

Comment 8 Bug Zapper 2008-11-26 05:09:43 UTC
This bug appears to have been reported against 'rawhide' during the Fedora 10 development cycle.
Changing version to '10'.

More information and reason for this action is here:
http://fedoraproject.org/wiki/BugZappers/HouseKeeping

Comment 9 Fedora Update System 2008-12-07 04:15:26 UTC
dhcp-4.0.0-32.fc10 has been pushed to the Fedora 10 stable repository.  If problems still persist, please make note of it in this bug report.


Note You need to log in before you can comment on or make changes to this bug.