Unattended upgrade fails with segmentation fault in Ubuntu Server 10.10

Bug #664514 reported by Aaron Kelley on 2010-10-21
160
This bug affects 30 people
Affects Status Importance Assigned to Milestone
the python apt bindings
Fix Released
Unknown
python-apt (Debian)
Unknown
Unknown
python-apt (Ubuntu)
Low
Unassigned
Maverick
Undecided
Unassigned

Bug Description

[SRU for maverick]

* This bug makes unattended-upgrade completely unusable.
* This bug was fixed in upstream version 0.7.98.
* Just one-line backporting
  https://bugs.launchpad.net/ubuntu/+source/python-apt/+bug/664514/+attachment/1769035/+files/python-apt_0.7.96.1ubuntu11.debdiff

TEST CASE:
1. Use out-of-date system which has security update notification
2. Run "$ sudo apt-get upgrade --download-only"
3. Run "$ sudo unattended-upgrade -d" and get Segmentation fault
4. Upgrade to -proposed package
5. Run "$ sudo unattended-upgrade -d" and all security updates get installed

-----
After upgrading from Ubuntu Server 10.04 to Ubuntu Server 10.10, I noticed that security updates were no longer being applied automatically (contrary to my configuration).

I did some poking around in the apt script (in etc/cron.daily). Here is the output with debug mode on. (I cleared out the time stamp files to force it to update now so errors regarding those are not important.)

power status (255) undetermined, continuing
system is on main power.
sleeping for 739 seconds
check_stamp: missing time stamp file: /var/lib/apt/periodic/update-stamp.
apt-key net-update (success)
download updated metadata (success).
send dbus signal (success)
X11 connection rejected because of wrong authentication.
check_stamp: missing time stamp file: /var/lib/apt/periodic/download-upgradeable-stamp.
download upgradable (success)
check_stamp: missing time stamp file: /var/lib/apt/periodic/upgrade-stamp.
Segmentation fault
unattended-upgrade (error)
check_stamp: missing time stamp file: /var/lib/apt/periodic/autoclean-stamp.
autoclean (success).
aged: ctime <30 and mtime <30 and ctime>2 and mtime>2
end remove by archive size: size=412396 < 512000

So, what's that seg fault in the middle there? Turns out it is the call to /usr/bin/unattended-upgrade.

I can actually reproduce it like this:

$ sudo unattended-upgrade
Segmentation fault

Now, this is about all I know how to do to debug the issue. If you'd like me to run a stack trace or something on unattended-upgrade to figure out why it is crashing, please point me towards some directions to do so. (I notice that it is a python script and I am not very familiar with python.) In any case, this is a security issue, since security updates cannot be installed automatically, I have to remember to check the server often to make sure that security updates are applied.

visibility: private → public
description: updated
affects: ubuntu → apt (Ubuntu)
affects: apt (Ubuntu) → unattended-upgrades (Ubuntu)
description: updated
security vulnerability: yes → no
Aaron Kelley (aaronkelley) wrote :

Log information from /var/log/unattended-upgrades. Whenever the unattended-upgrade script is launched, these three lines are logged (and no more):

2010-11-05 08:16:37,380 INFO Initial blacklisted packages:
2010-11-05 08:16:37,382 INFO Starting unattended upgrades script
2010-11-05 08:16:37,382 INFO Allowed origins are: ["('Ubuntu', 'stable')", "('Ubuntu', 'maverick-security')"]

This can be used to tell about how far the script got before it crashed...

This bug has been fixed in Debian, please have a look at http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=596408

Aaron Kelley (aaronkelley) wrote :

Great, I read the description over there and it looks like it describes my problem exactly. I am running 32-bit Ubuntu.

Furthermore, I noticed that the updated python-apt is already in the natty repository, so I installed natty's python-apt and python-apt-common and that promptly made my problem go away.

Any way we could get this fix in Ubuntu 10.10?

