openresolv-discuss

Re: Stuck On Trying to Get resolvconf to Update /etc/resolv.conf

Roy Marples

Thu Nov 16 09:49:38 2017

Hi Jeremy

On 16/11/2017 03:01, Jeremy Hansen wrote:
I'm struggling with what I feel should be something really simple. I am attempting to use resolvconf to update my resolv.conf when I connect to a VPN using openvpn. I have installed your script on Slackware 14.2 using the SlackBuild <https://slackbuilds.org/repository/14.2/network/openresolv/> available on https://slackbuilds.org, passing the OPENVPN=yes option to it so it will include a script (update-resolv-conf) to easily run your script when the VPN connection status changes. That script seems to be operating fine, but still wasn't updating my /etc/resolv.conf, so I tried running the commands normally.

I can get resolvconf to store the information for both devices (eth0 and tun0) and can verify it using resolvconf -l, however, I can't get it to update the /etc/resolv.conf. I feel like I'm missing something easy, but I can't find it.

I've tried variations of options, always including the -a tun0.inet, and then trying the -u to force updating all "subscribers", as well as both the -p and the -x options for private and exclusive. All seem to update resolvconf's info, verified using resolvconf -l, but nothing seems to update /etc/resolv.conf

As can be seen from my output below, my eth0 device is getting its address via dhcpcd.

root@craven-moorhead:~# cat /etc/resolv.conf
# Generated by dhcpcd from eth0.dhcp
# /etc/resolv.conf.head can replace this line
domain home
nameserver 10.0.0.1
# /etc/resolv.conf.tail can replace this line
root@craven-moorhead:~# resolvconf -l
# resolv.conf from eth0.dhcp
# Generated by dhcpcd from eth0.dhcp
domain home
search home
nameserver 10.0.0.1

root@craven-moorhead:~# echo "nameserver 8.8.8.8" | resolvconf -u -a tun0.inet
root@craven-moorhead:~# resolvconf -l
# resolv.conf from tun0.inet
nameserver 8.8.8.8

# resolv.conf from eth0.dhcp
# Generated by dhcpcd from eth0.dhcp
domain home
search home
nameserver 10.0.0.1

root@craven-moorhead:~# cat /etc/resolv.conf
# Generated by dhcpcd from eth0.dhcp
# /etc/resolv.conf.head can replace this line
domain home
nameserver 10.0.0.1
# /etc/resolv.conf.tail can replace this line

I'd appreciate any help you can provide with this, and I'd be happy to answer any questions you may have. Hopefully I'm just missing something obvious.

OK this is identical from another user report that was sent to me privately. He was also a slackware user.

We discovered two problems:
1)  There were no subscriber scripts installed to the correct directory
2)  resolvconf is not in $PATH handed to dhcpcd

You can verify 1 by viewing the resovlconf file itself and look for LIBEXCECDIR at the top. Here's mine:
$grep LIBEXECDIR $(which resolvconf) | head -n 1
LIBEXECDIR=/libexec/resolvconf
$ ls -l /libexec/resolvconf
total 44
-r--r--r--  1 root  wheel  5681 Oct  4 01:35 dnsmasq
-r--r--r--  1 root  wheel  6812 Oct  4 01:35 libc
-r--r--r--  1 root  wheel  3646 Oct  4 01:35 named
-r--r--r--  1 root  wheel  2988 Oct  4 01:35 unbound

2, we didn't actually solve, but we can prove it because the dhcpcd hook script 20-resolv.conf will only write
# /etc/resolv.conf.head can replace this line
if it thinks resolvconf is not installed.
If you want to help debug it, you can create an /etc/dhcpcd.enter-hook like so

$ cat /etc/dhcpcd.enter-hook
( echo $PATH; type resolvconf) > /tmp/dhcpcd.resolv.log
$ cat /tmp/dhcpcd.resolv.log
/sbin:/bin:/usr/sbin:/usr/bin
resolvconf is /sbin/resolvconf

resolvconf is normally installed into /sbin, so it's always available, but it looks like slack installs it to /usr/sbin - is /usr on /, or is it a separate partition? If so, that is a potential issue.

Roy

References:
Stuck On Trying to Get resolvconf to Update /etc/resolv.confJeremy Hansen
Archive administrator: postmaster@marples.name