0

every time I try to add a PPA the terminal seems to stop. After a few minutes of nothing happening I press ctrl-c and several erros messages appear. This was me trying to add mozilla ppa.

$ sudo add-apt-repository ppa:ubuntu-mozilla-daily/ppa
^CTraceback (most recent call last):
  File "/usr/bin/add-apt-repository", line 137, in <module>
    shortcut = shortcut_handler(line)
  File "/usr/lib/python3/dist-packages/softwareproperties/SoftwareProperties.py", line 884, in shortcut_handler
    ret = factory(shortcut)
  File "/usr/lib/python3/dist-packages/softwareproperties/ppa.py", line 469, in shortcut_handler
    return PPAShortcutHandler(shortcut)
  File "/usr/lib/python3/dist-packages/softwareproperties/ppa.py", line 426, in __init__
    info = get_ppa_info(self.shortcut)
  File "/usr/lib/python3/dist-packages/softwareproperties/ppa.py", line 380, in get_ppa_info
    ret = get_ppa_info_from_lp(user, ppa)
  File "/usr/lib/python3/dist-packages/softwareproperties/ppa.py", line 110, in get_ppa_info_from_lp
    return get_info_from_lp(lp_url)
  File "/usr/lib/python3/dist-packages/softwareproperties/ppa.py", line 104, in get_info_from_lp
    return get_info_from_https(lp_url, True)
  File "/usr/lib/python3/dist-packages/softwareproperties/ppa.py", line 96, in get_info_from_https
    data = func(lp_url=url, accept_json=accept_json, retry_delays=retry_delays)
  File "/usr/lib/python3/dist-packages/softwareproperties/ppa.py", line 138, in _get_https_content_py3
    lp_page = urllib.request.urlopen(request,
  File "/usr/lib/python3.8/urllib/request.py", line 222, in urlopen
    return opener.open(url, data, timeout)
  File "/usr/lib/python3.8/urllib/request.py", line 525, in open
    response = self._open(req, data)
  File "/usr/lib/python3.8/urllib/request.py", line 542, in _open
    result = self._call_chain(self.handle_open, protocol, protocol +
  File "/usr/lib/python3.8/urllib/request.py", line 502, in _call_chain
    result = func(*args)
  File "/usr/lib/python3.8/urllib/request.py", line 1369, in https_open
    return self.do_open(http.client.HTTPSConnection, req,
  File "/usr/lib/python3.8/urllib/request.py", line 1326, in do_open
    h.request(req.get_method(), req.selector, req.data, headers,
  File "/usr/lib/python3.8/http/client.py", line 1240, in request
    self._send_request(method, url, body, headers, encode_chunked)
  File "/usr/lib/python3.8/http/client.py", line 1286, in _send_request
    self.endheaders(body, encode_chunked=encode_chunked)
  File "/usr/lib/python3.8/http/client.py", line 1235, in endheaders
    self._send_output(message_body, encode_chunked=encode_chunked)
  File "/usr/lib/python3.8/http/client.py", line 1006, in _send_output
    self.send(msg)
  File "/usr/lib/python3.8/http/client.py", line 946, in send
    self.connect()
  File "/usr/lib/python3.8/http/client.py", line 1402, in connect
    super().connect()
  File "/usr/lib/python3.8/http/client.py", line 917, in connect
    self.sock = self._create_connection(
  File "/usr/lib/python3.8/socket.py", line 796, in create_connection
    sock.connect(sa)
KeyboardInterrupt

This was me trying to add the boot-repair repository:

sudo add-apt-repository ppa:yannubuntu/boot-repair
^CTraceback (most recent call last):
  File "/usr/bin/add-apt-repository", line 137, in <module>
    shortcut = shortcut_handler(line)
  File "/usr/lib/python3/dist-packages/softwareproperties/SoftwareProperties.py", line 884, in shortcut_handler
    ret = factory(shortcut)
  File "/usr/lib/python3/dist-packages/softwareproperties/ppa.py", line 469, in shortcut_handler
    return PPAShortcutHandler(shortcut)
  File "/usr/lib/python3/dist-packages/softwareproperties/ppa.py", line 426, in __init__
    info = get_ppa_info(self.shortcut)
  File "/usr/lib/python3/dist-packages/softwareproperties/ppa.py", line 380, in get_ppa_info
    ret = get_ppa_info_from_lp(user, ppa)
  File "/usr/lib/python3/dist-packages/softwareproperties/ppa.py", line 110, in get_ppa_info_from_lp
    return get_info_from_lp(lp_url)
  File "/usr/lib/python3/dist-packages/softwareproperties/ppa.py", line 104, in get_info_from_lp
    return get_info_from_https(lp_url, True)
  File "/usr/lib/python3/dist-packages/softwareproperties/ppa.py", line 96, in get_info_from_https
    data = func(lp_url=url, accept_json=accept_json, retry_delays=retry_delays)
  File "/usr/lib/python3/dist-packages/softwareproperties/ppa.py", line 138, in _get_https_content_py3
    lp_page = urllib.request.urlopen(request,
  File "/usr/lib/python3.8/urllib/request.py", line 222, in urlopen
    return opener.open(url, data, timeout)
  File "/usr/lib/python3.8/urllib/request.py", line 525, in open
    response = self._open(req, data)
  File "/usr/lib/python3.8/urllib/request.py", line 542, in _open
    result = self._call_chain(self.handle_open, protocol, protocol +
  File "/usr/lib/python3.8/urllib/request.py", line 502, in _call_chain
    result = func(*args)
  File "/usr/lib/python3.8/urllib/request.py", line 1369, in https_open
    return self.do_open(http.client.HTTPSConnection, req,
  File "/usr/lib/python3.8/urllib/request.py", line 1326, in do_open
    h.request(req.get_method(), req.selector, req.data, headers,
  File "/usr/lib/python3.8/http/client.py", line 1240, in request
    self._send_request(method, url, body, headers, encode_chunked)
  File "/usr/lib/python3.8/http/client.py", line 1286, in _send_request
    self.endheaders(body, encode_chunked=encode_chunked)
  File "/usr/lib/python3.8/http/client.py", line 1235, in endheaders
    self._send_output(message_body, encode_chunked=encode_chunked)
  File "/usr/lib/python3.8/http/client.py", line 1006, in _send_output
    self.send(msg)
  File "/usr/lib/python3.8/http/client.py", line 946, in send
    self.connect()
  File "/usr/lib/python3.8/http/client.py", line 1402, in connect
    super().connect()
  File "/usr/lib/python3.8/http/client.py", line 917, in connect
    self.sock = self._create_connection(
  File "/usr/lib/python3.8/socket.py", line 796, in create_connection
    sock.connect(sa)
KeyboardInterrupt

UPDATE:

After I run with python3 -m trace --trace which add-apt-repository ppa:ubuntu-mozilla-daily/ppa like suggested, that's the result:

Traceback (most recent call last):
  File "/usr/lib/python3.8/runpy.py", line 193, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "/usr/lib/python3.8/runpy.py", line 86, in _run_code
    exec(code, run_globals)
  File "/usr/lib/python3.8/trace.py", line 755, in <module>
    main()
  File "/usr/lib/python3.8/trace.py", line 743, in main
    t.runctx(code, globs, globs)
  File "/usr/lib/python3.8/trace.py", line 449, in runctx
    exec(cmd, globals, locals)
  File "/usr/bin/add-apt-repository", line 21, in <module>
    sys.stdout = io.TextIOWrapper(
  File "/usr/bin/add-apt-repository", line 21, in <module>
    sys.stdout = io.TextIOWrapper(
  File "/usr/lib/python3.8/trace.py", line 590, in localtrace_trace
    print("%s(%d): %s" % (bname, lineno,
ValueError: underlying buffer has been detached
Exception ignored in: <_io.TextIOWrapper mode='w' encoding='utf-8'>
ValueError: underlying buffer has been detached

UPDATE: I just tryed to manually add the ppa here: /etc/apt/sources.list and importing the GPG key and it worked. So I think something is wrong with my apt maybe?

LAST UPDATE: it seems to be working normally right now. Idk exactly what of all the things I did repair the problem and why only now, a few days later, it is working, but ubuntu seems to self heal sometimes lol.

Anyway, ty so much for the help!!

6
  • I suspect you've made changes to python or python3 which means Ubuntu tools that were built and rely on a specific version of python will no longer work. What do you get for python -V; python3 -V ? (you should get two lines of output) – guiverc Aug 17 '20 at 20:49
  • @guiverc I get this: Python 2.7.18rc1 Python 3.8.2 – Nikolai J. Kotsifas Aug 17 '20 at 22:06
  • I'm not on 20.04 currently to confirm, but you should get 3.8.2 for both; the result for python I take it is the one that gave an incorrect value. Your issue is 2.7.18 wherever that comes from (and I don't see it from any supported Ubuntu release; packages.ubuntu.com/…) I would apt-cache policy python and suspect you've added 3rd party packages (PPA or other) and/or have made a script change that forced an alternative to work back on bionic maybe that no longer works on *focal – guiverc Aug 17 '20 at 22:44
  • I'm on Ubuntu 20, and python isn't even installed by default, or at least it isn't in the path. I think you only need python3 – xpusostomos Aug 18 '20 at 6:09
  • @xpusostomos I did it and editted my question with the results. – Nikolai J. Kotsifas Aug 18 '20 at 10:51
0

When you hit Ctrl-C it is dying in sock.connect, which means it is trying and waiting to connect to the remote host. Either there's something wrong with that host or the network you are connected to has some impediment to getting to that host.

6
  • I tried with different PPA's and it's always the same. Any idea on how to fix? – Nikolai J. Kotsifas Aug 17 '20 at 22:07
  • Do you have any proxies or corporate firewalls between you and the internet? – xpusostomos Aug 18 '20 at 2:00
  • No, I don't use any firewall. – Nikolai J. Kotsifas Aug 18 '20 at 2:48
  • You could try running python with tracing to see if it sheds any light: – xpusostomos Aug 18 '20 at 6:15
  • python3 -m trace --trace `which add-apt-repository` ppa:ubuntu-mozilla-daily/ppa – xpusostomos Aug 18 '20 at 6:15

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.