我尝试添加各种第三方存储库,但都出现相同的错误。
当我尝试通过 GUI 的“其他软件”部分添加第三方存储库时,我可以打开框来添加它,但它不会添加到列表中。
当我尝试从终端添加存储库时,我得到以下输出。
pal@pal-Vostro-3546:~$ sudo apt-add-repository -y ppa:teejee2008/ppa
[sudo] password for pal:
Traceback (most recent call last):
File "/usr/lib/python3/dist-packages/softwareproperties/ppa.py", line 358, in get_ppa_info
ret = get_ppa_info_from_lp(user, ppa)
File "/usr/lib/python3/dist-packages/softwareproperties/ppa.py", line 94, in get_ppa_info_from_lp
return get_info_from_lp(lp_url)
File "/usr/lib/python3/dist-packages/softwareproperties/ppa.py", line 88, in get_info_from_lp
return _get_https_content_py3(lp_url)
File "/usr/lib/python3/dist-packages/softwareproperties/ppa.py", line 112, in _get_https_content_py3
lp_page = urllib.request.urlopen(request, cafile=LAUNCHPAD_PPA_CERT)
File "/usr/lib/python3.5/urllib/request.py", line 153, in urlopen
capath=capath)
File "/usr/lib/python3.5/ssl.py", line 478, in create_default_context
context.load_verify_locations(cafile, capath, cadata)
ssl.SSLError: unknown error (_ssl.c:3172)
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/bin/apt-add-repository", line 122, in <module>
shortcut = shortcut_handler(line)
File "/usr/lib/python3/dist-packages/softwareproperties/SoftwareProperties.py", line 864, in shortcut_handler
ret = factory(shortcut)
File "/usr/lib/python3/dist-packages/softwareproperties/ppa.py", line 430, in shortcut_handler
return PPAShortcutHandler(shortcut)
File "/usr/lib/python3/dist-packages/softwareproperties/ppa.py", line 387, in __init__
info = get_ppa_info(self.shortcut)
File "/usr/lib/python3/dist-packages/softwareproperties/ppa.py", line 370, in get_ppa_info
_get_suggested_ppa_message(user, ppa))
File "/usr/lib/python3/dist-packages/softwareproperties/ppa.py", line 327, in _get_suggested_ppa_message
lp_user = get_info_from_lp(LAUNCHPAD_USER_API % user)
File "/usr/lib/python3/dist-packages/softwareproperties/ppa.py", line 88, in get_info_from_lp
return _get_https_content_py3(lp_url)
File "/usr/lib/python3/dist-packages/softwareproperties/ppa.py", line 112, in _get_https_content_py3
lp_page = urllib.request.urlopen(request, cafile=LAUNCHPAD_PPA_CERT)
File "/usr/lib/python3.5/urllib/request.py", line 153, in urlopen
capath=capath)
File "/usr/lib/python3.5/ssl.py", line 478, in create_default_context
context.load_verify_locations(cafile, capath, cadata)
ssl.SSLError: unknown error (_ssl.c:3172)
造成此错误的原因是什么?我该如何解决?
答案1
看起来问题是由于之前的安装损坏或不完整,或者源列表损坏造成的。
解决该问题的方法是使用下面的行重新配置安装。
sudo dpkg --configure -a
通过谷歌搜索,我首先删除了来源列表,但看来这实际上并不是必需的,但值得一提,以防上述操作失败。
sudo rm -f /etc/apt/sources.list.d/*
为了记录,我使用的是 Ubuntu 18.04。