Apt "could not find a distribution template" error

Easy to fix Just do this

gksudo gedit /etc/lsb-release

Then edit the file that opens so that it looks like this

DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=10.04
DISTRIB_CODENAME=karmic
DISTRIB_DESCRIPTION="Ubuntu Karmic Koala"

Remember to enter which version of ubuntu you are using. I am using karmic koala so I put that in.

You can get a list here towards the bottom
http://en.wikipedia.org/wiki/Ubuntu_%28operating_system%29

Then go back to the terminal after you have saved the lsb-release file and you should be able to add-apt-repository


The content of /etc/lsb-release is invalid. You'll need to re-install the base-files package to restore its intended content. Unfortunately you can't just use apt-get for the job. Instead,

  1. go to https://launchpad.net/ubuntu/+source/base-files and look for the section for your Ubuntu release,

  2. download the most recent version of the package available for your release and architecture,

  3. run:

    sudo dpkg -i /your/path/to/base-files_*.deb
    
  4. Make a test run with

    sudo apt-get install --reinstall base-files