Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 257638 - net-misc/dhcpcd-4.0.7 creates empty /etc/resolv.conf
Summary: net-misc/dhcpcd-4.0.7 creates empty /etc/resolv.conf
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: New packages (show other bugs)
Hardware: AMD64 Linux
: High normal (vote)
Assignee: Gentoo's Team for Core System packages
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-02-04 16:59 UTC by Ralph Sennhauser (RETIRED)
Modified: 2009-02-11 08:41 UTC (History)
3 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Ralph Sennhauser (RETIRED) gentoo-dev 2009-02-04 16:59:47 UTC
Dhcpcd-4.0.2 and dhcpcd-4.0.7 both create a empty (except for comments) /etc/resolv.conf, at least for me.

Last working non masked dhcpcd version is 4.0.1-r1. Didn't tried the masked ones as 4.0.1-r1 does it's job.

Looks like the same bug as Bug#: 239098

As the question may arise:
ps ax | grep dhcpcd
 2183 ?        Ss     0:00 /sbin/dhcpcd -h <hostname> -R -N -Y eth0
11747 pts/0    R+     0:00 grep --colour=auto dhcpcd


Reproducible: Always

Steps to Reproduce:
1. reboot
Actual Results:  
After reboot the /etc/resolv.conf is empty.

Expected Results:  
A working nameserver entry

