Addition of ppa repository failing intermittently

Bug #2039411 reported by Shubham Verma
24
This bug affects 4 people
Affects Status Importance Assigned to Milestone
software-properties (Ubuntu)
Confirmed
Undecided
Unassigned

Bug Description

I get following error intermittently when trying to add ppa repository:
$ sudo add-apt-repository ppa:~longsleep/ubuntu/golang-backports
Cannot add PPA: 'ppa:~longsleep/ubuntu/golang-backports'.
The user named '~longsleep' has no PPA named 'ubuntu/golang-backports'
Please choose from the following available PPAs:
 * 'bcmwl': bcmwl
 * 'couchdb': Apache CouchDB
 * 'couchdb-precise-backport': Apache CouchDB with Erlang 18 for precise
 * 'createrepo-backports': Createrepo Backports
 * 'firehol-backports': Firehol Backports
 * 'golang-backports': Golang Backports
 * 'golang-backports-dev': Golang Backports Dev
 * 'iridium-browser-dev': Iridium Browser Dev dependencies
 * 'pixel-extras': Pixel extras
 * 'python2.7-backports': Python 2.7 Backports
 * 'python3-m2crypto-backports': Python 3 M2Crypto backports
 * 'stuff': Stuff
 * 'ubuntu-pine64-flavour-makers': Ubuntu Pine64 Makers PPA

After multiple attempts, it may succeed, but the same above command sometimes may return following error as well (intermittently):
$ sudo add-apt-repository ppa:~longsleep/ubuntu/golang-backports
Traceback (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 885, 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 392, in get_ppa_info
    _get_suggested_ppa_message(user, ppa))
  File "/usr/lib/python3/dist-packages/softwareproperties/ppa.py", line 349, 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 104, in get_info_from_lp
    return get_info_from_https(lp_url, True)
  File "/usr/lib/python3/dist-packages/softwareproperties/ppa.py", line 98, in get_info_from_https
    return json.loads(data)
  File "/usr/lib/python3.8/json/__init__.py", line 357, in loads
    return _default_decoder.decode(s)
  File "/usr/lib/python3.8/json/decoder.py", line 337, in decode
    obj, end = self.raw_decode(s, idx=_w(s, 0).end())
  File "/usr/lib/python3.8/json/decoder.py", line 355, in raw_decode
    raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)

Revision history for this message
Macha Nitesh Goud (niteshmacha) wrote :

I am also facing similar issue with add repository with different ppa packages from last few days:

Cannot add PPA: 'ppa:~criu/ubuntu/ppa'.
The team named '~criu' has no PPA named 'ubuntu/ppa'
Please choose from the following available PPAs:
* 'ppa': CRIU PPA

Revision history for this message
Launchpad Janitor (janitor) wrote :

Status changed to 'Confirmed' because the bug affects multiple users.

Changed in software-properties (Ubuntu):
status: New → Confirmed
Revision history for this message
Manfred Hampl (m-hampl) wrote :

The correct PPA naming is ppa:longsleep/golang-backports and ppa:criu/ppa without tilde character and without "/ubuntu" in the middle.

Eventually the code of the script should be modified to cater for usage with wrong-named PPAs.

Revision history for this message
Oleg Grenrus (phadej) wrote (last edit ):

I facing this issue while doing just

    apt-add-repository -y 'ppa:hvr/ghc'

i.e. no `/ubungu` nor tilde. This is on Ubuntu 18.04, so maybe it's old apt-add-repository which does some rewriting?

E.g. in fresh buildpack-deps:bionic Docker container this fails 100% of the time

    apt-get update
    apt-get install -y --no-install-recommends gnupg ca-certificates dirmngr curl git software-properties-common libtinfo5
    apt-add-repository -y 'ppa:hvr/ghc'

Either with JSONDecodeError or with "Cannot add PPA: 'ppa:~hvr/ubuntu/ghc'."

EDIT: seems to work on focal.

Revision history for this message
Alfonso Sanchez-Beato (alfonsosanchezbeato) wrote :

I am seeing this on focal, when running command:

$ add-apt-repository ppa:snappy-dev/image -y

on 20.04. 22.04 seems to be fine.

The errors I see are of the same two types as those in the bug description:

<<
Cannot add PPA: 'ppa:~snappy-dev/ubuntu/image'.
The team named '~snappy-dev' has no PPA named 'ubuntu/image'
Please choose from the following available PPAs:
 * '15.04': DEPRECATED - WILL REMOVE SOON (Tools for Snappy 15.04)
 * 'beta': Snappy beta
 * 'edge': Snappy Edge
 * 'image': Packages used in constructing the Ubuntu Core component of Snappy
...
>>

or the backtrace:

<<
Traceback (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 885, 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 392, in get_ppa_info
    _get_suggested_ppa_message(user, ppa))
  File "/usr/lib/python3/dist-packages/softwareproperties/ppa.py", line 349, 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 104, in get_info_from_lp
    return get_info_from_https(lp_url, True)
  File "/usr/lib/python3/dist-packages/softwareproperties/ppa.py", line 98, in get_info_from_https
    return json.loads(data)
  File "/usr/lib/python3.8/json/__init__.py", line 357, in loads
    return _default_decoder.decode(s)
  File "/usr/lib/python3.8/json/decoder.py", line 337, in decode
    obj, end = self.raw_decode(s, idx=_w(s, 0).end())
  File "/usr/lib/python3.8/json/decoder.py", line 355, in raw_decode
    raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)
>>

Revision history for this message
Stu Tomlinson (nosnilmot) wrote :

The root cause of this is "Launchpad API randomly returns empty responses" https://bugs.launchpad.net/launchpad/+bug/2039251

Revision history for this message
Shubham Verma (shubhamv199) wrote :

Thanks @nosnilmot

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.