/usr/share/apport/general-hooks/ubuntu.py crashed: KeyError: 'CasperMD5json'

Bug #1964828 reported by Bruce Epstein
32
This bug affects 4 people
Affects Status Importance Assigned to Milestone
apport (Ubuntu)
Fix Released
Medium
Benjamin Drung
Focal
Fix Released
Medium
Unassigned
Jammy
Fix Released
Medium
Unassigned

Bug Description

[Impact]

If the user reports a bug and rejects to enter the root password for collecting information (like the CasperMD5json), the Ubuntu add_info hook will fail with a stack trace. The remaining code for collecting more information is not executed. So the resulting bug reports will be less helpful. The check_for_disk_error call is not reached and therefore skipped.

[Test Plan]

1. Install Ubuntu (e.g. from ubuntu-22.04-desktop-amd64.iso)
2. Open a terminal
3. Run: ubuntu-bug -f
4. Select "installer" and click on OK
5. Click on "abort" when ask for the password
6. The terminal should not show a stacktrace

[Where problems could occur]

The changed code is the Ubuntu add_info hook. So this hook could fail due to a regression or reveal bugs in the later code path. The later code path could cause more more load on the users machine (but only when the user wants to report the issue). Apport will catch failing add_info hooks and store the failure in the report.

[Orinial report]

ERROR: hook /usr/share/apport/general-hooks/ubuntu.py crashed:
Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/apport/report.py", line 228, in _run_hook
    symb['add_info'](report, ui)
  File "/usr/share/apport/general-hooks/ubuntu.py", line 81, in add_info
    apport.hookutils.attach_casper_md5check(report,
  File "/usr/lib/python3/dist-packages/apport/hookutils.py", line 1016, in attach_casper_md5check
    check = json.loads(report['CasperMD5json'])
  File "/usr/lib/python3.10/collections/__init__.py", line 1102, in __getitem__
    raise KeyError(key)
KeyError: 'CasperMD5json'
kubuntu@kubuntu:~$ Gtk-Message: 21:22:43.923: Failed to load module "colorreload-gtk-module"
ATTENTION: default value of option mesa_glthread overridden by environment.
ATTENTION: default value of option mesa_glthread overridden by environment.
ATTENTION: default value of option mesa_glthread overridden by environment.

ProblemType: Bug
DistroRelease: Ubuntu 22.04
Package: ubiquity 22.04.7
ProcVersionSignature: Ubuntu 5.15.0-22.22-generic 5.15.19
Uname: Linux 5.15.0-22-generic x86_64
ApportVersion: 2.20.11-0ubuntu79
Architecture: amd64
CasperVersion: 1.467
CurrentDesktop: KDE
Date: Mon Mar 14 21:22:23 2022
InstallCmdLine: BOOT_IMAGE=/casper/vmlinuz file=/cdrom/preseed/kubuntu.seed maybe-ubiquity quiet splash ---
LiveMediaBuild: Kubuntu 22.04 LTS "Jammy Jellyfish" - Alpha amd64 (20220314)
SourcePackage: ubiquity
UpgradeStatus: No upgrade log present (probably fresh install)

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

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

Changed in ubiquity (Ubuntu):
status: New → Confirmed
graingert (tagrain)
affects: ubiquity (Ubuntu) → apport (Ubuntu)
Revision history for this message
graingert (tagrain) wrote :
Revision history for this message
Benjamin Drung (bdrung) wrote :

So this bug is fixed in kinetic by apport version 2.22.0-0ubuntu1. The fix for this bug is included in the SRUs for jammy and focal. See https://bugs.launchpad.net/apport/+bug/1982555 for details.

Changed in apport (Ubuntu):
status: Confirmed → Fix Released
summary: - ERROR: hook /usr/share/apport/general-hooks/ubuntu.py crashed: Traceback
- (most recent call last): File "/usr/lib/python3/dist-
- packages/apport/report.py", line 228, in _run_hook
- symb['add_info'](report, ui) File "/usr/share/apport/general-
- hooks/ubuntu.py", line 81, in add_info
- apport.hookutils.attach_casper_md5check(report, File
- "/usr/lib/python3/dist-packages/apport/hookutils.py", line 1016, in
- attach_casper_md5check check = json.loads(report['CasperMD5json'])
- File "/usr/lib/python3.10/collections/__init__.py", line 1102, in
- __getitem__ raise KeyError(key) KeyError: 'CasperMD5json'
- kubuntu@kubuntu:~$ Gtk-Message: 21:22:43.923: Failed to load module
- "colorreload-gtk-module" ATTENTION: default value of option
- mesa_glthread overridden by environment. ATTENTION: default value of
- option mesa_glthread overridden by environment. ATTENTION: default value
- of option mesa_glthread overridden by environment.
+ /usr/share/apport/general-hooks/ubuntu.py crashed: KeyError:
+ 'CasperMD5json'
Benjamin Drung (bdrung)
Changed in apport (Ubuntu):
importance: Undecided → Medium
Changed in apport (Ubuntu Focal):
status: New → Fix Committed
importance: Undecided → Medium
Changed in apport (Ubuntu Jammy):
status: New → Fix Committed
importance: Undecided → Medium
Benjamin Drung (bdrung)
description: updated
Benjamin Drung (bdrung)
description: updated
Revision history for this message
Steve Langasek (vorlon) wrote : Proposed package upload rejected

An upload of apport to jammy-proposed has been rejected from the upload queue for the following reason: "contains bugfixes without bug references or test cases, does not meet SRU policy".

Benjamin Drung (bdrung)
Changed in apport (Ubuntu Focal):
status: Fix Committed → New
Changed in apport (Ubuntu Jammy):
status: Fix Committed → New
tags: added: foundations-todo
Changed in apport (Ubuntu):
assignee: nobody → Benjamin Drung (bdrung)
Revision history for this message
Brian Murray (brian-murray) wrote : Please test proposed package

Hello Bruce, or anyone else affected,

Accepted apport into jammy-proposed. The package will build now and be available at https://launchpad.net/ubuntu/+source/apport/2.20.11-0ubuntu82.3 in a few hours, and then in the -proposed repository.

Please help us by testing this new package. See https://wiki.ubuntu.com/Testing/EnableProposed 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, what testing has been performed on the package and change the tag from verification-needed-jammy to verification-done-jammy. If it does not fix the bug for you, please add a comment stating that, and change the tag to verification-failed-jammy. In either case, without details of your testing we will not be able to proceed.

Further information regarding the verification process can be found at https://wiki.ubuntu.com/QATeam/PerformingSRUVerification . Thank you in advance for helping!

N.B. The updated package will be released to -updates after the bug(s) fixed by this package have been verified and the package has been in -proposed for a minimum of 7 days.

Changed in apport (Ubuntu Jammy):
status: New → Fix Committed
tags: added: verification-needed verification-needed-jammy
Revision history for this message
Benjamin Drung (bdrung) wrote :

I updated the test case, because the report needs to be filed after the installation. Successfully verified apport 2.20.11-0ubuntu82.3 on jammy in a virtual machine.

description: updated
tags: added: verification-done verification-done-jammy
removed: verification-needed verification-needed-jammy
Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package apport - 2.20.11-0ubuntu82.3

---------------
apport (2.20.11-0ubuntu82.3) jammy; urgency=medium

  * Replace deprecated 'imp' module (LP: #1947425)
  * Fix KeyError: 'CasperMD5json' (LP: #1964828)
  * apport-kde: Fix inverse order of choices (LP: #1967965)
  * apport-unpack: Fix ValueError: ['separator'] has no binary content
    (LP: #1889443)
  * test:
    - Mock add_gdb_info calls in KDE UI tests
    - Fix KDE UI tests if whoopsie.path is disabled
    - Fix race with progress dialog in KDE UI tests
    - Run UI KDE tests again
    - Determine source package dynamically in test_run_crash_kernel
      (LP: #1992172)

 -- Benjamin Drung <email address hidden> Thu, 24 Nov 2022 12:47:19 +0100

Changed in apport (Ubuntu Jammy):
status: Fix Committed → Fix Released
Revision history for this message
Andreas Hasenack (ahasenack) wrote : Update Released

The verification of the Stable Release Update for apport has completed successfully and the package is now being released to -updates. Subsequently, the Ubuntu Stable Release Updates Team is being unsubscribed and will not receive messages about this bug report. In the event that you encounter a regression using the package from -updates please report a new bug using ubuntu-bug and tag the bug report regression-update so we can easily find any regressions.

Changed in apport (Ubuntu Focal):
assignee: nobody → cristian swing (sed1991s)
Changed in apport (Ubuntu Jammy):
assignee: nobody → cristian swing (sed1991s)
Jürgen Gmach (jugmac00)
Changed in apport (Ubuntu Focal):
assignee: cristian swing (sed1991s) → nobody
Changed in apport (Ubuntu Jammy):
assignee: cristian swing (sed1991s) → nobody
Revision history for this message
Steve Langasek (vorlon) wrote : Please test proposed package

Hello Bruce, or anyone else affected,

Accepted apport into focal-proposed. The package will build now and be available at https://launchpad.net/ubuntu/+source/apport/2.20.11-0ubuntu27.27 in a few hours, and then in the -proposed repository.

Please help us by testing this new package. See https://wiki.ubuntu.com/Testing/EnableProposed 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, what testing has been performed on the package and change the tag from verification-needed-focal to verification-done-focal. If it does not fix the bug for you, please add a comment stating that, and change the tag to verification-failed-focal. In either case, without details of your testing we will not be able to proceed.

Further information regarding the verification process can be found at https://wiki.ubuntu.com/QATeam/PerformingSRUVerification . Thank you in advance for helping!

N.B. The updated package will be released to -updates after the bug(s) fixed by this package have been verified and the package has been in -proposed for a minimum of 7 days.

Changed in apport (Ubuntu Focal):
status: New → Fix Committed
tags: added: verification-needed verification-needed-focal
removed: verification-done
Revision history for this message
Benjamin Drung (bdrung) wrote :

Verified that apport 2.20.11-0ubuntu27.27 does not throw a KeyError on CasperMD5json any more:

```
$ ubuntu-bug -f
Error executing command as another user: Request dismissed
ERROR: hook /usr/share/apport/package-hooks/source_ubiquity.py crashed:
Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/apport/report.py", line 228, in _run_hook
    symb['add_info'](report, ui)
  File "/usr/share/apport/package-hooks/source_ubiquity.py", line 65, in add_info
    add_installation_log(report, 'UbiquitySyslog', 'syslog')
  File "/usr/share/apport/package-hooks/source_ubiquity.py", line 29, in add_installation_log
    if isinstance(report[ident], bytes):
  File "/usr/lib/python3.8/collections/__init__.py", line 1010, in __getitem__
    raise KeyError(key)
KeyError: 'UbiquitySyslog'
```

This KeyError on UbiquitySyslog is a separate issue.

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

This bug was fixed in the package apport - 2.20.11-0ubuntu27.27

---------------
apport (2.20.11-0ubuntu27.27) focal; urgency=medium

  * whoopsie-upload-all: Catch zlib.error when decoding CoreDump from
    crash file (LP: #1947800)
  * Fix KeyError: 'CasperMD5json' (LP: #1964828)
  * apport-kde: Fix inverse order of choices (LP: #1967965)
  * apport-unpack: Fix ValueError: ['separator'] has no binary content
    (LP: #1889443)
  * test:
    - Clear environment for test_run_as_real_user_no_sudo
    - Mock add_gdb_info calls in KDE UI tests
    - Fix KDE UI tests if whoopsie.path is disabled
    - Fix race with progress dialog in KDE UI tests
    - Run UI KDE tests again
    - Determine source package dynamically in test_run_crash_kernel
      (LP: #1992172)

 -- Benjamin Drung <email address hidden> Fri, 14 Apr 2023 01:17:21 +0200

Changed in apport (Ubuntu Focal):
status: Fix Committed → Fix Released
Benjamin Drung (bdrung)
tags: removed: foundations-todo
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.