landscape-sysinfo crashed with ImportError in <module>()

Bug #349996 reported by Jim Garten
This bug affects 888 people
Affects Status Importance Assigned to Milestone
Landscape Client
Fix Released
High
Thomas Herve
landscape-client (Ubuntu)
Fix Released
High
Thomas Herve
Jaunty
Fix Released
Critical
Mathias Gug

Bug Description

The Landscape Team has requested an SRU for this bug. The required information follows below, and the original bug description is available in the link below.

=== Statement explaining the impact ===

This bug is typically triggered by release upgrades from jaunty to karmic. During the upgrade some Python modules are not importable and cause a crash in the landscape-sysinfo script, which is in turned run by pam-motd upon user login. For this reason the bug potentially affects everyone upgrading from jaunty to karmic. The bug in itself has no other effect than firing an apport bug, however this is likely to make the user think that something went wrong, so fixing it is really important from a user-experience point of view.

=== How the bug has been addressed ===

The landscape-sysinfo script has been modified to catch possible module import errors and exit in that case. The fix is already included in version 1.4.0-0ubuntu0.9.10.0 of the landscape-client package, which the current one in lucid and karmic.

=== Patch ===

The comment #27 of this bug sports a patch created against the landscape-client 1.3.2.3-0ubuntu0.9.04.0 package currently in jaunty-updates.

=== How to reproduce the bug ===

Issue a release-upgrade from jaunty to karmic and switch user or login as a new user.

=== Regression potential ===

The change is very isolated and there's no possibility of regression.

Revision history for this message
Jim Garten (var-www) wrote :
Revision history for this message
Andreas Hasenack (ahasenack) wrote :

Hello Jim,

can you please run this command in a terminal, as your user?

landscape-sysinfo

Please paste the whole output here.

Kees Cook (kees)
visibility: private → public
Changed in landscape-client:
status: New → Incomplete
Revision history for this message
Kees Cook (kees) wrote :

/usr/lib/python2.6/dist-packages/twisted/internet/_sslverify.py:5: DeprecationWarning: the md5 module is deprecated; use hashlib instead
  import itertools, md5
/usr/lib/python2.6/dist-packages/twisted/python/filepath.py:12: DeprecationWarning: the sha module is deprecated; use the hashlib module instead
  import sha
  System load: 0.39 Swap usage: 2% Users logged in: 1
  Memory usage: 34% Processes: 249

  => There is 1 zombie process.

Changed in landscape-client (Ubuntu):
status: Incomplete → New
Revision history for this message
Matt Zimmerman (mdz) wrote :

Try:

python -c 'import zope.interface'

Revision history for this message
Kees Cook (kees) wrote :

This works fine. I commented in my dup'd bug that this happened during upgrade, so I suspect that zope gets into a funny state while update-motd tries to run landscape-sysinfo while the upgrade is happening.

Revision history for this message
Andreas Hasenack (ahasenack) wrote :

Matt, Kees, is there something going on with python packaging that we should fix? Or is it perhaps just jaunty's transient nature (alpha, beta, etc)? At some point during the upgrade, landscape-sysinfo just wasn't able to find zope.interface, but the package is installed. At least at the end of the upgrade it is.

Revision history for this message
Kees Cook (kees) wrote :

I think the issue is that crontab is running landscape-sysinfo (by way of update-motd) in the middle of an upgrade. It would be best if landscape-sysinfo handled this in a more graceful way (instead of causing a traceback). This is especially true since it is installed by default.

Revision history for this message
Matt Zimmerman (mdz) wrote :

I expect Kees is right.

Probably the cron job should not run if the package is unconfigured.

Revision history for this message
Andreas Hasenack (ahasenack) wrote :

But in this case it was a dependency that was being installed, not landscape-common itself (which contains landscape-sysinfo). It was python-zopeinterface that was not available. How can we address this?

Revision history for this message
Matt Zimmerman (mdz) wrote : Re: [Bug 349996] Re: landscape-sysinfo crashed with ImportError in <module>()

On Mon, Mar 30, 2009 at 09:39:14PM -0000, Andreas Hasenack wrote:
> But in this case it was a dependency that was being installed, not
> landscape-common itself (which contains landscape-sysinfo). It was
> python-zopeinterface that was not available. How can we address this?

The packaging system takes care of this for you if your dependencies are
correct. It won't allow a package to be configured until its dependencies
have been configured.

--
 - mdz

Revision history for this message
Andreas Hasenack (ahasenack) wrote :

I'm sorry, I don't mean to transform this into a Debian Packaging 101 :) We can continue elsewhere, or just point me to some docs or other packages that have a similar problem.

So what if only python-zopeinterface is being upgraded? landscape-sysinfo is installed and is not being upgraded in this example. Then suddenly when python-zopeinterface is being configured (the new version), the cron job hits. How can the cron job detect this situation and decide to not run?

