AttributeError: module 'apt_pkg' has no attribute 'rewrite_section'

Bug #1850205 reported by Simon Poirier on 2019-10-28
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Landscape Client
Simon Poirier
landscape-client (Ubuntu)
Status tracked in Focal
Simon Poirier

Bug Description


 * Regression when applying a package profile through landscape on
   ubuntu-19.10. Process will stack-trace.

 * The issue is caused by removal of some obsolete methods from

 * The backported patch replaces old rewrite_section() by

[Test Case]

 * On ubuntu 19.10 (eoan) install landscape-client, run landscape-config,
   and create a package profile on the account.

 * check /var/log/landscape/package-changer.log for exceptions.

[Regression Potential]

 * The change has already been published for ubuntu 20.04 and is verified.

 * Patched callsites are only used by package profiles, which would limit
   the effect of regressions.

 * One possible regression could be in encoding errors,
   as the new methods handle binary files directly instead of receiving
   strings. This would imply an issue with python-apt.

[original description]
There has been an API change in focal/eoan for python3-apt >= 1.9, and the package changer now raises exceptions:

AttributeError: module 'apt_pkg' has no attribute 'rewrite_section'

Related branches

Simon Poirier (simpoir) on 2019-10-28
Changed in landscape-client:
importance: Undecided → High
status: New → Triaged
Simon Poirier (simpoir) on 2019-11-13
Changed in landscape-client:
status: Triaged → In Progress
assignee: nobody → Simon Poirier (simpoir)
description: updated
Simon Poirier (simpoir) on 2019-11-21
Changed in landscape-client:
status: In Progress → Fix Committed
Simon Poirier (simpoir) on 2020-03-19
description: updated
Changed in landscape-client (Ubuntu):
milestone: none → eoan-updates
Simon Poirier (simpoir) on 2020-03-19
Changed in landscape-client (Ubuntu Focal):
milestone: eoan-updates → none
status: New → Fix Released
Eric Desrochers (slashd) on 2020-03-23
Changed in landscape-client (Ubuntu Eoan):
status: New → In Progress
assignee: nobody → Simon Poirier (simpoir)
importance: Undecided → Medium
tags: added: sts
tags: added: sts-sponsor-slashd
Eric Desrochers (slashd) wrote :

Sponsored in Eoan

Thanks Simon !

tags: removed: sts-sponsor-slashd

Hello Simon, or anyone else affected,

Accepted landscape-client into eoan-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, what testing has been performed on the package and change the tag from verification-needed-eoan to verification-done-eoan. If it does not fix the bug for you, please add a comment stating that, and change the tag to verification-failed-eoan. 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 . 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 landscape-client (Ubuntu Eoan):
status: In Progress → Fix Committed
tags: added: verification-needed verification-needed-eoan
Simon Poirier (simpoir) wrote :

I've verified the proposed package by upgrading a client to the eoan-proposed package and applying a new package profile though the Landscape web UI.
Profile applied as expected with the proposed version.

tags: added: verification-done verification-done-eoan
removed: verification-needed verification-needed-eoan
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers