Ubuntu16.04使用sudo add-apt-repository时报错:aptsources.distro.NoDistroTemplateException

  • Post author:
  • Post category:其他


使用

sudo add-apt-repository

时候,系统报错:

Traceback (most recent call last):
  File "/usr/bin/add-apt-repository", line 96, 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 Kylin/kylin


原因:


我装了ukylin优麒麟系统的软件(ukylin-wine和ukylin-wechat),导致Ubuntu的系统配置

lsb-release

文件被修改了。而且系统设置中的

software&updates

都打不开了!

可以看到

/etc/lsb-release

文件的内容变成了这样:

DISTRIB_ID=Kylin
DISTRIB_RELEASE=V10
DISTRIB_CODENAME=kylin
DISTRIB_DESCRIPTION="Kylin V10 SP1"
DISTRIB_KYLIN_RELEASE=V10
DISTRIB_VERSION_TYPE=enterprise
DISTRIB_VERSION_MODE=normal


解决方法:


修改

/etc/lsb-release

里面的内容:

DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=16.04
DISTRIB_CODENAME=xenial
DISTRIB_DESCRIPTION="Ubuntu 16.04.5 LTS"


注:

具体的发型号是16.04的那个版本我忘了,随便写个

16.04.5

吧。


参考:


  1. Ubuntu安装软件时报错:aptsources.distro.NoDistroTemplateException: Error:Could not find a distribution templ

  2. Ubuntu18.04.5 LTS 安装优麒麟应用商店的坑



版权声明:本文为weixin_46474546原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。