[Bug 933566] Re: Stopping resolvconf doesn't disable updates

Thomas Hood 933566 at bugs.launchpad.net
Sun Feb 19 16:03:57 UTC 2012


Upstart sees resolvconf as a persistent job and keeps track of its
state, running or stopped.  One significance of this is that Upstart
won't start resolvconf if it is already "running" or stop it if it is
already "stopped".

The part of resolvconf that conforms to this model is the enabling and
disabling of updates.  We want to make use of this at shutdown time.

So long as resolvconf is treated as an Upstart job there should be a
one-to-one correlation:

    resolvconf updates enabled == resolvconf Upstart job running
    resolvconf updates disabled == resolvconf Upstart job stopped

In order to ensure this, "resolvconf --enable-updates" should return a
nonzero error code if and only if it failed to enable updates, i.e.,
failed to create the /run/resolvconf/enable-updates flag file.

Likewise "resolvconf --disable-updates" should return a nonzero error
code if and only if it failed to disable updates.  Fortunately it
already does so.

Steve wrote in #9:
> Should we adjust resolvconf to not take hook failures into consideration for its return code?

The smallest modification would be to make the suggested change only to
the enable-updates case, as follows.


$ diff -u resolvconf_ORIG resolvconf
--- resolvconf_ORIG	2012-02-19 16:49:46.725254960 +0100
+++ resolvconf	2012-02-19 16:51:39.277257572 +0100
@@ -113,9 +113,9 @@
 	fi
 	;;
   --enable-updates)
-	: >| "$ENABLE_UPDATES_FLAGFILE"
+	: >| "$ENABLE_UPDATES_FLAGFILE" || exit 1
 	if [ -e "$POSTPONED_UPDATE_FLAGFILE" ] ; then
-		update_and_exit -u
+		(update_and_exit -u) || :
 	fi
 	exit 0
 	;;

With this, other callers of resolvconf won't see any change in exit code
semantics.

-- 
You received this bug notification because you are a member of Ubuntu
Foundations Bugs, which is subscribed to resolvconf in Ubuntu.
https://bugs.launchpad.net/bugs/933566

Title:
  Stopping resolvconf doesn't disable updates

Status in “resolvconf” package in Ubuntu:
  Fix Committed
Status in “upstart” package in Ubuntu:
  New

Bug description:
  Stopping the resolvconf job should disable updates by means of
  deleting the enable-updates flag file, but this does not happen.

  # ls -l /run/resolvconf
  total 4
  -rw-r--r-- 1 root root   0 2012-02-16 17:02 enable-updates
  drwxr-xr-x 2 root root  60 2012-02-16 17:02 interface
  -rw-r--r-- 1 root root 177 2012-02-16 17:02 resolv.conf
  # stop resolvconf
  stop: Unknown instance: 
  # ls -l /run/resolvconf
  total 4
  -rw-r--r-- 1 root root   0 2012-02-16 17:02 enable-updates
  drwxr-xr-x 2 root root  60 2012-02-16 17:02 interface
  -rw-r--r-- 1 root root 177 2012-02-16 17:02 resolv.conf
  # start resolvconf 
  resolvconf start/running
  # stop resolvconf
  resolvconf stop/waiting
  # ls -l /run/resolvconf
  total 4
  -rw-r--r-- 1 root root   0 2012-02-16 17:06 enable-updates
  drwxr-xr-x 2 root root  60 2012-02-16 17:02 interface
  -rw-r--r-- 1 root root 177 2012-02-16 17:02 resolv.conf

  
  The following change seems to fix this.

  
  --- /etc/init/resolvconf.conf_ORIG	2012-02-16 17:09:22.313489458 +0100
  +++ /etc/init/resolvconf.conf	2012-02-16 17:08:31.398957282 +0100
  @@ -14,6 +14,6 @@
   	resolvconf --enable-updates
   end script
   
  -pre-stop script
  +post-stop script
   	resolvconf --disable-updates
   end script

  
  # stop resolvconf
  resolvconf stop/waiting
  # ls -l /run/resolvconf
  total 4
  drwxr-xr-x 2 root root  60 2012-02-16 17:02 interface
  -rw-r--r-- 1 root root 177 2012-02-16 17:02 resolv.conf

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/resolvconf/+bug/933566/+subscriptions




More information about the foundations-bugs mailing list