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

使用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 安装优麒麟应用商店的坑

你可能感兴趣的:(ubuntu)