403 Forbidden and "The repository 'http://security.ubuntu.com/ubuntu bionic-security InRelease' is no longer signed" errors on Ubuntu 18.04

I have installed Ubuntu but I am unable to update and upgrade the system due to an error about a repository not being accessible or not being secure:

E: Failed to fetch http://security.ubuntu.com/ubuntu/dists/bionic-security/InRelease  403  Forbidden [IP: 91.189.91.26 80]
E: The repository 'http://security.ubuntu.com/ubuntu bionic-security InRelease' is no longer signed.
N: Updating from such a repository can't be done securely, and is therefore disabled by default.
N: See apt-secure(8) manpage for repository creation and user configuration details.

What's the problem and how can I fix it?


This is not necessarily a temporary issue. It's an ongoing one. There could be many causes for this issue, and the one that I keep seeing is this. Canonical, like a lot of other companies uses Akamai, which has servers located around the world and appear to use a round-robin approach concerning which servers get used at any particular time. This can cause an issue, like the 403 Forbidden the OP saw, if the servers in use by Akamai happen to be in a location which your firewall is blocking via IP geolocation. Right or wrong, there are a lot of organizations which do geolocation blocking and as a result these errors will occur.

To see if this is indeed the case in you particular instance, type the offending IP into your browser's address bar, hit return and see what happens. If you get a message from your firewall stating that that location has been blocked, then you will need to wait and/or keep trying until the servers being accessed are in a location which your firewall is not blocking.

The 403 Forbidden error occurs because apt cannot retrieve the signature file for the repository, since the IP is being blocked. It would be nice if apt could better deal with this issue, but it is what it is and we just need to troubleshoot.