# SOLVED - Empty resolv.conf and no internet

## dpshak

This past weekend, I rebuilt my wifes' laptop because the harddrive was failing.  New install, using a minimal install CD, reboot the computer into the new install, emerge -uDav system and...FAIL!  Cannot resolve host, or whatever the error was.  

ifconfig?  Yup, network is up with an address.

ping local network?  Yup, that works.

ping Google?  Nope, 'unknown host www.google.com'

Probably because I had just followed the manual to install the system, I remembered the blurb about copying resolv.conf into the chroot to maintain internet connectivity, so I checked resolv.conf and it was EMPTY!?!

What goes on here?  /etc/conf.d/net is the same as it's always been.  (I back up certain config files to a different machine for just this reason.)

Because I had better things to do - namely, getting the machine to a usable state before I went to work - a quick and dirty fix was to add 'dhcp_wlan0="nodns"' to /etc/conf.d/net and manually populate resolv.conf.

Fast forward to today.  I made some changes to my kernel configuration on my desktop machine and rebooted into the new kernel.

```
 * Bringing up interface enp2s0

 *   dhcp ...

 *     Running dhcpcd ...

enp2s0: waiting for carrier

enp2s0: carrier acquired

DUID 00:00:00:00:00:00:00:00:00:00:00:00:00:00

enp2s0: IAID 00:00:00:00

enp2s0: rebinding lease of 192.168.1.100

enp2s0: leased 192.168.1.100 for 86400 seconds

enp2s0: adding route to 192.168.1.0/24

enp2s0: adding default route via 192.168.1.3

forked to background, child pid 3016

cat: /run/dhcpcd/resolv.conf.enp2s0.ipv4ll: No such file or directory                               [ ok ]

 *     received address 192.168.1.100/24                                                            [ ok ]

Main ~ #  * Mounting network filesystems ...
```

And, once again, the local network is up but I have no internet and, I have an empty resolv.conf file.

This 'cat: /run/dhcpcd/resolv.conf.enp2s0.ipv4ll' business is new and would seem to have something to do with my lack of internet connectivity.  My dhcpcd.conf hasn't changed and my /etc/conf.d/net hasn't changed.  Something HAS changed, and I don't know where to look to fix this!  Using 'dhcp_eth0="nodns"' is a workable fix on a wired, desktop machine; but it's NOT a good fix for a wireless, mobile, laptop.

Where do I go to fix this?

(BTW: I checked the networking section of the manual, and didn't find anything that seemed to address this topic, but that IS where I found the 'nodns' trick.Last edited by dpshak on Thu Jul 23, 2015 8:08 pm; edited 1 time in total

----------

## szatox

 :Laughing: 

it seems you have accidentaly enabled so called "predictable network interface names" or "problematic interface names". Udev renamed your device so option dhcp_wlan0="nodns" mathes non-existing device instead of your network interface so it's not applied anymore.

A hint on getting rid of it https://wiki.gentoo.org/wiki/Udev/Upgrade_Guide

 *Quote:*   

> The new Predictable Network Interface Names will be used by default, unless the kernel commandline contains the net.ifnames=0 parameter. (If the method of masking out the /etc/udev/rules.d/80-net-name-slot.rules file was used in the past be aware it will not work in v209 and newer releases.)

 

Also, if you want to protect some file making it really readonly, there is chattr command for that. "chattr +i <filename>" will protect it even against priviliged programs until flag is removed.

And the last hint... Fix your dhcp. This will save you the headache when letting your friend use your wifi.

----------

## dpshak

 *szatox wrote:*   

> 
> 
> it seems you have accidentaly enabled so called "predictable network interface names" or "problematic interface names". Udev renamed your device so option dhcp_wlan0="nodns" mathes non-existing device instead of your network interface so it's not applied anymore.

 

Oops!  I didn't mean to confuse...  I understand about the 'problematic interface names' so for example:

```
Main etc # cat /etc/conf.d/net

config_enp2s0="dhcp"

#config_eth0="dhcp"

dns_domain_lo="mydomain"
```

is the conf file for the box that generated the message in my first post.  The config_eth0 portion was in there for the initial install, before udev was updated.

 :Embarassed:   Oops again! When I pulled that file, the 'config_eth0' WASN'T commented out and, at least on this box, seems to be the cause of the problem.  Commenting out that line and restarting enp2s0 resulted in the expected behavior - and the 'run /dhcpcd/resolv.conf.enp2s0.ipv4ll' message disappeared.   :Embarassed: 

WELL ####!     :Surprised: 

After discovering that, I went back to the laptop and played around with it a little.  NOW, it's working fine!  Now, I only have the WiFi interface active.  I'm thinking that when I ran into the problem with the laptop, I had the NIC running to (quickly) download whatever and the WiFi active to test it...causing the problem...

Well, it appears the problem is solved!    :Rolling Eyes: 

----------

