添加 apt-repository 时出错

添加 apt-repository 时出错

我尝试添加 ppa,但之后出现了以下消息。ppa 未添加,即不在 /etc/apt/sources.list.d 中。

$ sudo add-apt-repository -d ppa:fenics-packages/fenics
Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/httplib2/__init__.py", line 1363, in _conn_request
    conn.connect()
  File "/usr/lib/python3/dist-packages/httplib2/__init__.py", line 1139, in connect
    address_info = socket.getaddrinfo(host, port, 0, socket.SOCK_STREAM)
  File "/usr/lib/python3.10/socket.py", line 955, in getaddrinfo
    for res in _socket.getaddrinfo(host, port, family, type, proto, flags):
socket.gaierror: [Errno -2] Name or service not known

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/bin/add-apt-repository", line 364, in <module>
    sys.exit(0 if addaptrepo.main() else 1)
  File "/usr/bin/add-apt-repository", line 347, in main
    shortcut = handler(source, **shortcut_params)
  File "/usr/lib/python3/dist-packages/softwareproperties/shortcuts.py", line 40, in shortcut_handler
    return handler(shortcut, **kwargs)
  File "/usr/lib/python3/dist-packages/softwareproperties/ppa.py", line 82, in __init__
    if self.lpppa.publish_debug_symbols:
  File "/usr/lib/python3/dist-packages/softwareproperties/ppa.py", line 120, in lpppa
    self._lpppa = self.lpteam.getPPAByName(name=self.ppaname)
  File "/usr/lib/python3/dist-packages/softwareproperties/ppa.py", line 107, in lpteam
    self._lpteam = self.lp.people(self.teamname)
  File "/usr/lib/python3/dist-packages/softwareproperties/ppa.py", line 98, in lp
    self._lp = login_func("%s.%s" % (self.__module__, self.__class__.__name__),
  File "/usr/lib/python3/dist-packages/launchpadlib/launchpad.py", line 494, in login_anonymously
    return cls(
  File "/usr/lib/python3/dist-packages/launchpadlib/launchpad.py", line 230, in __init__
    super(Launchpad, self).__init__(
  File "/usr/lib/python3/dist-packages/lazr/restfulclient/resource.py", line 477, in __init__
    self._browser.get(root_resource), 'application/json')
  File "/usr/lib/python3/dist-packages/lazr/restfulclient/_browser.py", line 439, in get
    response, content = self._request(url, extra_headers=headers)
  File "/usr/lib/python3/dist-packages/lazr/restfulclient/_browser.py", line 389, in _request
    response, content = self._request_and_retry(
  File "/usr/lib/python3/dist-packages/lazr/restfulclient/_browser.py", line 359, in _request_and_retry
    response, content = self._connection.request(
  File "/usr/lib/python3/dist-packages/httplib2/__init__.py", line 1725, in request
    (response, content) = self._request(
  File "/usr/lib/python3/dist-packages/launchpadlib/launchpad.py", line 144, in _request
    response, content = super(LaunchpadOAuthAwareHttp, self)._request(
  File "/usr/lib/python3/dist-packages/lazr/restfulclient/_browser.py", line 184, in _request
    return super(RestfulHttp, self)._request(
  File "/usr/lib/python3/dist-packages/httplib2/__init__.py", line 1441, in _request
    (response, content) = self._conn_request(conn, request_uri, method, body, headers)
  File "/usr/lib/python3/dist-packages/httplib2/__init__.py", line 1370, in _conn_request
    raise ServerNotFoundError("Unable to find the server at %s" % conn.host)
httplib2.error.ServerNotFoundError: Unable to find the server at api.launchpad.test

请注意,这不是 ppa 的问题,因为我已经尝试了其他几个 ppa。此外,我还尝试过清除 software-properties-common,但问题仍未解决。

以下是我的系统的信息:

$ lsb_release -rd
Description: Ubuntu 22.04.2 LTS
Release: 22.04

这是该包的版本:

$ apt-cache policy software-properties-common
software-properties-common:
  Installé : 0.99.22.7
  Candidat : 0.99.22.7
 Table de version :
 *** 0.99.22.7 500
        500 http://fr.archive.ubuntu.com/ubuntu jammy-updates/main amd64 Packages
        500 http://fr.archive.ubuntu.com/ubuntu jammy-updates/main i386 Packages
        100 /var/lib/dpkg/status
     0.99.22 500
        500 http://fr.archive.ubuntu.com/ubuntu jammy/main amd64 Packages
        500 http://fr.archive.ubuntu.com/ubuntu jammy/main i386 Packages

以下是 software-properties-common 所依赖的其他软件包的版本:

$ apt-cache policy python3-software-properties
python3-software-properties:
  Installé : 0.99.22.7
  Candidat : 0.99.22.7
 Table de version :
 *** 0.99.22.7 500
        500 http://fr.archive.ubuntu.com/ubuntu jammy-updates/main amd64 Packages
        500 http://fr.archive.ubuntu.com/ubuntu jammy-updates/main i386 Packages
        100 /var/lib/dpkg/status
     0.99.22 500
        500 http://fr.archive.ubuntu.com/ubuntu jammy/main amd64 Packages
        500 http://fr.archive.ubuntu.com/ubuntu jammy/main i386 Packages

$ apt-cache policy python-apt-common
python-apt-common:
  Installé : 2.4.0ubuntu1
  Candidat : 2.4.0ubuntu1
 Table de version :
 *** 2.4.0ubuntu1 500
        500 http://fr.archive.ubuntu.com/ubuntu jammy-updates/main amd64 Packages
        500 http://fr.archive.ubuntu.com/ubuntu jammy-updates/main i386 Packages
        100 /var/lib/dpkg/status
     2.3.0ubuntu2 500
        500 http://fr.archive.ubuntu.com/ubuntu jammy/main amd64 Packages
        500 http://fr.archive.ubuntu.com/ubuntu jammy/main i386 Packages

答案1

出现了一个错误,现已解决。请参阅他们的官方消息

我们已经恢复了前端配置的相关部分,现在这个问题已经解决了。但是,如果您仍然看到程序失败并出现提及 api.launchpad.test 的错误,那么您需要运行rm -rf ~/.launchpadlib/api.launchpad.net/cache/并重试。(不幸的是,从糟糕的缓存数据生命周期中自动恢复很难!)

答案2

尝试一下:

sudo apt-get install python3-launchpadlib

帮我解决了这个问题。

相关内容