当我运行 add-apt-repository
的时候,遇到如下错误。
➜ zigbeegateway sudo add-apt-repository http://devtools.silabs.com/solutions/apt
Traceback (most recent call last):
File "/usr/bin/add-apt-repository", line 95, in <module>
sp = SoftwareProperties(options=options)
File "/usr/lib/python3/dist-packages/softwareproperties/SoftwareProperties.py", line 109, in __init__
self.reload_sourceslist()
File "/usr/lib/python3/dist-packages/softwareproperties/SoftwareProperties.py", line 599, in reload_sourceslist
self.distro.get_sources(self.sourceslist)
File "/usr/lib/python3/dist-packages/aptsources/distro.py", line 93, in get_sources
(self.id, self.codename))
aptsources.distro.NoDistroTemplateException: Error: could not find a distribution template for Raspbian/buster
提示找不到 Raspbian/buster模板,于是查看模板文件
➜ ~ ls -l /usr/share/python-apt/templates/*.info
-rw-r--r-- 1 root root 11599 3月 11 2019 /usr/share/python-apt/templates/Blankon.info
-rw-r--r-- 1 root root 8156 3月 11 2019 /usr/share/python-apt/templates/Debian.info
-rw-r--r-- 1 root root 1590 3月 11 2019 /usr/share/python-apt/templates/gNewSense.info
-rw-r--r-- 1 root root 138 1月 26 15:00 /usr/share/python-apt/templates/Raspbian.info
-rw-r--r-- 1 root root 1169 3月 11 2019 /usr/share/python-apt/templates/Tanglu.info
-rw-r--r-- 1 root root 85596 3月 11 2019 /usr/share/python-apt/templates/Ubuntu.info
➜ ~
确实没有相关模板,我们可以自己创建一个
pi@raspberrypi:~ $ cat /usr/share/python-apt/templates/Raspbian.info
Suite: buster
RepositoryType: deb
BaseURI: http://raspbian.raspberrypi.org/raspbian/
MatchURI: http://raspbian.raspberrypi.org/raspbian/
再次执行add-apt-repository
,成功。查看cat etc/apt/sources.list
➜ ~ cat /etc/apt/sources.list
deb http://raspbian.raspberrypi.org/raspbian/ buster main contrib non-free rpi
# Uncomment line below then 'apt-get update' to enable 'apt-get source'
# deb-src http://raspbian.raspberrypi.org/raspbian/ buster main contrib non-free rpideb http://devtools.silabs.com/solutions/apt stretch main
deb http://devtools.silabs.com/solutions/apt buster main
# deb-src http://devtools.silabs.com/solutions/apt buster main
成功。