apt-get update is unable to connect to mirror [duplicate]

when I try sudo apt-get update this is the output:

Hit:1 http://ppa.launchpad.net/linuxuprising/java/ubuntu focal InRelease
Get:2 http://www.geogebra.net/linux stable InRelease [8.690 B]                 
Err:3 http://mirror.ipb.de/ubuntu focal InRelease                              
  Could not connect to mirror.ipb.de:80 (2a02:f28:2:0:194:29:226:88), connection timed out Could not connect to mirror.ipb.de:80 (194.29.226.88), connection timed out
Err:4 http://mirror.ipb.de/ubuntu focal-updates InRelease
  Unable to connect to mirror.ipb.de:http:
Err:5 http://mirror.ipb.de/ubuntu focal-backports InRelease
  Unable to connect to mirror.ipb.de:http:
Err:6 http://mirror.ipb.de/ubuntu focal-security InRelease
  Unable to connect to mirror.ipb.de:http:
Fetched 8.690 B in 31s (284 B/s)
Reading package lists... Done
W: Failed to fetch http://mirror.ipb.de/ubuntu/dists/focal/InRelease  Could not connect to mirror.ipb.de:80 (2a02:f28:2:0:194:29:226:88), connection timed out Could not connect to mirror.ipb.de:80 (194.29.226.88), connection timed out
W: Failed to fetch http://mirror.ipb.de/ubuntu/dists/focal-updates/InRelease  Unable to connect to mirror.ipb.de:http:
W: Failed to fetch http://mirror.ipb.de/ubuntu/dists/focal-backports/InRelease  Unable to connect to mirror.ipb.de:http:
W: Failed to fetch http://mirror.ipb.de/ubuntu/dists/focal-security/InRelease  Unable to connect to mirror.ipb.de:http:
W: Some index files failed to download. They have been ignored, or old ones used instead.

How can I fix this?


Solution 1:

As already mentioned by mihaitzateo, sometimes the mirror you use don't work, there is nothing you could do in that case except changing the mirror or waiting for some time.

Note: The images are taken from external site(s).

To change the mirror server:

First, open the "Software and Updates" app from the Application launcher or simply run software-properties-gtk in the terminal.

After opening the application you will see 6 tabs and in each tab, a few options: enter image description here

Go to the "Ubuntu Software" tab. (the first one)

Then there you will see a bunch of options. There would be a drop-down menu there saying "Download from", Click on that.

It will look like this:

enter image description here

From there you could select "Main server" or the server you prefer. If you want to select a server in a country then you can go to "Other..." Tab and from there select the preferred server.

enter image description here

I would prefer clicking on "Select the best server".

Solution 2:

Checking debian mirror status for your particular mirror shows that the server is down. You'd either have to wait for it to come back up or change the mirror using Software and updates. To do so, press super key or "Windows" key and type software & updates. You may see "Software updates" (grey icon) and "Software & updates" (pinkish purple icon). Choose Software & updates and you should have a drop down/select from which you can select your mirror site's location. Choose main server. You could also choose to add a different server from the list of servers at Ubuntu mirrors site though that has additional steps.