How I solved: Failed to fetch http://ppa.launchpad.net/.., 403  Forbidden
Published: 2020-04-23 05:13:51

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:
```java
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:
```javascript
grep -r --include '*.list' '^deb ' /etc/apt/sources.list /etc/apt/sources.list.d/
```
which gave output:
```java
/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:
```bash
# 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!