broken apport hook: TypeError: a bytes-like object is required, not 'str'

Bug #1582950 reported by Seth Arnold on 2016-05-18
This bug affects 3 people
Affects Status Importance Assigned to Milestone
apport (Ubuntu)
Jean-Baptiste Lallement
Jean-Baptiste Lallement
ubiquity (Ubuntu)

Bug Description

The apport hook for ubiquity appears broken. (Ignore the Wnck error, that's bug 1580412).

$ ubuntu-bug ubiquity
/usr/share/apport/apport-gtk:16: PyGIWarning: Wnck was imported without specifying a version first. Use gi.require_version('Wnck', '3.0') before import to ensure that the right version gets loaded.
  from gi.repository import GLib, Wnck, GdkX11, Gdk
dpkg-query: no packages found matching ubiquity
ERROR: hook /usr/share/apport/package-hooks/ crashed:
Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/apport/", line 197, in _run_hook
    symb['add_info'](report, ui)
  File "/usr/share/apport/package-hooks/", line 61, in add_info
    if 'Buffer I/O error on device' in syslog:
TypeError: a bytes-like object is required, not 'str'


ProblemType: Bug
DistroRelease: Ubuntu 16.04
Package: ubiquity (not installed)
ProcVersionSignature: Ubuntu 4.4.0-21.37-generic 4.4.6
Uname: Linux 4.4.0-21-generic x86_64
NonfreeKernelModules: zfs zunicode zcommon znvpair zavl
ApportVersion: 2.20.1-0ubuntu2
Architecture: amd64
CurrentDesktop: Unity
Date: Tue May 17 17:31:33 2016
InstallationDate: Installed on 2012-10-18 (1307 days ago)
InstallationMedia: Ubuntu 12.04.1 LTS "Precise Pangolin" - Release amd64 (20120823.1)
SourcePackage: ubiquity
UpgradeStatus: Upgraded to xenial on 2016-04-30 (17 days ago)

Seth Arnold (seth-arnold) wrote :

Thank you for taking the time to report this bug and helping to make Ubuntu better. We noticed that you were installing the LTS version of Ubuntu using an older version of the installation media. The latest point release of 12.04 is 12.04.5. Please try installing from that version of the installation media and see if that resolves your issue. Thanks in advance!

[This is an automated message. I apologize if it reached you inappropriately; please just reply to this message indicating so.]

Changed in ubiquity (Ubuntu):
status: New → Incomplete
Seth Arnold (seth-arnold) wrote :

Dear bot, I'm not sure what you're on about. You're also missing 14.04 LTS information. :)

Changed in ubiquity (Ubuntu):
status: Incomplete → New
Brian Murray (brian-murray) wrote :

The bot saw your UbiquitySyslog file and wanted to talk to you about it.

Brian Murray (brian-murray) wrote :

The ubiquity hook is proved by apport not ubiquity.

Changed in ubiquity (Ubuntu):
status: New → Invalid
Changed in apport (Ubuntu):
status: New → Confirmed
importance: Undecided → Medium
status: Confirmed → Triaged
assignee: nobody → Jean-Baptiste Lallement (jibel)
Changed in apport (Ubuntu):
status: Triaged → In Progress

Hello Seth, or anyone else affected,

Accepted apport into artful-proposed. The package will build now and be available at in a few hours, and then in the -proposed repository.

Please help us by testing this new package. See for documentation on how to enable and use -proposed.Your feedback will aid us getting this update out to other Ubuntu users.

If this package fixes the bug for you, please add a comment to this bug, mentioning the version of the package you tested and change the tag from verification-needed-artful to verification-done-artful. If it does not fix the bug for you, please add a comment stating that, and change the tag to verification-failed-artful. In either case, details of your testing will help us make a better decision.

Further information regarding the verification process can be found at . Thank you in advance!

Changed in apport (Ubuntu Artful):
status: In Progress → Fix Committed
tags: added: verification-needed verification-needed-artful
Launchpad Janitor (janitor) wrote :

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

apport (2.20.7-0ubuntu2) artful; urgency=medium

  * data/package-hooks/ Convert the content of syslog from
    bytes to string so comparison and regex matches in the hook work.
    (LP: #1582950)

 -- Brian Murray <email address hidden> Wed, 27 Sep 2017 14:44:40 -0700

Changed in apport (Ubuntu Artful):
status: Fix Committed → Fix Released
Brian Murray (brian-murray) wrote :

Did we confirm that this fix worked? Because bug 1744821 and bug 1744809 have crashes in the ubiquity hook. I imagine there are more.

Changed in apport (Ubuntu):
status: Fix Released → Incomplete
Brian Murray (brian-murray) wrote :

Its worth noting that the two bugs I looked at are from live versions of the system so perhaps the version of python being used there is different.

you're right, it crashes on the live session but not after installation. The version of python is the same on bionic (2.7.14+) (tested on 17.10.1 and 18.04)

Actually on the live session the hook reads /var/log/syslog which has read access for the group adm and after installation it reads /var/log/installer/syslog which does not and the code path is different.
In the former case decoding of utf8 bytes object is already done (the file is read with the function read()) but not in the latter (the file is the output of the command 'cat')

Changed in apport (Ubuntu):
status: Incomplete → Fix Committed
status: Fix Committed → In Progress
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package apport - 2.20.8-0ubuntu7

apport (2.20.8-0ubuntu7) bionic; urgency=medium

  * bin/apport-bug: recommend python3-apport not python-apport.
    (LP: #1729879)
  * data/package-hooks/ Convert the content of syslog from
    bytes to string so comparison and regex matches in the hook work. Thanks
    to Jean-Baptiste Lallement for the improved patch. (LP: #1582950)

 -- Brian Murray <email address hidden> Tue, 30 Jan 2018 08:24:53 -0800

Changed in apport (Ubuntu):
status: In Progress → Fix Released
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