For Debian >= 10 distro can't get the minor version.
This worked for Debian <= 9 at least when you have the lsb-release Debian package installed with distro.version(best=True) because lsb_release -a returned the major and minor version in the Release key:
$ cat /etc/os-release
PRETTY_NAME="Debian GNU/Linux 9 (stretch)"
NAME="Debian GNU/Linux"
VERSION_ID="9"
VERSION="9 (stretch)"
VERSION_CODENAME=stretch
ID=debian
HOME_URL="https://www.debian.org/"
SUPPORT_URL="https://www.debian.org/support"
BUG_REPORT_URL="https://bugs.debian.org/"
$ lsb_release -a
No LSB modules are available.
Distributor ID: Debian
Description: Debian GNU/Linux 9.12 (stretch)
Release: 9.12
Codename: stretch
But with Debian >= 10 the Release key from lsb_release -a only has the major version:
$ cat /etc/os-release
PRETTY_NAME="Debian GNU/Linux 10 (buster)"
NAME="Debian GNU/Linux"
VERSION_ID="10"
VERSION="10 (buster)"
VERSION_CODENAME=buster
ID=debian
HOME_URL="https://www.debian.org/"
SUPPORT_URL="https://www.debian.org/support"
BUG_REPORT_URL="https://bugs.debian.org/"
$ lsb_release -a
No LSB modules are available.
Distributor ID: Debian
Description: Debian GNU/Linux 10 (buster)
Release: 10
Codename: buster
For Debian >= 10 the only source for the minor version is file /etc/debian_version.
The /etc/debian_version file exists for years, even on older Debian versions, with a stable format (major.minor, with the exception that Debian <= 6 has major.minor.patch).
So maybe you can consider to parse /etc/debian_version to get the minor version.
For Debian >= 10 distro can't get the minor version.
This worked for Debian <= 9 at least when you have the
lsb-releaseDebian package installed withdistro.version(best=True)becauselsb_release -areturned the major and minor version in theReleasekey:But with Debian >= 10 the
Releasekey fromlsb_release -aonly has the major version:For Debian >= 10 the only source for the minor version is file
/etc/debian_version.The
/etc/debian_versionfile exists for years, even on older Debian versions, with a stable format (major.minor, with the exception that Debian <= 6 has major.minor.patch).So maybe you can consider to parse
/etc/debian_versionto get the minor version.