DEV Community

Deepika Banoth
Deepika Banoth

Posted on

How I solved: Failed to fetch http://ppa.launchpad.net/.., 403 Forbidden

I've been using Ubuntu 16.04 vagrant machine for quite some time now. I wanted to install a package, for which I had to do sudo apt-get update before.
But when I ran this command in my machine, it failed with the following error:

Err:12 http://ppa.launchpad.net/jonathonf/python-3.6/ubuntu xenial/main amd64 Packages
  403  Forbidden
Ign:13 http://ppa.launchpad.net/jonathonf/python-3.6/ubuntu xenial/main Translation-en
Reading package lists... Done
W: The repository 'http://ppa.launchpad.net/jonathonf/python-3.6/ubuntu xenial Release' does not have a Release file.
N: Data from such a repository can't be authenticated and is therefore potentially dangerous to use.
N: See apt-secure(8) manpage for repository creation and user configuration details.
E: Failed to fetch http://ppa.launchpad.net/jonathonf/python-3.6/ubuntu/dists/xenial/main/binary-amd64/Packages  403  Forbidden
E: Some index files failed to download. They have been ignored, or old ones used instead.

It looked like there is an invalid repository which gives 403 error

So as a workaround, I thought of temporarily commenting out that in source list.
I grepped all the enabled binary sources by running this command:

grep -r --include '*.list' '^deb ' /etc/apt/sources.list /etc/apt/sources.list.d/

which gave output:

/etc/apt/sources.list:deb http://archive.ubuntu.com/ubuntu xenial main restricted
/etc/apt/sources.list:deb http://archive.ubuntu.com/ubuntu xenial-updates main restricted
/etc/apt/sources.list:deb http://archive.ubuntu.com/ubuntu xenial universe
/etc/apt/sources.list:deb http://archive.ubuntu.com/ubuntu xenial-updates universe
/etc/apt/sources.list:deb http://archive.ubuntu.com/ubuntu xenial multiverse
/etc/apt/sources.list:deb http://archive.ubuntu.com/ubuntu xenial-updates multiverse
/etc/apt/sources.list:deb http://archive.ubuntu.com/ubuntu xenial-backports main restricted universe multiverse
/etc/apt/sources.list:deb http://security.ubuntu.com/ubuntu xenial-security main restricted
/etc/apt/sources.list:deb http://security.ubuntu.com/ubuntu xenial-security universe
/etc/apt/sources.list:deb http://security.ubuntu.com/ubuntu xenial-security multiverse
/etc/apt/sources.list:deb [arch=amd64] https://download.docker.com/linux/ubuntu xenial stable
/etc/apt/sources.list.d/jonathonf-ubuntu-python-3_6-xenial.list:deb http://ppa.launchpad.net/jonathonf/python-3.6/ubuntu xenial main
/etc/apt/sources.list.d/nodesource.list:deb https://deb.nodesource.com/node_8.x xenial main

So in my case jonathonf-ubuntu-python-3_6-xenial.list has the problem.
So I commented out the content in /etc/apt/sources.list.d/jonathonf-ubuntu-python-3_6-xenial.list, which now looks like:

# deb http://ppa.launchpad.net/jonathonf/python-3.6/ubuntu xenial main
# deb-src http://ppa.launchpad.net/jonathonf/python-3.6/ubuntu xenial main

Now when I ran sudo apt-get update again after this fix, it worked fine for me.

If you are facing the above error, you can also use this as a workaround and if you have a better solution please let me know :)

Have a great day!

Top comments (14)

Collapse
 
dylzeee profile image
dylzeee

Thanks a lot, @deepika_banoth right when I was struggling with this error, you showed up in your superhero outfit and saved the day :)

Collapse
 
deepika_banoth profile image
Deepika Banoth

Glad it helped :)

Collapse
 
darkterminal profile image
Imam Ali Mustofa

DAMN! When I Googling... your article show on the top of the page, then I click! My problem has been solved! Thanks

Collapse
 
praveenmkumar15 profile image
praveenkumar

how to comment the command in terminal or in some other?Please reply me..I need that

Collapse
 
darkterminal profile image
Imam Ali Mustofa

just add # (hashtag), example:

deb repo-bla-bla

change to

# deb repo-bla-bla
Thread Thread
 
pksejake profile image
PKSejake

Hi! Do I comment on the terminal?

I still get the same error when running sudo apt-get update
E: Failed to fetch ppa.launchpad.net/jonathonf/python... 403 Forbidden

Thread Thread
 
githinjikiragu profile image
githinjikiragu

sudo gedit then comment out

Collapse
 
eie1 profile image
Eie1 • Edited

thanks very much,could you help to see the bugs i meet,they are a lot different from yours,and i can not solve them,i will appreciate very much if you can help @deepika_banoth

(base) dsp@dsp-Default-string:/$ grep -r --include '*.list' '^deb ' /etc/apt/sources.list /etc/apt/sources.list.d/
/etc/apt/sources.list:deb us.archive.ubuntu.com/ubuntu/ xenial main restricted
/etc/apt/sources.list:deb us.archive.ubuntu.com/ubuntu/ xenial-updates main restricted
/etc/apt/sources.list:deb us.archive.ubuntu.com/ubuntu/ xenial universe
/etc/apt/sources.list:deb us.archive.ubuntu.com/ubuntu/ xenial-updates universe
/etc/apt/sources.list:deb us.archive.ubuntu.com/ubuntu/ xenial multiverse
/etc/apt/sources.list:deb us.archive.ubuntu.com/ubuntu/ xenial-updates multiverse
/etc/apt/sources.list:deb us.archive.ubuntu.com/ubuntu/ xenial-backports main restricted universe multiverse
/etc/apt/sources.list:deb security.ubuntu.com/ubuntu xenial-security main restricted
/etc/apt/sources.list:deb security.ubuntu.com/ubuntu xenial-security universe
/etc/apt/sources.list:deb security.ubuntu.com/ubuntu xenial-security multiverse
/etc/apt/sources.list.d/github_git-lfs.list:deb packagecloud.io/github/git-lfs/ubu... xenial main
/etc/apt/sources.list.d/teamviewer.list:deb linux.teamviewer.com/deb stable main
/etc/apt/sources.list.d/vscode.list:deb [arch=amd64] packages.microsoft.com/repos/vscode stable main
/etc/apt/sources.list.d/cuda-9-2-local.list:deb file:///var/cuda-repo-9-2-local /
/etc/apt/sources.list.d/cuda-9-0-local.list:deb file:///var/cuda-repo-9-0-local /
/etc/apt/sources.list.d/jonathonf-ubuntu-python-3_6-xenial.list:deb ppa.launchpad.net/jonathonf/python... xenial main

Collapse
 
deepika_banoth profile image
Deepika Banoth

@eie1 I see this in your list: jonathonf-ubuntu-python-3_6-xenial.list. Do try commenting it(/etc/apt/sources.list.d/jonathonf-ubuntu-python-3_6-xenial.list) out.

Collapse
 
moatazabdalmageed profile image
Moataz Mohammady

Thanks @deepika_banoth this helped me

Collapse
 
deepika_banoth profile image
Deepika Banoth

Glad it helped :)

Collapse
 
unikcc profile image
unikcc

Thank you for you kindly post and you save my life, thanks god.

Collapse
 
dongzhiyang profile image
dongzhi-yang

You saved my day!

Collapse
 
githinjikiragu profile image
githinjikiragu

Thanks alot this worked for me :)