# emerge --info
Portage 2.1.6.4 (default/linux/amd64/2008.0/desktop, gcc-4.1.2, glibc-2.6.1-r0, 2.6.27-gentoo-r8 x86_64)
=================================================================
System uname: Linux-2.6.27-gentoo-r8-x86_64-AMD_Athlon-tm-_64_Processor_3700+-with-glibc2.2.5
Timestamp of tree: Wed, 04 Feb 2009 08:25:01 +0000
app-shells/bash:     3.2_p39
dev-java/java-config: 1.3.7-r1, 2.1.6-r1
dev-lang/python:     2.5.2-r7
dev-python/pycrypto: 2.0.1-r6
dev-util/cmake:      2.4.8
sys-apps/baselayout: 1.12.11.1
sys-apps/sandbox:    1.2.18.1-r2
sys-devel/autoconf:  2.13, 2.63
sys-devel/automake:  1.5, 1.7.9-r1, 1.8.5-r3, 1.9.6-r2, 1.10.2
sys-devel/binutils:  2.18-r3
sys-devel/gcc-config: 1.4.0-r4
sys-devel/libtool:   1.5.26
virtual/os-headers:  2.6.27-r2
ACCEPT_KEYWORDS="amd64"
CBUILD="x86_64-pc-linux-gnu"
CFLAGS="-O2 -pipe -march=k8 -msse3"
CHOST="x86_64-pc-linux-gnu"
CONFIG_PROTECT="/etc /usr/kde/3.5/env /usr/kde/3.5/share/config /usr/kde/3.5/shutdown /usr/share/config /var/lib/hsqldb"
CONFIG_PROTECT_MASK="/etc/ca-certificates.conf /etc/env.d /etc/env.d/java/ /etc/fonts/fonts.conf /etc/gconf /etc/revdep-rebuild /etc/terminfo /etc/udev/rules.d"
CXXFLAGS="-O2 -pipe -march=k8 -msse3"
DISTDIR="/usr/portage/distfiles"
FEATURES="distlocks fixpackages parallel-fetch protect-owned sandbox sfperms strict stricter unmerge-orphans userfetch userpriv usersandbox"
GENTOO_MIRRORS="http://distfiles.gentoo.org http://distro.ibiblio.org/pub/linux/distributions/gentoo"
LANG="C"
LDFLAGS="-Wl,-O1"
LINGUAS="en de fr"
MAKEOPTS="-j2"
PKGDIR="/usr/portage/packages"
PORTAGE_RSYNC_OPTS="--recursive --links --safe-links --perms --times --compress --force --whole-file --delete --stats --timeout=180 --exclude=/distfiles --exclude=/local --exclude=/packages"
PORTAGE_TMPDIR="/var/tmp"
PORTDIR="/usr/portage"
PORTDIR_OVERLAY="/usr/portage/local/layman/enlightenment /usr/portage/local/layman/perl-experimental /usr/portage/local/sera"
SYNC="rsync://rsync.europe.gentoo.org/gentoo-portage"
USE="3dnow 3dnowext X a52 acl acpi alsa amd64 ao apache2 bash-completion berkdb bluetooth bonobo branding bzip2 cairo caps cdparanoia cdr clamav cli cracklib crypt cups curl dbus dga dri dts dvb dvd dvdr dvdread eds emboss encode esd fam ffmpeg firefox flac fortran ftp gdbm gif glut gnome gpm gstreamer gtk hal howl iconv imap imlib ipv6 isdnlog java jpeg jpeg2k kde ldap libedit libnotify lirc lm_sensors mad midi mikmod mime mmap mmx mmxext motif mp3 mpeg mpi mplayer mudflap multilib musepack mysql ncurses nls nocd nptl nptlonly ogg openal opengl openmp oss pam pcre pdf perl png portaudio posix ppds pppd prelude python qt3 qt3support qt4 quicktime readline reflection sdl session spell spl sqlite sse sse2 ssl ssse3 startup-notification svg sysfs syslog tcpd theora tiff tk truetype type1 unicode usb v4l2 vim-syntax vorbis wxwindows x264 xine xml xorg xulrunner xv xvid zlib" ALSA_CARDS="intel8x0" ALSA_PCM_PLUGINS="adpcm alaw asym copy dmix dshare dsnoop empty extplug file hooks iec958 ioplug ladspa lfloat linear meter mmap_emul mulaw multi null plug rate route share shm softvol" APACHE2_MODULES="actions alias auth_basic authn_alias authn_anon authn_dbm authn_default authn_file authz_dbm authz_default authz_groupfile authz_host authz_owner authz_user autoindex cache dav dav_fs dav_lock deflate dir disk_cache env expires ext_filter file_cache filter headers include info log_config logio mem_cache mime mime_magic negotiation rewrite setenvif speling status unique_id userdir usertrack vhost_alias" ELIBC="glibc" INPUT_DEVICES="evdev" KERNEL="linux" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" LINGUAS="en de fr" LIRC_DEVICES="devinput" USERLAND="GNU" VIDEO_CARDS="radeonhd"
Unset:  CPPFLAGS, CTARGET, EMERGE_DEFAULT_OPTS, FFLAGS, INSTALL_MASK, LC_ALL, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS
Comment 1 Rafał Mużyło 2009-02-05 06:27:04 UTC
For completion, see what 'dhcpcd -T eth0' prints for both versions.
Comment 2 Ralph Sennhauser (RETIRED) gentoo-dev 2009-02-05 10:56:39 UTC
(In reply to comment #1)
> For completion, see what 'dhcpcd -T eth0' prints for both versions.
> 
As I don't like rebooting this machine to often here a bit more info. Strange enough manually setting the gateway as nameserver in /etc/resolv.conf and /etc/init.d/net.eth0 restart works at least for 4.0.7.

dhcpcd 4.0.7:
$cat /etc/resolv.conf
# Generated by dhcpcd
# /etc/resolv.conf.head can replace this line
# /etc/resolv.conf.tail can replace this line

$ps ax | grep dhcpcd
 4339 ?        Ss     0:00 /sbin/dhcpcd -h <hostname> -R -N -Y eth0
 5173 pts/0    R+     0:00 grep --colour=auto dhcpcd

$ dhcpcd -T eth0
interface=eth0
metric=0
pid=5203
reason=TEST
new_broadcast_address=255.255.255.0
new_dhcp_lease_time=86400
new_dhcp_message_type=2
new_dhcp_server_identifier=192.168.1.1
new_domain_name_servers='195.186.4.108 195.186.1.108'
new_ip_address=192.168.1.102
new_network_number=192.168.1.0
new_routers=192.168.1.1
new_subnet_cidr=24
new_subnet_mask=255.255.255.0

dhcpcd 4.0.2:
$ cat /etc/resolv.conf
# Generated by dhcpcd
# /etc/resolv.conf.head can replace this line
# /etc/resolv.conf.tail can replace this line

$ ps ax | grep dhcpcd
 4336 ?        Ss     0:00 /sbin/dhcpcd -h <hostname> -R -N -Y eth0
 5204 pts/0    R+     0:00 grep --colour=auto dhcpcd

$ dhcpcd -T eth0
interface=eth0
metric=0
pid=5206
reason=TEST
new_broadcast_address=255.255.255.0
new_dhcp_lease_time=86400
new_dhcp_message_type=2
new_dhcp_server_identifier=192.168.1.1
new_domain_name_servers='195.186.4.108 195.186.1.108'
new_ip_address=192.168.1.102
new_network_number=192.168.1.0
new_routers=192.168.1.1
new_subnet_cidr=24
new_subnet_mask=255.255.255.0
Comment 3 Rafał Mużyło 2009-02-05 17:44:32 UTC
When I said "both versions" I meant "working and non-working".

And what was that about reboot ? Only thing needed to do that test
is reemerging.

Comment 4 Ralph Sennhauser (RETIRED) gentoo-dev 2009-02-05 19:46:31 UTC
(In reply to comment #3)
> When I said "both versions" I meant "working and non-working".
>
:-), could have guessed:

dhcpcd-4.0.1-r1 (working):

$ dhcpcd -T eth0
interface=eth0
metric=0
pid=473
reason=TEST
new_broadcast_address=255.255.255.0
new_dhcp_lease_time=86400
new_dhcp_message_type=2
new_dhcp_server_identifier=192.168.1.1
new_domain_name_servers='195.186.4.108 195.186.1.108'
new_ip_address=192.168.1.102
new_network_number=192.168.1.0
new_routers=192.168.1.1
new_subnet_cidr=24
new_subnet_mask=255.255.255.0

So nothing different.

> And what was that about reboot ? Only thing needed to do that test
> is reemerging.
> 

To problem arise only after a reboot. /etc/init.d/net.eth0 is not enough to clear the /etc/resolv.conf file.

I don't mind rebooting if there is a real benefit.
Comment 5 Roy Marples 2009-02-09 10:37:05 UTC
What are the comments in /etc/resolv.conf?
Do you have openresolv/resolvconf installed? (ls -l /sbin/resolvconf)
dhcpcd -R bge0 does NOT modify /etc/resolv.conf with dns data present, tested with dhcpcd-4.0.10

Some notes:
dhcpcd -T will print all DHCP variables requested wether it uses them or not
-R simply instructs dhcpcd-run-hooks to skip the resolv.conf hook, so -T will still show the dns variables.

If you remove the file /lib/dhcpcd/dhcpcd-hooks/20-resolv.conf does this fix the problem? Do you have any files in /lib/dhcpcd/dhcpcd-hooks that are not owned by the dhcpcd ebuild?
Comment 6 Ralph Sennhauser (RETIRED) gentoo-dev 2009-02-10 09:33:29 UTC
(In reply to comment #5)
> What are the comments in /etc/resolv.conf?

working and current produced by version 4.0.1-r1 from which I updated.

# Generated by dhcpcd from eth0
# /etc/resolv.conf.head can replace this line
nameserver 195.186.1.109
nameserver 195.186.4.109
# /etc/resolv.conf.tail can replace this line

> Do you have openresolv/resolvconf installed? (ls -l /sbin/resolvconf)

No, I havn't.

> dhcpcd -R bge0 does NOT modify /etc/resolv.conf with dns data present, tested
> with dhcpcd-4.0.10
> 
> Some notes:
> dhcpcd -T will print all DHCP variables requested wether it uses them or not
> -R simply instructs dhcpcd-run-hooks to skip the resolv.conf hook, so -T will
> still show the dns variables.
> 

I see.

> If you remove the file /lib/dhcpcd/dhcpcd-hooks/20-resolv.conf does this fix

version 4.0.2-r1 disappeared from the tree, so first of all I need to get back this ebuild somehow before doing anything, wasn't clever enough to copy it over to my overlay *headagainstwallbang*
Will give it a try then. Also with version 4.0.10 just to check whether the bug got magically fixed or still persists.

> the problem? Do you have any files in /lib/dhcpcd/dhcpcd-hooks that are not
> owned by the dhcpcd ebuild?
> 

All files currently in /lib/dhcpcd/dhcpd-hooks are owned by dhcpcd-4.0.2-r1. So I expect the update to clean up in there. For safety I will look again with every version.
Comment 7 Roy Marples 2009-02-10 11:30:18 UTC
http://sources.gentoo.org/viewcvs.py/gentoo-x86/net-misc/dhcpcd/dhcpcd-4.0.1-r1.ebuild?hideattic=0&view=markup

(In reply to comment #6)
> working and current produced by version 4.0.1-r1 from which I updated.
> 
> # Generated by dhcpcd from eth0
> # /etc/resolv.conf.head can replace this line
> nameserver 195.186.1.109
> nameserver 195.186.4.109
> # /etc/resolv.conf.tail can replace this line

Wait, so dhcpcd created that and yet you are asking dhcpcd NOT to replace it? hehe. Maybe you should explain why you feel the need to stop dhcpcd from modifying resolv.conf

> version 4.0.2-r1 disappeared from the tree, so first of all I need to get back
> this ebuild somehow before doing anything, wasn't clever enough to copy it over
> to my overlay *headagainstwallbang*

http://sources.gentoo.org/viewcvs.py/gentoo-x86/net-misc/dhcpcd/dhcpcd-4.0.1-r1.ebuild?hideattic=0&view=markup

There's the ebuild :)
Comment 8 Ralph Sennhauser (RETIRED) gentoo-dev 2009-02-10 13:22:35 UTC
(In reply to comment #7)

> Wait, so dhcpcd created that and yet you are asking dhcpcd NOT to replace it?
> hehe. Maybe you should explain why you feel the need to stop dhcpcd from
> modifying resolv.conf

No I want dhcpcd 4.0.7 to produce a similar /etc/resolv.conf as 4.0.1-r1 does. I can work around this however preventing dhcpcd from replacing a working /etc/resolv.conf isn't a proper fix for a stable package which worked up to now and is probably used by everyone new to gentoo as it's in the install documentation.

The correct behavior would be to write a working default resolve.conf (as the one generated by 4.0.1-r1) if there is none or there is one never touched by the user.

I would say it should do this overwrite as well as long as the user doesn't say otherwise in the init conf of dhcpcd or perhaps a flag in /etc/resolve.conf 

> 
> There's the ebuild :)
> 

Thanks. And you read read the 4.0.2-r1 correctly as 4.0.1-r1, my apologize.
Comment 9 Roy Marples 2009-02-10 14:27:03 UTC
So to sumarize - dhcpcd-4.0.2 and greater are not putting any DNS entries in /etc/resolv.conf even though you have new_domain_name_servers='195.186.4.108 195.186.1.108' listed. What is more, you only get this error after a reboot.

I'm guessing it's you due to having dhcpcd_*=-R" or dhcp_*="nodns" in /etc/conf.d/net.
#239098 is related only in the fact you were working around the issue which 4.0.2 fixes.
Infact, the only code changes from 4.0.1 -> 4.0.2 are related to lease times (which yours is not) and making the -R flag work.
Comment 10 Ralph Sennhauser (RETIRED) gentoo-dev 2009-02-10 19:22:46 UTC
(In reply to comment #9)
> So to sumarize - dhcpcd-4.0.2 and greater are not putting any DNS entries in
> /etc/resolv.conf even though you have new_domain_name_servers='195.186.4.108
> 195.186.1.108' listed. What is more, you only get this error after a reboot.
> 
> I'm guessing it's you due to having dhcpcd_*=-R" or dhcp_*="nodns" in
> /etc/conf.d/net.
> #239098 is related only in the fact you were working around the issue which
> 4.0.2 fixes.
> Infact, the only code changes from 4.0.1 -> 4.0.2 are related to lease times
> (which yours is not) and making the -R flag work.
> 

Almost true. There was a nodns flag in /etc/conf.d/net. Removing it solved the problem. So the bug can be closed from a technical viewpoint.
However /etc/conf.d/net was last modified a few years back when I've set this machine up for the first time closely following the Handbook.
Looking in the Handbook(x86) now it still says:

Code Listing 2.7: Automatically obtaining an IP address for eth0
config_eth0=( "dhcp" )
dhcp_eth0="nodns nontp nonis"

Definitively a trap and not a workaround. However it kept me safe until now.

Thanks a lot for your and the rest of the teams help. 

Comment 11 Roy Marples 2009-02-10 21:15:33 UTC
(In reply to comment #10)
> However /etc/conf.d/net was last modified a few years back when I've set this
> machine up for the first time closely following the Handbook.
> Looking in the Handbook(x86) now it still says:
> 
> Code Listing 2.7: Automatically obtaining an IP address for eth0
> config_eth0=( "dhcp" )
> dhcp_eth0="nodns nontp nonis"
> 
> Definitively a trap and not a workaround. However it kept me safe until now.
> 
> Thanks a lot for your and the rest of the teams help. 

When I wrote that part of the handbook, it sure didn't say that.
What it's doing is listing dhcp options you *could* use for all dhcp clients in portage, not options you *should* use. The handbook needs to be more clear here. My recommendation is to remove the line and let the DHCP client default work. If the user needs to modify the default behaviour of the DHCP client, then read the man page and act accordingly.
Comment 12 nm (RETIRED) gentoo-dev 2009-02-11 08:41:07 UTC
(In reply to comment #11)
> When I wrote that part of the handbook, it sure didn't say that.
> What it's doing is listing dhcp options you *could* use for all dhcp clients in
> portage, not options you *should* use. The handbook needs to be more clear
> here. My recommendation is to remove the line and let the DHCP client default
> work. If the user needs to modify the default behaviour of the DHCP client,
> then read the man page and act accordingly.

Done.