[Bug 1527710] Re: apt-get update triggers asynchronous task

Scott Moser smoser at ubuntu.com
Thu Jan 28 14:39:35 UTC 2016


In order to fix bug 525674, Christian did the following things in 3.164:
 a.) made /etc/update-motd.d/90-updates-available simply 'cat' a
     file /var/lib/update-notifier/updates-available
 b.) modified /usr/lib/update-notifier/update-motd-updates-available to
     background its execution of /usr/lib/update-notifier/apt-check
     which populates /var/lib/update-notifier/updates-available
 c.) added /etc/apt/apt.conf.d/99update-notifier to run 
     /etc/apt.conf.d/99update-notifier so that 
     /usr/lib/update-notifier/update-motd-updates-available is run
     each time 'apt-get update' finishes successfully.

The result of 'a' is that logins no longer trigger or block on execution
of a fairly slow and IO/CPU entensive task.  That is wonderful and does a
good job of fixing bug 525674 and not triggering unnecessary activity on a
system simply as a result of a user logging in.

The result of 'c' is that is that running:
  apt-get update 
populates keeps /var/lib/update-notifier/updates-available up to date.

The result of 'b' and 'c' is what caused the problem for me in curtin
and I believe for 'd-i' as described in bug 1533243.

My change was to un-do 'b'.
 
I can see a use case for a user wanting for 'apt-check' to run
backgrounded so that it doesn't make 'apt-get update' take any longer than
it already does.  However, that should not be the default behavior as it
is quite unexpected.  If someone wants to make this configurable in
the future I'm OK with that as long as it is done foreground by default.

An example of something that fails unexpectedly due to the backgrounding
is:
    mount-image-callback ubuntu-xenial.img --system-mounts -- \
       chroot _MOUNTPOINT_ apt-get update

Other things:
 * I'm not aware of anything in update-notifier-common that is running
   'apt-get update' via cron or otherwise keeping
   /var/lib/update-notifier/updates-available up to date other than
   when something manually runs 'apt-get update'
 * /var/lib/update-notifier/updates-available is not world readable
   which seems likely unintended as all it contains it it is something like.
     32 packages can be updated.
     0 updates are security updates.

** Description changed:

  I have a work flow (curtin installation) that does something to the affect of:
-  mount $DEVICE /target 
-  mount --bind /dev /target/dev
-  chroot /target apt-get update
-  umount /target/dev
-  umount /target/
+  mount $DEVICE /target
+  mount --bind /dev /target/dev
+  chroot /target apt-get update
+  umount /target/dev
+  umount /target/
  
  With xenial, I started having failures on the umount of /target/dev because of open file handles.
  An lsof showed me that /usr/lib/update-notifier/update-motd-updates-available had open file handles on /dev/null and apt-check had handles on /dev/urandom.
  
  I admit that part of this is my fault, because we do a selective apt-get
  update (only pulling deb sources, not deb-src).  As a result, when
  /usr/lib/update-notifier/update-motd-updates-available there was
  possibly more work to be done then would normally have to be done... not
  sure on that.
  
  For the record, what we do is in http://bazaar.launchpad.net/~curtin-
  dev/curtin/trunk/view/head:/curtin/util.py#L486 (apt_update method).
+ 
+ Related bugs:
+  * bug 524674:  apt-check hangs, preventing login via SSH
+  * bug 1527710: apt-get update triggers asynchronous task
+  * bug 1533243: preseeded installation fails on critical question: partman/unmount_active DISKS /dev/vda 
+ 
  
  ProblemType: Bug
  DistroRelease: Ubuntu 16.04
  Package: update-notifier-common 3.164
  ProcVersionSignature: User Name 4.3.0-2.11-generic 4.3.0
  Uname: Linux 4.3.0-2-generic x86_64
  ApportVersion: 2.19.3-0ubuntu2
  Architecture: amd64
  Date: Fri Dec 18 18:02:41 2015
  Ec2AMI: ami-0000072f
  Ec2AMIManifest: FIXME
  Ec2AvailabilityZone: nova
  Ec2InstanceType: m1.small
  Ec2Kernel: None
  Ec2Ramdisk: None
  PackageArchitecture: all
  ProcEnviron:
-  TERM=xterm-256color
-  PATH=(custom, no user)
-  XDG_RUNTIME_DIR=<set>
-  LANG=en_US.UTF-8
-  SHELL=/bin/bash
+  TERM=xterm-256color
+  PATH=(custom, no user)
+  XDG_RUNTIME_DIR=<set>
+  LANG=en_US.UTF-8
+  SHELL=/bin/bash
  SourcePackage: update-notifier
  UpgradeStatus: No upgrade log present (probably fresh install)

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

Title:
  apt-get update triggers asynchronous task

Status in update-notifier package in Ubuntu:
  Fix Released

Bug description:
  I have a work flow (curtin installation) that does something to the affect of:
   mount $DEVICE /target
   mount --bind /dev /target/dev
   chroot /target apt-get update
   umount /target/dev
   umount /target/

  With xenial, I started having failures on the umount of /target/dev because of open file handles.
  An lsof showed me that /usr/lib/update-notifier/update-motd-updates-available had open file handles on /dev/null and apt-check had handles on /dev/urandom.

  I admit that part of this is my fault, because we do a selective apt-
  get update (only pulling deb sources, not deb-src).  As a result, when
  /usr/lib/update-notifier/update-motd-updates-available there was
  possibly more work to be done then would normally have to be done...
  not sure on that.

  For the record, what we do is in http://bazaar.launchpad.net/~curtin-
  dev/curtin/trunk/view/head:/curtin/util.py#L486 (apt_update method).

  Related bugs:
   * bug 524674:  apt-check hangs, preventing login via SSH
   * bug 1527710: apt-get update triggers asynchronous task
   * bug 1533243: preseeded installation fails on critical question: partman/unmount_active DISKS /dev/vda 

  
  ProblemType: Bug
  DistroRelease: Ubuntu 16.04
  Package: update-notifier-common 3.164
  ProcVersionSignature: User Name 4.3.0-2.11-generic 4.3.0
  Uname: Linux 4.3.0-2-generic x86_64
  ApportVersion: 2.19.3-0ubuntu2
  Architecture: amd64
  Date: Fri Dec 18 18:02:41 2015
  Ec2AMI: ami-0000072f
  Ec2AMIManifest: FIXME
  Ec2AvailabilityZone: nova
  Ec2InstanceType: m1.small
  Ec2Kernel: None
  Ec2Ramdisk: None
  PackageArchitecture: all
  ProcEnviron:
   TERM=xterm-256color
   PATH=(custom, no user)
   XDG_RUNTIME_DIR=<set>
   LANG=en_US.UTF-8
   SHELL=/bin/bash
  SourcePackage: update-notifier
  UpgradeStatus: No upgrade log present (probably fresh install)

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/update-notifier/+bug/1527710/+subscriptions



More information about the foundations-bugs mailing list