apportcheckresume crashed with AssertionError in _assert_bin_mode(): file stream must be in binary mode

Bug #1040353 reported by Benjamin Kerensa
374
This bug affects 82 people
Affects Status Importance Assigned to Milestone
Apport
Undecided
Unassigned
apport (Ubuntu)
High
Martin Pitt

Bug Description

When I closed my laptop lid and Ubuntu went into suspend.... I open lid to resume and the system crashed then rebooted and this error resulted.

ProblemType: Crash
DistroRelease: Ubuntu 12.10
Package: apport 2.5.1-0ubuntu1
ProcVersionSignature: Ubuntu 3.5.0-11.11-generic 3.5.2
Uname: Linux 3.5.0-11-generic x86_64
ApportLog:

ApportVersion: 2.5.1-0ubuntu1
Architecture: amd64
Date: Wed Aug 22 17:56:52 2012
ExecutablePath: /usr/share/apport/apportcheckresume
InstallationMedia: Ubuntu 12.04 LTS "Precise Pangolin" - Release amd64 (20120425)
InterpreterPath: /usr/bin/python3.2mu
PackageArchitecture: all
ProcCmdline: /usr/bin/python3 /usr/share/apport/apportcheckresume
ProcEnviron:
 TERM=linux
 PATH=(custom, no user)
PythonArgs: ['/usr/share/apport/apportcheckresume']
SourcePackage: apport
Title: apportcheckresume crashed with AssertionError in _assert_bin_mode(): file stream must be in binary mode
UpgradeStatus: Upgraded to quantal on 2012-08-08 (14 days ago)
UserGroups:

Revision history for this message
Benjamin Kerensa (bkerensa) wrote :
tags: removed: need-duplicate-check
Changed in apport (Ubuntu):
importance: Undecided → Medium
Revision history for this message
Launchpad Janitor (janitor) wrote :

Status changed to 'Confirmed' because the bug affects multiple users.

Changed in apport (Ubuntu):
status: New → Confirmed
Jeremy Bicha (jbicha)
visibility: private → public
Revision history for this message
Steve Langasek (vorlon) wrote :

