lsb_release doesn't report a codename

Bug #1069141 reported by Pedro Côrte-Real
32
This bug affects 6 people
Affects Status Importance Assigned to Milestone
Raspbian
Fix Released
Undecided
Unassigned

Bug Description

Here's the result of running lsb_release on an up to date version of raspbian:

$ lsb_release -a
No LSB modules are available.
Distributor ID: Debian
Description: Debian GNU/Linux testing/unstable
Release: testing/unstable
Codename: n/a

As you can see the Codename shows up as n/a, when it should show something like wheezy. This makes things like unattended-upgrades fail:

$ sudo unattended-upgrade
Traceback (most recent call last):
File "/usr/bin/unattended-upgrade", line 56, in
DISTRO_CODENAME = lsb_release.get_distro_information()['CODENAME']
KeyError: 'CODENAME'

Revision history for this message
peter green (plugwash) wrote :

Fix uploaded, it should hit the public repo on the next mirror run.

Changed in raspbian:
status: New → Fix Released
Revision history for this message
Samuel Krieg (samyboy1) wrote :

Still doesn't work using 2013-12-20-wheezy-raspbian.img
Same behaviour event if the package lsb-release is installed.

$ lsb_release -a
No LSB modules are available.
Distributor ID: Debian
Description: Debian GNU/Linux 7.2 (n/a)
Release: 7.2
Codename: n/a

Revision history for this message
Kyle Gordon (kylegordon) wrote :

So, this problem persists, and it negatively impacts the use of many Puppet modules that rely on the system codename being returned from lsb_release.

To fix it, edit /usr/share/pyshared/lsb_release.py and replace lookup_codename() with this version from Debian Wheezy, and update the v7 entry RELEASE_CODENAME_LOOKUP list.

RELEASE_CODENAME_LOOKUP = {
    '1.1' : 'buzz',
    '1.2' : 'rex',
    '1.3' : 'bo',
    '2.0' : 'hamm',
    '2.1' : 'slink',
    '2.2' : 'potato',
    '3.0' : 'woody',
    '3.1' : 'sarge',
    '4.0' : 'etch',
    '5.0' : 'lenny',
    '6.0' : 'squeeze',
    '7' : 'wheezy',
    }

def lookup_codename(release, unknown=None):
    m = re.match(r'(\d+)\.(\d+)(r(\d+))?', release)
    if not m:
        return unknown

    if int(m.group(1)) < 7:
        shortrelease = '%s.%s' % m.group(1,2)
    else:
        shortrelease = '%s' % m.group(1)
    return RELEASE_CODENAME_LOOKUP.get(shortrelease, unknown)

Revision history for this message
peter green (plugwash) wrote :

"Still doesn't work using 2013-12-20-wheezy-raspbian.img", "So, this problem persists"
I think what actually happened is it was fixed and then broke again.

Anyway this should be fixed in version 4.1+Debian8+rpi1+deb7u1 of the lsb packages , thanks to kyle gorden for the investigation.

Revision history for this message
Kyle Gordon (kylegordon) wrote :

Excellent, it's synced through, upgraded, and works as expected. Many thanks!

Kyle

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.