openresolv-discuss

Re: openresolv enabled status

Petr Menšík

Fri Feb 05 14:44:37 2021

Thanks for quick reply.

Unfortunately such test would not work on Fedora, because resolvconf is
always present. It is linked to systemd by default.

lrwxrwxrwx. 1 root root 17 Dec 16 12:26 /usr/sbin/resolvconf ->
../bin/resolvectl

Because systemd-resolved does not have its own package, but is part of
systemd package, uninstallation is far from simple. It is usually just
disabled by command "systemctl disable systemd-resolved".

I used alternatives system as a workaround, resulting in:
$ ls -l /usr/sbin/resolvconf /etc/alternatives/resolvconf
lrwxrwxrwx. 1 root root 31 Feb  1 17:39 /etc/alternatives/resolvconf ->
/usr/sbin/resolvconf.openresolv
lrwxrwxrwx. 1 root root 28 Feb  1 17:39 /usr/sbin/resolvconf ->
/etc/alternatives/resolvconf

But that would mean, some resolvconf is always there. But not always
would be active.

Would it work, if I checked "resolvconf -i <dhcpiface> -a" command
result code? Would it emit non-zero return code, if resolvconf would be
deactivated?

 resolv="nameserver 1.2.3.4"
 r=255
 if [ -x /sbin/resolvconf ]; then
     echo "$resolv" | /sbin/resolvconf -a interface.foo
     r=$?
 if [ $r -ne 0 ]; then
     echo "$resolv" > /etc/resolv.conf
 fi

Would it be a good idea to use return code to (try to) rewrite
resolv.conf manually, if it failed?

Because there might be more types of resolvconf used, I would like
detection of activity, which should work for any resolvconf. I
understand it is solved different way on Debian. Maybe I should push for
non-existent resolvconf, when systemd-resolved is disabled.

Debian's resolvconf has --updates-are-enabled option, which seems to do,
what I am looking for. But openresolv does not support it, nor does
systemd. Is there similar alternative?

Regards,
Petr

On 2/2/21 3:08 PM, Roy Marples wrote:
> Hi Petr
> 
> On 02/02/2021 13:09, Petr Menšík wrote:
>> I am looking for simple way, how to check whether it is enabled.
> 
> ...
> 
>> I think dhclient or any VPN implementation should not try to parse
>> resolvconf.conf file. Is there good way I haven't spotted yet?
>> How is it used by existing software?
> 
> From an applications perspective such as Network Manager, dhcpcd or
> OpenVPN, there is no such check other than "does /sbin/resolvconf exist?"
> 
> resolv="nameserver 1.2.3.4"
> if [ -x /sbin/resolvconf ]; then
>     echo "$resolv" | /sbin/resolvconf -a interface.foo
> else
>     echo "$resolv" > /etc/resolv.conf
> fi
> 
> If resolvconf is present, it is assumed to be working.
> It's been like so ever since the original Debian implementation and I've
> not seen a good reason to change this.
> 
> To "disable" openresolv you either remove it or set
> resolv_conf_passthrough=YES in resolvconf.conf which has the same effect
> as just writing directly to /etc/resolv.conf
> 
> Roy
> 

-- 
Petr Menšík
Software Engineer
Red Hat, http://www.redhat.com/
email: pemensik@xxxxxxxxxx
PGP: DFCF908DB7C87E8E529925BC4931CA5B6C9FC5CB

Attachment: OpenPGP_signature
Description: OpenPGP digital signature


Follow-Ups:
Re: openresolv enabled statusRoy Marples
References:
openresolv enabled statusPetr Menšík
Re: openresolv enabled statusRoy Marples
Archive administrator: postmaster@marples.name