Hit this as well following a suspend/resume that ended in a poweroff (dunno why). This looks like it may be a regression due to the switch to python3. I'm not sure how to debug this, because there doesn't seem to be a backtrace here to tell us which stream is in the wrong encoding, and running /usr/share/apport/apportcheckresume by hand results in a different crash (bug #1046092).

Andy, can you provide any guidance on debugging this?

Changed in apport (Ubuntu):
importance: Medium → High
assignee: nobody → Andy Whitcroft (apw)
Revision history for this message
Andy Clayton (q3aiml) wrote :

The backtrace shows it failing when writing the report file on line 84. This is because write in problem_report.py checks that it was opened in binary mode, with a comment that it is required. Changing line 82 in apportcheckresume so it opens report_file in binary mode with 'wb' instead of just 'w' seems to fix it.

Running it manually triggers bug #1046092 because the script assumes /var/lib/pm-utils/status exists. Not sure if that was the case all along, or if either the change to python3 or changes to attach_file_if_exists changed the behavior.

Steve Langasek (vorlon)
Changed in apport (Ubuntu):
status: Confirmed → Triaged
Revision history for this message
Anthony Hook (anthonyhook) wrote :

I was not resuming from suspend when this happened, it was a minute or two after a fresh boot on my Asus EEE 1000. Probably something with power management as Andy said.

Changed in apport (Ubuntu):
status: Triaged → Fix Released
description: updated
Revision history for this message
Daniel Holbach (dholbach) wrote :

Ajit: why did you mark the bug as 'fix released'? Which change of code fixed the issue?

Changed in apport (Ubuntu):
status: Fix Released → Triaged
Revision history for this message
Martin Pitt (pitti) wrote :

Fixed in trunk r2485.

Changed in apport (Ubuntu):
assignee: Andy Whitcroft (apw) → Martin Pitt (pitti)
status: Triaged → Fix Committed
Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package apport - 2.5.2-0ubuntu2

---------------
apport (2.5.2-0ubuntu2) quantal; urgency=low

  * data/general-hooks/ubuntu.py: Add "package-from-proposed" tag if the
    installed package version is available from -proposed, but not from
    -security and -updates. (LP: #1050853)
  * Merge fixes from trunk:
    - data/apportcheckresume: Open report file in binary mode. (LP: #1040353)
    - packaging-apt-dpkg.py: When throwing ValueErrors, show the non-existing
      package name. This makes it easier to debug such crashes.
    - launchpad.py: Replace characters from tags which are not allowed by
      Launchpad with '.' (LP: #1029479)
 -- Martin Pitt <email address hidden> Tue, 18 Sep 2012 14:51:08 +0200

Changed in apport (Ubuntu):
status: Fix Committed → Fix Released
Revision history for this message
Maurits Wijzenbeek (m-wyzenbeek) wrote :

Each time I start my computer the system hangs one to five or six times, after Grub, when it starts to load the system. When at last the system loads there are no prblems . I tried to stop the computer with `suspend'. After restarting I got a problem that looked like this problem. Maurits Wijzenbeek

Martin Pitt (pitti)
Changed in apport:
status: New → Fix Released
Revision history for this message
John Park (johndouglaspark) wrote :

Has this been fixed because I'm still having this problem....

Revision history for this message
Brian Carpenter (klanestrotalisman) wrote :

I got it too.

Revision history for this message
Brian Carpenter (klanestrotalisman) wrote :

I have a system76 panp9

Revision history for this message
deskenny (deskenny) wrote :

have same problem

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

Please be more specific if you still have this problem -- are you perhaps running Ubuntu 12.04 LTS ("precise")?

Revision history for this message
Alex Mayorga (alex-mayorga) wrote :

I for one also get a prompr to send an error report about apportcheckresume on every boot after the batteries ran out or if the laptop is intentionally or accidentally suspended/resumed.

Here's the output of manually running on a terminal:

alex@VPCCW1FFXL:~$ sudo /usr/share/apport/apportcheckresu
[sudo] password for alex:
alex@VPCCW1FFXL:~$ /usr/share/apport/apportcheckresume
apportcheckresume failed
Traceback (most recent call last):
  File "/usr/share/apport/apportcheckresume", line 90, in <module>
    sys.exit(main())
  File "/usr/share/apport/apportcheckresume", line 54, in main
    pr['Tags'] = 'resume ' + pr['Failure']
  File "/usr/lib/python3.2/collections.py", line 800, in __getitem__
    raise KeyError(key)
KeyError: 'Failure'
alex@VPCCW1FFXL:~$ uname -a
Linux VPCCW1FFXL 3.5.0-25-generic #38-Ubuntu SMP Mon Feb 18 23:27:42 UTC 2013 x86_64 x86_64 x86_64 GNU/Linux

Revision history for this message
Alex Mayorga (alex-mayorga) wrote :

The latest apportcheckresume entry in /var/crash

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

> The latest apportcheckresume entry in /var/crash

That's bug 1046092.

Revision history for this message
Tommy_CZ (t-kijas) wrote :

I have same problem in quantal 12.10.

Revision history for this message
deskenny (deskenny) wrote :

sorry, should have said version, ubuntu 12.10

Intel® Core™2 Duo CPU T7250 @ 2.00GHz × 2

Dell xps 1330

des@des-XPS-M1330:~$ sudo /usr/share/apport/apportcheckresume
[sudo] password for des:
sudo: /usr/share/apport/apportcheckresu: command not found
des@des-XPS-M1330:~$ sudo /usr/share/apport/apportcheckresume
apportcheckresume failed
Traceback (most recent call last):
  File "/usr/share/apport/apportcheckresume", line 90, in <module>
    sys.exit(main())
  File "/usr/share/apport/apportcheckresume", line 54, in main
    pr['Tags'] = 'resume ' + pr['Failure']
  File "/usr/lib/python3.2/collections.py", line 800, in __getitem__
    raise KeyError(key)
KeyError: 'Failure'

Revision history for this message
Paul Kelly (paul-j) wrote :

Same basic symptoms as above- usually happens on trying to resume from sleeping- Almost always requiring a hard-reboot - then then sometimes on the following boot.

4x Intel(R) Core(TM) i3 CPU M 370 @ 2.40GHz - Ubuntu 12.10 *(full hardinfo attatched)

This was a clean install of ubuntu-12.10-desktop-amd64.iso that was upgraded by:
sudo apt-get install ubuntu-gnome-desktop ubuntu-gnome-default-settings

Revision history for this message
bwanamarko (bwanamarko) wrote :

I am also still having this now on raring ringtail 13.04, was on 12.10 too.
compaq/hp 2570us pentium 4

Revision history for this message
lahairoi (leholenzai) wrote :

+1 Having the same problem on raring ringtail 13.04
Sony Vaio VGN-FW550F

Revision history for this message
Stella Delichatsiou (stelladeli94) wrote :

I still have this problem with ubuntu 12.10. When was this fixed?

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

It can't be the same problem, this bug was fixed in 12.10. If you still experience a similar crash, can you please file a new report? Thanks!

To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Duplicates of this bug

Other bug subscribers