Can't use lsb_release on Ubuntu Core 16

Bug #1662357 reported by Brian Murray
20
This bug affects 4 people
Affects Status Importance Assigned to Milestone
Snappy
New
Undecided
Unassigned
Ubuntu Core Project
New
Undecided
Unassigned
lsb
Invalid
Undecided
Unassigned
lsb (Ubuntu)
Invalid
Undecided
Unassigned

Bug Description

brian-murray@localhost:~$ snap list
Name Version Rev Developer Notes
core 16.04.1 888 canonical -

brian-murray@localhost:~$ lsb_release
Traceback (most recent call last):
  File "/usr/bin/lsb_release", line 95, in <module>
    main()
  File "/usr/bin/lsb_release", line 59, in main
    distinfo = lsb_release.get_distro_information()
  File "/usr/lib/python3/dist-packages/lsb_release.py", line 383, in get_distro_information
    distinfo = guess_debian_release()
  File "/usr/lib/python3/dist-packages/lsb_release.py", line 281, in guess_debian_release
    get_distro_info(distinfo['ID'])
  File "/usr/lib/python3/dist-packages/lsb_release.py", line 41, in get_distro_info
    RELEASES_ORDER.sort(key=lambda n: float(n[0]))
  File "/usr/lib/python3/dist-packages/lsb_release.py", line 41, in <lambda>
    RELEASES_ORDER.sort(key=lambda n: float(n[0]))
ValueError: could not convert string to float: '16.04 LTS'

brian-murray@localhost:~$ lsb_release -a
Traceback (most recent call last):
  File "/usr/bin/lsb_release", line 95, in <module>
    main()
  File "/usr/bin/lsb_release", line 59, in main
    distinfo = lsb_release.get_distro_information()
  File "/usr/lib/python3/dist-packages/lsb_release.py", line 383, in get_distro_information
    distinfo = guess_debian_release()
  File "/usr/lib/python3/dist-packages/lsb_release.py", line 281, in guess_debian_release
    get_distro_info(distinfo['ID'])
  File "/usr/lib/python3/dist-packages/lsb_release.py", line 41, in get_distro_info
    RELEASES_ORDER.sort(key=lambda n: float(n[0]))
  File "/usr/lib/python3/dist-packages/lsb_release.py", line 41, in <lambda>
    RELEASES_ORDER.sort(key=lambda n: float(n[0]))
ValueError: could not convert string to float: '6.06 LTS'

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

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

Changed in lsb (Ubuntu):
status: New → Confirmed
Revision history for this message
SHIINA Hideaki (shiina) wrote :

This bug is quite different from bug #1619420.
The duplicate status is wrong.

SHIINA Hideaki (shiina)
no longer affects: lsb
Revision history for this message
SHIINA Hideaki (shiina) wrote :

My image is "Ubuntu Core 16 (GNU/Linux 4.4.0-1030-raspi2 armv7l)".
And, `snap list core` results are
  Name Version Rev Developer Notes
  core 16-2 1267 canonical -

It has same bug.

And, my classic snap environment has same bug.
`snap list classic` results are
  Name Version Rev Developer Notes
  classic 16.04 17 canonical devmode

Because of this bug, snapcraft with plugin python can't work .

Revision history for this message
SHIINA Hideaki (shiina) wrote :

I modified the file '/usr/share/pyshared/lsb_release.py'.
And, It works well.

41c41
< RELEASES_ORDER.sort(key=lambda n: float(n[0].split()[0]))
---
> RELEASES_ORDER.sort(key=lambda n: float(n[0]))

But, I don't know how to tell it to the person in charge.

Changed in lsb:
status: New → Confirmed
Revision history for this message
Mateus Ferreira (dalbinaco) wrote :

Also happening to me when I try to `sudo add-apt-repository`

Revision history for this message
Mateus Ferreira (dalbinaco) wrote :

#4 Didn't work for me. I still get:

Traceback (most recent call last):
  File "/usr/bin/add-apt-repository", line 95, in <module>
    sp = SoftwareProperties(options=options)
  File "/usr/lib/python3/dist-packages/softwareproperties/SoftwareProperties.py", line 114, in __init__
    self.reload_sourceslist()
  File "/usr/lib/python3/dist-packages/softwareproperties/SoftwareProperties.py", line 607, in reload_sourceslist
    self.distro.get_sources(self.sourceslist)
  File "/usr/lib/python3/dist-packages/aptsources/distro.py", line 89, in get_sources
    (self.id, self.codename))
aptsources.distro.NoDistroTemplateException: Error: could not find a distribution template for Ubuntu/n/a

Oliver Grawert (ogra)
Changed in lsb:
status: Confirmed → Invalid
Changed in lsb (Ubuntu):
status: Confirmed → Invalid
Revision history for this message
Alan AZZERA (azzera-alan) wrote :

Hi, why this bug is invalid ? I just ran into it after upgrading from Ubuntu 18.04 to 20.04. After finding and applying with success the fix of @shiina, I downloaded the package lsb-release_11.0.1ubuntu1_all.deb, wich still contains the line RELEASES_ORDER.sort(key=lambda n: float(n[0])) in the file /usr/share/pyshared/lsb_release.py. So, it seems there's only 2 possibilities :
- the bug is still here and nobody relies anymore on lsb_release ;
- there is another problem somewhere in my system.

Revision history for this message
Oliver Grawert (ogra) wrote :

first of all the bug is a duplicate, secondly you can not install deb packages on Ubuntu Core, snap packages (of which Ubuntu Core is built) do use /etc/os-release. Additionally Ubuntu Core only ships the most minimal set of python ...

If you see an issue on a Classic Ubuntu installation newer than Ubuntu Core 16, you should open a new bug.

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.