Apt“找不到分发模板”错误

当我尝试使用apt-get安装任何东西时,我收到以下错误:

Traceback (most recent call last): File "/usr/bin/add-apt-repository", line 60, in  sp = SoftwareProperties() File "/usr/lib/python2.6/dist-packages/softwareproperties/SoftwareProperties.py", line 90, in __init__ self.reload_sourceslist() File "/usr/lib/python2.6/dist-packages/softwareproperties/SoftwareProperties.py", line 538, in reload_sourceslist self.distro.get_sources(self.sourceslist) File "/usr/lib/python2.6/dist-packages/aptsources/distro.py", line 90, in get_sources raise NoDistroTemplateException("Error: could not find a " aptsources.distro.NoDistroTemplateException: Error: could not find a distribution template 

知道这意味着什么以及如何解决它?

易于修复只需这样做

 gksudo gedit /etc/lsb-release 

然后编辑打开的文件,使其看起来像这样

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

请记住输入您正在使用的ubuntu版本。 我正在使用业力考拉,所以我把它放进去了。

你可以在这里找到一个列表
http://en.wikipedia.org/wiki/Ubuntu_%28operating_system%29

然后在保存lsb-release文件后返回终端,您应该能够添加-apt-repository

/etc/lsb-release内容无效。 您需要重新安装base-files包以恢复其预期内容。 不幸的是,你不能只使用apt-get来完成工作。 代替,

  1. 转到https://launchpad.net/ubuntu/+source/base-files并查找Ubuntu版本的部分,

  2. 下载适用于您的发行版和体系结构的最新版本的软件包,

  3. 跑:

     sudo dpkg -i /your/path/to/base-files_*.deb 
  4. 进行测试

     sudo apt-get install --reinstall base-files