platform.linux_distribution has been removed from Python3.8

Bug #1864993 reported by Albert Damen
56
This bug affects 11 people
Affects Status Importance Assigned to Milestone
ceph-deploy (Ubuntu)
Invalid
Undecided
Unassigned
Focal
Fix Released
High
James Page

Bug Description

[Impact]
ceph-deploy is not usable with Python >= 3.8 as found in Ubuntu Focal.

[Test Case]
Initialise ceph deployment using ceph-deploy using Ubuntu 20.04 LTS machines
Errors with "RuntimeError: AttributeError: module 'platform' has no attribute 'linux_distribution'"

[Where problems could occur]
The commit that fixes this issue is typically Pythonic and should have both good forwards and backwards compatiblity; its accepted upstream and present in later releases (2.1.0).

[Original Bug Report]
Running ceph-deploy in focal, using python3.8, results in an error message:

[ceph_deploy][ERROR ] RuntimeError: AttributeError: module 'platform' has no attribute 'linux_distribution'

It turns out platform.linux_distribution has been removed from python 3.8
(bpo-28167: Remove platform.linux_distribution, which was deprecated since 3.5.)

One option may be to use the new distro module from https://pypi.org/project/distro/

As ceph-deploy already can use os-release as a fall-back option, I changed ceph-deploy to use that as the first option and could create a working ceph cluster.

--- /usr/lib/python3/dist-packages/ceph_deploy/hosts/remotes.py.bak 2020-02-21 16:12:36.716000000 +0000
+++ /usr/lib/python3/dist-packages/ceph_deploy/hosts/remotes.py 2020-02-21 16:13:14.376000000 +0000
@@ -13,10 +13,10 @@

 def platform_information(_linux_distribution=None):
     """ detect platform information from remote host """
- linux_distribution = _linux_distribution or platform.linux_distribution
- distro, release, codename = linux_distribution()
- if not distro:
- distro, release, codename = parse_os_release()
+ #linux_distribution = _linux_distribution or platform.linux_distribution
+ #distro, release, codename = linux_distribution()
+ #if not distro:
+ distro, release, codename = parse_os_release()
     if not codename and 'debian' in distro.lower(): # this could be an empty string in Debian
         debian_codenames = {
             '10': 'buster',

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

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

Changed in ceph-deploy (Ubuntu):
status: New → Confirmed
Revision history for this message
Florian 'rephlex' Panzer (rephlex) wrote :

issue confirmed, and fix also works for me.

Revision history for this message
Albert Damen (albrt) wrote :

James Page submitted a fix upstream:

https://github.com/ceph/ceph-deploy/pull/496

Revision history for this message
Malte Schmidt (maltris) wrote :

This is still relevant, but the ticket seems pretty abandoned. ceph-deploy 20.04 as said in the comments on GitHub, ships out of the box with the bug and is, without the workaround, pretty useless.

James Page (james-page)
Changed in ceph-deploy (Ubuntu):
status: Confirmed → Invalid
description: updated
Changed in ceph-deploy (Ubuntu Focal):
status: New → Triaged
importance: Undecided → High
assignee: nobody → James Page (james-page)
status: Triaged → In Progress
description: updated
Revision history for this message
James Page (james-page) wrote :

In the interest of not having this completely broken in Focal, I've picked my patch into the focal packaging and uploaded for the SRU team to review.

Revision history for this message
David A. Desrosiers (setuid) wrote :

Just a nudge, as it's been close to 1 month since the last update. Any positive progress with the ongoing SRU review for this one?

Revision history for this message
Timo Aaltonen (tjaalton) wrote : Please test proposed package

Hello Albert, or anyone else affected,

Accepted ceph-deploy into focal-proposed. The package will build now and be available at https://launchpad.net/ubuntu/+source/ceph-deploy/2.0.1-0ubuntu1.1 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 ceph-deploy (Ubuntu Focal):
status: In Progress → Fix Committed
tags: added: verification-needed verification-needed-focal
Revision history for this message
Albert Damen (albrt) wrote :

I created 2 vm's using focal-server-cloudimg-amd64.img dd 2022-10-21
Using ceph-deploy 2.0.1-0ubuntu1 reproduced the original error

After upgrading to ceph-deploy 2.0.1-0ubuntu1.1 from proposed ceph-deploy works fine and the commands ceph-deploy new ceph1 and ceph-deploy install ceph1 complete successfully.

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 ceph-deploy - 2.0.1-0ubuntu1.1

---------------
ceph-deploy (2.0.1-0ubuntu1.1) focal; urgency=medium

  * d/p/py3.8-compat.patch: Cherry pick fix for compatibility with
    Python >= 3.8 (LP: #1864993).

 -- James Page <email address hidden> Fri, 23 Sep 2022 10:38:17 +0100

Changed in ceph-deploy (Ubuntu Focal):
status: Fix Committed → Fix Released
Revision history for this message
Robie Basak (racb) wrote : Update Released

The verification of the Stable Release Update for ceph-deploy 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.

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

Other bug subscribers

Remote bug watches

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