:: [devuan-dev] bug#468: marked as don…
Top Page
Delete this message
Reply to this message
Author: Devuan bug Tracking System
To: Mark Hindley
Subject: [devuan-dev] bug#468: marked as done (python platform.linux_distribution() returns debian)
Your message dated Tue, 24 Jan 2023 17:17:49 +0000
with message-id <Y9ASvbMAw0lc6BV7@???>
and subject line Re: bug#468: python platform.linux_distribution() returns debian
has caused the Devuan bug report #468,
regarding python platform.linux_distribution() returns debian
to be marked as done.

This means that you claim that the problem has been dealt with.
If this is not the case it is now your responsibility to reopen the
bug report if necessary, and/or fix the problem forthwith.

(NB: If you are a system administrator and have no idea what this
message is talking about, this may indicate a serious mail system
misconfiguration somewhere. Please contact owner@???

468: https://bugs.devuan.org/cgi/bugreport.cgi?bug=468
Devuan Bug Tracking System
Contact owner@??? with problems
Package: libpython2.7-minimal
Version: 2.7.13

Environment in which bug seen: Devuan 2.1 (ascii)

Problem behaviour: python function platform.linux_distribution() returns
"debian" instead of "devuan"

To reproduce:

(from command-line):

(from python prompt):
import platform

(should return: "('debian','9','')"


Test fix:

platform.linux_distribution() tries to use the file /etc/lsb-release.
This doesn't appear to exist either in Debian stretch or Devuan ascii -
unless it's present in a package which isn't included in the default
install. Creating it with appropriate values fixes the problem:

Check whether /etc/lsb-release exists: it shouldn't, - but if so,
rename it (and rename it back after the test).

lsb_release -a > /etc/lsb-release

Edit /etc/lsb-release and change as follows:

"Distributor ID: " => "DISTRIB_ID="
"Description: " => "DISTRIB_DESCRIPTION="
"Release: "     => "DISTRIB_RELEASE="
"Codename: "    => "DISTRIB_CODENAME="

Above test should now return: "('Devuan','2.1','ascii')"

Additional information:

The problem is apparently caused by the combination of the absence
of /etc/lsb-release, and the presence of /etc/debian_release. The
algorithm in platform.linux_distribution() is apparently to try
reading /etc/lsb-release, and if it doesn't exist, look for any file
matching /etc/*_(version|release)

The bug also exists in python3 (package libpython3.5-minimal, version
3.5.3) - to reproduce, repeat the above test using "python3" instead of

The bug also exists in beowulf

Not sure whether above "fix" is feasible in practice - maybe other
python-based packages rely on getting back "debian" from

This problem came to light because it breaks the waagent package -
because it believes that it's running on debian, waagent tries to use
systemd-based commands and functions. I'm currently working this
problem, but I'm approaching it by putting in place internal tests to
ascertain whether debian or devuan, rather than relying on a
system-level fix.

platform.linux_distribution() is deprecated and slated for removal

If it's decided that this can be safely fixed by
creating /etc/lsb-release, one question needs answering: whether to
lowercase the DISTRIB_ID field, or to leave it as returned by


I am going to close this as libpython2.7-minimal was removed from Debian[1] and
the python3 platform library doesn't have linux_distribution().


[1] https://bugs.debian.org/1027108