affects: unattended-upgrades (Ubuntu) → python-apt (Ubuntu)
Piotr Kęplicz (keplicz) on 2010-11-08
Changed in python-apt (Ubuntu):
status: New → Confirmed
Changed in python-apt:
status: Unknown → Fix Released
locutus266 (locutus266) wrote :

Same problem here. Can reproduce with calling unattended-upgrades as root.

Sean Reifschneider (jafo) wrote :

FYI, I've built some packages with this Debian patch and it seems to solve the problem on my system. It's at http://jafo.tummy.com/maverick-python-apt/python-apt_0.7.96.1ubuntu11tummy_i386.deb if anyone really needs it in the interim until Ubuntu releases an update.

Reuben Thomas (rrt) wrote :

Thanks very much for this interim fix, Sean. Let's hope Ubuntu get this into maverick soon.

Nobuto Murata (nobuto) wrote :

This bug was fixed in the package python-apt - 0.7.98 at least for natty.
I will mark this so.

---------------
python-apt (0.7.98) unstable; urgency=low

  [ Michael Vogt ]
  * python/acquire.cc:
    - return long long when calling TotalNeeded(), FetchNeeded() and
      PartialPresent() from pkgAcquire(). This follows the change
      in libapt.
  * apt/debfile.py:
    - add missing init for _installed_conflicts (LP: #618597)
  * add "provides" property to the apt.Version objects
  * apt/debfile.py:
    - fix error when reading binary content and add regresion test
  * merged patch from Samuel Lidén Borell to fix crash if there utf8
    in the control file (LP: #624290) and add test
  * apt/cache.py:
    - add "sources_list" parameter to cache.update() to force updating
      a single sources.list entry only
  * debian/control:
    - add missing build-depends on python-debian (needed to run the
      tests for apt.debfile.DebPackage()
  * data/templates/Ubuntu.info.in:
    - add extras.ubuntu.com and archvie.canonical.com to the
      templates
  * aptsources/distinfo.py, aptsources/distro.py:
    - support non-official templates (like extras.ubuntu.com)
  * fix return type of DebSize() and UsrSize(), thanks to
    Sebastian Heinlein, LP: #642936
  * merge fix from Steven Chamberlain <email address hidden> for
    crash in unattended-upgrades, many many thanks (closes: #596408)
  * python/acquire-item.cc:
    - fix two more int -> long long change to follow the changes
      from libapt
    - do use PyString_FromFormat(), in python versions below 2.7 it
      does not support long long (%llu), use strprintf() from libapt
      instead
  * tests/test_apt_cache.py:
    - fix tests to work if apt compressed indexes are enabled

  [ Kiwinote ]
  * apt/debfile:
    - don't fail if we conflict with the pkgs we are reinstalling

 -- Michael Vogt <email address hidden> Tue, 28 Sep 2010 15:47:51 +0200

Changed in python-apt (Ubuntu):
status: Confirmed → Fix Released
Nobuto Murata (nobuto) wrote :

minimal patch for maverick.

Nobuto Murata (nobuto) on 2010-12-17
description: updated
Nobuto Murata (nobuto) wrote :

Sorry, I used wrong version number.

description: updated
Vish (vish) wrote :

Nominated for Maverick release as per request from Nobuto MURATA .

Changed in python-apt (Ubuntu):
importance: Undecided → Low
Nobuto Murata (nobuto) on 2010-12-27
tags: added: i386
Raúl Santos (borfast) wrote :

I still have this problem on my Ubuntu 10.10 systems, with python-apt 0.7.96.1ub.
Are there any plans to release a fix for this soon? It's really bad to have your systems rely on unattended upgrades, only to discover that critical security fixes aren't being installed, and having to apply them by hand.

Changed in python-apt (Ubuntu Maverick):
milestone: none → maverick-updates
Jamie Strandboge (jdstrand) wrote :

After discussing this with Michael Vogt, the patch for maverick is incorrect. The correct fix has actually already been uploaded to maverick-proposed and is pending review by the SRU team. This SRU is being tracked in bug #655154.

Changed in python-apt (Ubuntu Maverick):
status: New → Invalid
tags: added: testcase
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.