Revision history for this message
Matt Zimmerman (mdz) wrote :

On Mon, Mar 30, 2009 at 10:03:28PM -0000, Andreas Hasenack wrote:
> I'm sorry, I don't mean to transform this into a Debian Packaging 101 :)
> We can continue elsewhere, or just point me to some docs or other
> packages that have a similar problem.
>
> So what if only python-zopeinterface is being upgraded? landscape-
> sysinfo is installed and is not being upgraded in this example. Then
> suddenly when python-zopeinterface is being configured (the new
> version), the cron job hits. How can the cron job detect this situation
> and decide to not run?

Oh, that wasn't clear from this report. If only python-zopeinterface was
being upgraded, I would expect the window for this race to be very small
(but still present). The window is very large, though, when upgrading from
8.10 to 9.04. Because so many packages are being upgraded at once, the
packages will stay unconfigured (and potentially non-functional) for a long
time.

I'm surprised this hasn't come up before (which means it probably has and
I'm not aware of it). There may be a standard pattern for dealing properly
with this. I suggest taking the question to <email address hidden>.

--
 - mdz

Changed in landscape-client (Ubuntu):
importance: Undecided → Low
status: New → Triaged
Thomas Herve (therve)
Changed in landscape-client (Ubuntu):
assignee: nobody → Thomas Herve (therve)
status: Triaged → In Progress
Revision history for this message
Thomas Herve (therve) wrote :

So, the situation has changed a bit with Karmic as update-motd is gone, replaced by pam-motd. landscape-sysinfo is not run by cron anymore, apparently on login directly. But the problem is basically the same: if you login during an upgrade, an apport bug will be fired. Note that the motd won't be broken, probably because it detects the error code and thus don't copy the new motd.

Anyway, the way to fix it is to catch the error in landscape-sysinfo, so that the exception doesn't bubble up, but still exit with an error status, so that the motd is not updated. This is what I've done in the branch.

Changed in landscape-client:
assignee: nobody → Thomas Herve (therve)
importance: Undecided → High
milestone: none → 1.4.0
status: New → In Progress
Revision history for this message
Kevin McDermott (bigkevmcd) wrote :

Nice simple fix, +1

Thomas Herve (therve)
tags: added: review
Revision history for this message
Free Ekanayaka (free.ekanayaka) wrote :

Untested, but effective, +1.

I'll need to decide if we want this fix to be included in karmic before it gets out.

Revision history for this message
Thomas Herve (therve) wrote :

The fix has been merged in landscape-client trunk in r148.

tags: removed: review
Changed in landscape-client:
status: In Progress → Fix Committed
Jamu Kakar (jkakar)
tags: added: karmic-issue
Revision history for this message
Andreas Hasenack (ahasenack) wrote :

qa + 1, apport stays quiet now regarding import errors in landscape-common, while with the previous landscape-common an import error would trigger it.

Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package landscape-client - 1.3.2.4-0ubuntu0.9.10.0

---------------
landscape-client (1.3.2.4-0ubuntu0.9.10.0) karmic; urgency=low

  * New upstream release:
    - Catch import errors in the landscape-sysinfo script to prevent
      errors when landscape-sysinfo is run to update the motd during
      upgrade (LP: #349996)
    - Fix a long-standing bug in the client which causes resynchronisations
      on the server (LP: #144475)
    - When downloading hash-id stores, pass possible custom SSL certificates
      to the fetch fuction (LP: #435887)
    - Handle unicode username in custom graphs, and also report missing user
      to the server properly (LP: #406388)
    - Handle a SQlite bug when creating package store database, by making an
      extra query to flush the table cache (LP: #416629)

 -- Free Ekanayaka <email address hidden> Fri, 09 Oct 2009 18:21:24 +0200

Changed in landscape-client (Ubuntu):
status: In Progress → Fix Released
Jamu Kakar (jkakar)
tags: added: needs-testing
martin sexon (sexon905)
Changed in landscape-client (Ubuntu):
status: Fix Released → Confirmed
Revision history for this message
Thomas Herve (therve) wrote :

The fix is released in Karmic. The problem happens with the jaunty version still running during the upgrade.

Revision history for this message
Walldorf2000 (walldorf2000) wrote :

I have updated to Karmic with all available updates. After a reboot there are still jaunty packages active?

Synaptic does not report any obsolete packages whatsoever.

Revision history for this message
Andreas Hasenack (ahasenack) wrote :

Walldorf2000, the crash happened *during* the upgrade, but it is being *reported* to you via apport after the reboot when you login.

Unless I completely misunderstood how apport crash reports work...

Revision history for this message
David Grant (davidgrant) wrote :

This is happening to me near the end of the upgrade to Karmic.

Revision history for this message
Kevin McDermott (bigkevmcd) wrote :

Hi,

The Landscape team would like to apologise for the confusion that this bug has caused, and the bad experience users have had during their upgrades.

This bug was originally identified during the early releases of Karmic, but we didn't get a fix in place until the 10th of October 2009 - after the freeze for Ubuntu had occurred, essentially the bug was caused by the automated cron job that updates the landscape-sysinfo information continuing to run during the upgrade process, which failed because some of the libraries that it relied on were removed briefly during the actual upgrade routine.

The error that is reported is caused by the import of these libraries, and is trivial in nature, it just means that the cron job didn't complete once during the upgrade, unfortunately apport catches these errors and reports them as bugs (which we accept it is).

A fix has now been put in place which will hopefully avoid this problem in future, and this will make it into Ubuntu at the earliest possible opportunity.

Thanks,
The Landscape Team

Revision history for this message
The Founder (president-yooter) wrote :

Dear Landscape Team,

Trust us, we are grateful that this is fixed!

If this was Windows 7 or Vista.. it wouldn't be fixed until the next service pack update... interaction like this is why we all adopted Ubuntu as our OS of choice.

Best Regards,
Roger

Revision history for this message
Martin Pitt (pitti) wrote :

Since this appears to be a regression in jaunty-updates, I'm bumping this to critical.

Changed in landscape-client (Ubuntu Jaunty):
assignee: nobody → Thomas Herve (therve)
importance: Undecided → Critical
status: New → Confirmed
Changed in landscape-client (Ubuntu):
importance: Low → High
tags: added: regression-update
Revision history for this message
Thomas Herve (therve) wrote :

Martin: it's not a regression, this bug has been present for a while. It's fixed in Karmic, but the fix was done after the last SRU was submitted.

Revision history for this message
Free Ekanayaka (free.ekanayaka) wrote :

This bug was actually present in the jaunty package, so I'm removing the regression-update tag. As mentioned in comment #19, this is already fixed in Karmic.

The attached diff created against lp:ubuntu/jaunty-proposed/landscape-client solves the situation. I'm going to ask Mathias Gug to sponsor an SRU upload to jaunty-proposed for it.

tags: removed: regression-update
Revision history for this message
Scott Kitterman (kitterman) wrote : Re: [Bug 349996] Re: landscape-sysinfo crashed with ImportError in <module>()

Was it present in Jaunty at release?

description: updated
description: updated
Revision history for this message
Free Ekanayaka (free.ekanayaka) wrote :

@Scott: yes and no.

Yes, in the sense that if you try to upgrade a jaunty system with the original landscape-client package version from jaunty at release, you will hit the bug, in the same way you would it with the landscape-client package version now in jaunty-updates. The code of landscape-sysinfo hasn't changed at all between these two versions.

No, in the sense that the landscape-sysinfo script in the original jaunty landscape-client package is working fine in jaunty per se. The bug is triggered by the upgrade, and in particular because of the transition from update-motd (in jaunty) to pam-motd (in karmic), which makes the script run at every login.

Revision history for this message
Mathias Gug (mathiaz) wrote :

Uploaded to jaunty-proposed.

Changed in landscape-client (Ubuntu Jaunty):
status: Confirmed → In Progress
assignee: Thomas Herve (therve) → Mathias Gug (mathiaz)
Changed in landscape-client (Ubuntu):
status: Confirmed → Fix Released
Revision history for this message
Mathias Gug (mathiaz) wrote :

Marking Fixed Released in Karmic and Lucid

Jamu Kakar (jkakar)
Changed in landscape-client:
status: Fix Committed → Fix Released
Revision history for this message
Martin Pitt (pitti) wrote : Please test proposed package

Accepted landscape-client into jaunty-proposed, the package will build now and be available in a few hours. Please test and give feedback here. See https://wiki.ubuntu.com/Testing/EnableProposed for documentation how to enable and use -proposed. Thank you in advance!

Changed in landscape-client (Ubuntu Jaunty):
status: In Progress → Fix Committed
tags: added: verification-needed
Revision history for this message
Free Ekanayaka (free.ekanayaka) wrote :

The updated landscape-sysinfo script works as expected, and doesn't tracebacks if a Python module is not importable. Please move the landscape-client package on to jaunty-updates.

Martin Pitt (pitti)
tags: added: verification-done
removed: verification-needed
Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package landscape-client - 1.3.2.3-0ubuntu0.9.04.1

---------------
landscape-client (1.3.2.3-0ubuntu0.9.04.1) jaunty-proposed; urgency=low

  * Fix crash in landscape-sysinfo due to an import error during system wide
    upgrades (LP: #349996)

 -- Free Ekanayaka <email address hidden> Tue, 03 Nov 2009 11:44:39 +0100

Changed in landscape-client (Ubuntu Jaunty):
status: Fix Committed → Fix Released
tags: added: iso-testing
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Duplicates of this bug

Other bug subscribers

Remote bug watches

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