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!!
python
orpython3
which means Ubuntu tools that were built and rely on a specific version of python will no longer work. What do you get forpython -V; python3 -V
? (you should get two lines of output)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 wouldapt-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