Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 164516 - net-dns/resolvconf-gentoo does not recover from destroyed /etc/resolv.conf link
Summary: net-dns/resolvconf-gentoo does not recover from destroyed /etc/resolv.conf link
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: New packages (show other bugs)
Hardware: All Linux
: High normal (vote)
Assignee: Christian Faulhammer (RETIRED)
URL:
Whiteboard:
Keywords:
Depends on: 201853
Blocks:
  Show dependency tree
 
Reported: 2007-01-30 09:59 UTC by Antti Mäkelä
Modified: 2008-09-02 21:21 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 Antti Mäkelä 2007-01-30 09:59:31 UTC
If an application destroys the 

lrwxrwxrwx 1 root root  26 Jan 30 10:32 resolv.conf -> resolvconf/run/resolv.conf

link, resolvconf does not recover from this. The link has to be manually re-created (ln -s resolvconf/run/resolv.conf) or DNS resolving does not work with any subsequent reboots or even when roaming from a wireless LAN to another.

This is apparently due to the following in /etc/resolvconf/update.d/libc:

[[ $(readlink /etc/resolv.conf 2>/dev/null) \
        != "resolvconf/run/resolv.conf" ]] && exit 0

So it's just an "exit 0" without any possibility to recover.

Anyway, my beef, specifically is with Cisco's vpn client (net-misc/cisco-vpnclient-3des). When I activate the VPN, this happens in /etc:

etc # ls -l res*
-rw-r--r-- 1 root root  34 Oct 12 15:08 reslisarc
-rw-r--r-- 1 root users 76 Jan 30 11:29 resolv.conf
lrwxrwxrwx 1 root root  26 Jan 30 10:32 resolv.conf.vpnbackup -> resolvconf/run/resolv.conf

If the VPN connection is terminated *gracefully* the client restores the original resolv.conf and nothing much happens. 

If stuff goes wrong, such as the WLAN (or PPP) interface suddendly going down the backup is not restored. I've actually had a kernel panic once when an interface went down. Granted, this kinds of ungraceful exiting is a Cisco-specific problem.

Anyway, I'm not sure if this resolv.conf-issue is something that only appears with Cisco-vpn, or is the scope wider (other VPN packages?). If not, the problem may be addressed with the ciscovpn-ebuild (if feasible). However, I'd still like to have some sort of recovery feature for this. Maybe some sort of RC option "FORCE_RESOLVCONF=1" or something that would *always* recreate the link and overwrite whatever is going on in there. 

However, just overwriting is not always an option. If I have a VPN connection and the files that are active are as above (backup and VPN-client-written resolv.conf), what happens when DHCP (on the underlying logical interface) renews the lease? The DNS information received from the VPN tunnel by the client is overwritten with the underlying iface's (eth0 or something) DNS information...

Anyway, Cc's set to people who I think are responsible for Ciscovpn package and resolvconf. Hopefully this gets resolved sometime.
Comment 1 Roy Marples (RETIRED) gentoo-dev 2007-01-30 14:34:31 UTC
(In reply to comment #0)
> If an application destroys the 
> 
> lrwxrwxrwx 1 root root  26 Jan 30 10:32 resolv.conf ->
> resolvconf/run/resolv.conf
> 
> link, resolvconf does not recover from this. The link has to be manually
> re-created (ln -s resolvconf/run/resolv.conf) or DNS resolving does not work
> with any subsequent reboots or even when roaming from a wireless LAN to
> another.
> 
> This is apparently due to the following in /etc/resolvconf/update.d/libc:
> 
> [[ $(readlink /etc/resolv.conf 2>/dev/null) \
>         != "resolvconf/run/resolv.conf" ]] && exit 0
> 
> So it's just an "exit 0" without any possibility to recover.

This is behaviour by design - if resolvconf isn't controlling /etc/resolv.conf then it won't do anything with the libc update script. Instead, each package should use resolvconf when available.

Packages converted to use resolvconf
baselayout
dhcpcd
dhclient
udhcpc
pump
openvpn

> However, just overwriting is not always an option. If I have a VPN connection
> and the files that are active are as above (backup and VPN-client-written
> resolv.conf), what happens when DHCP (on the underlying logical interface)
> renews the lease? The DNS information received from the VPN tunnel by the
> client is overwritten with the underlying iface's (eth0 or something) DNS
> information...

Exactly. Forcing a recreation of the link in resolvconf is pointless if resolvconf isn't used by everything in the chain.

http://www.fmepnet.org/debian_vpnc.html
Shows that Debian can use vpnc with resolvconf, so it can be done.

Reassigning as vpnc will have to be fixed, not resolvconf.
Comment 2 Antti Mäkelä 2007-01-30 15:02:26 UTC
(In reply to comment #1)
> This is behaviour by design - if resolvconf isn't controlling /etc/resolv.conf
> then it won't do anything with the libc update script. Instead, each package
> should use resolvconf when available.

  How about still creating the symlink, at least during boot, maybe in bootmisc or net.lo, even if not touching it later? 

  (Namely addressing the crash recovery thing...situations where resolvconf isn't controlling /etc/resolv.conf but so is nothing else, either... - so system should fall back to resolvconf. If at no other time, at least upon reboot it should be safe to assume that nothing else is controlling /etc/resolv.conf.)

  Hopefully the vpnc-specific stuff gets addressed too.
Comment 3 Chris Gianelloni (RETIRED) gentoo-dev 2007-01-31 15:17:05 UTC
Umm... vpnc != cisco-vpnclient-3des (which is not open source)...

There's absolutely nothing I can do for the cisco-vpnclient-3des package, which is the only thing I maintain.  While vpnc can be used to connect to Cisco VPN Concentrators (and PIX, etc), I don't have anything to do with that package.
Comment 4 Roy Marples (RETIRED) gentoo-dev 2007-01-31 16:55:58 UTC
We can't fix closed source stuff, but we can work with vpnc then.

Hanno, Debian support vpnc with resolvconf, so I suggest you grab their patch.
Comment 5 Antti Mäkelä 2007-01-31 21:35:12 UTC
Drat. I could switch to vpnc if it would work for me. However, according to vpnc homepage, it does not support certificates, which makes it kinda useless in any real environment (pre-shared keys are not really used in enterprise deployments - you kinda need to be able to at least authenticate the concentrator.). 

Oh well, I guess I'm stuck with Cisco - which kinda brings me back to comment #2 - could resolvconf somehow detect or at least assume in certain situations (such as during boot) that while resolvconf does not apparently control /etc/resolv.conf at the time due to bad or missing symlink, neither does anything else (since system is just starting up!). 

Oh well, I guess I'll just add the symlink creation/overwrite to local.start for the time being.
Comment 6 Roy Marples (RETIRED) gentoo-dev 2007-12-10 13:59:43 UTC
Ebuild on bug #201853 fixes this.
Comment 7 Christian Faulhammer (RETIRED) gentoo-dev 2008-06-03 16:09:33 UTC
Do the hook scripts for vpnc not solve your problem?  One can call resolvonf -u from there.
Comment 8 Antti Mäkelä 2008-08-30 08:17:00 UTC
(In reply to comment #7)
> Do the hook scripts for vpnc not solve your problem?  One can call resolvonf -u
> from there.

  Not really since cisco-vpnclient just alters resolv.conf without allowing any hooking. Anyway, fix in bug #228001 works for me.
Comment 9 Christian Faulhammer (RETIRED) gentoo-dev 2008-09-02 21:21:33 UTC
Closing this one, too.