1

I can't open the software sources window from the software center. I can't use apt-get add-apt-repository (and other things).

The error I get with add-apt-repository is:

    Traceback (most recent call last):
  File "/usr/bin/add-apt-repository", line 160, in <module>
    sp = SoftwareProperties(options=options)
  File "/usr/lib/python2.7/dist-packages/softwareproperties/SoftwareProperties.py", line 96, in __init__
    self.reload_sourceslist()
  File "/usr/lib/python2.7/dist-packages/softwareproperties/SoftwareProperties.py", line 584, in reload_sourceslist
    self.distro.get_sources(self.sourceslist)    
  File "/usr/lib/python2.7/dist-packages/aptsources/distro.py", line 87, in get_sources
    raise NoDistroTemplateException("Error: could not find a "
aptsources.distro.NoDistroTemplateException: Error: could not find a distribution template

My old /etc/lsb-release looks like:

DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=12.10
DISTRIB_CODENAME=quantal
DISTRIB_DESCRIPTION="Ubuntu quantal (Development branch)"

I changed it to be:

DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=12.04
DISTRIB_CODENAME=precise
DISTRIB_DESCRIPTION="Ubuntu precise"

And suddenly things "work" again. I don't trust it, since I'm effecitvely lying that I have an earlier version. Why did I have to make this change? What can I do to get things working in a more sane fashion?

1

This will have changed which repositories apt-get was fetching software from. Previously it will have been trying to fetch software from the Development branch of quantals repositories. I would try editing the file to look like this:

DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=12.10
DISTRIB_CODENAME=quantal
DISTRIB_DESCRIPTION="Ubuntu quantal"

After editing the file run sudo apt-get update; sudo apt-get upgrade, and see if apt-get isntalling works.

2
  • I tried that, it didn't work. I then did a dist upgrade (since quantal is out now) which changed the file to look like yours (only difference is DISTRIB_DESCRIPTION="Ubuntu 12.10") and apt-get works. Got me why.
    – Eloff
    Apr 4 '13 at 19:55
  • Ubuntu Neon 20.04 user here. Changing /etc/lsb-release didn't help me. I had to change /usr/lib/os-release instead. Update can be verified by running lsb_release -idsa
    – chriscz
    Feb 16 at 10:35

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.