Elementary OS: How do I stop APT from using random repositories for each package?

Hi Folks,

Does anyone how to change the default behavior of APT on Elementary OS? APT seemingly picks a random mirror to download each package from which, in theory, sounds like a great idea but in practice you wind up with a mirror that’s really slow holding up the install/update process to download at 40kb/sec :face_with_spiral_eyes:

Ideally, I’d like to be able to pick my mirror manually or use something like regular old Ubuntu’s tool to pick the fastest mirror.

My research on this comes up pretty empty. Maybe I’m just not Googling right or no one else gets annoyed by this. So far all I’ve come up with is that APT is using a mirror:// file but I haven’t gotten much further than that.

Thanks,
Dan

PS: I put this in Ubuntu as Elementary OS is based on Ubuntu. I wasn’t able to add a tag for Elementary OS. Are regular members not allowed to make new tags?

Haven’t used elementary for some time…

Should there not be an option in the software settings to set the mirror?

@DanTheManDRH :wave: :

Hi,

as your topic seems interesting I´d like to know the solution to that as well.
Yet I´m not using elemntartyOS myself so I did some research on the matter (I also asked ChatGPT about that).

I couldn´t verify the results myself so you might have to take the instructions with a grain of salt. :wink:

elementaryOS is based on Ubuntu, so many of the package management tools and configurations are similar. To change the default behavior of APT (Advanced Package Tool) and select a specific mirror for package downloads, you can follow these steps:

  • Backup Your System … before making any changes

  • Edit APT Configuration:
    Open a terminal and run the following command to open the APT configuration file in a text editor with administrative privileges:

sudo nano /etc/apt/sources.list
  • Select a Mirror:
    In the text editor, you’ll see a list of URLs that point to various mirrors. Each line represents a repository source. You can manually choose a mirror by replacing the default mirror URLs with the URL of the mirror you want to use.
    For example:
deb http://example.mirror.univ-xyz.edu/ubuntu/ bionic main
deb-src http://example.mirror.univ-xyz.edu/ubuntu/ bionic main
  • You can find a list of Ubuntu mirrors here: Mirrors : Ubuntu
    #this seems to be the interesting part

  • Update APT:
    After editing the sources list, save the file and exit the text editor. Then, update the package information by running the following command:

sudo apt update
  • Upgrade Packages (Optional):
    If you want to upgrade your packages, you can run:
sudo apt upgrade

Please note that while this approach should work in many cases, there’s always a possibility that manual mirror selection might not yield the expected results due to changes on the mirror’s end or potential network issues.

Also, keep in mind that elementaryOS might have its own unique configuration or utilities for managing mirrors, so you might want to consult the elementaryOS documentation or community for specific guidance tailored to that distribution.

No idea if it helps… :thinking:

Many greetings from Rosika :slightly_smiling_face:

3 Likes

Hi @DanTheManDRH,
first of all, please, pay attention to what Rosika wrote:


I don’t know if this is the correct procedure, but I’ll mention the way I use to choose the fastest mirrors:

  • I open Synaptic and select the menu Settings → Repositories
  • I click on the Mirror link that is being used as Main mirror:

  • A window opens with a list of all mirrors and gradually shows the transfer speed of each one. I can select sort on the Speed column and choose the mirror with the fastest transfer speed:

image

  • I Select the mirror you want to use and press the Apply button

  • I do the same procedure to the Base Mirror:

image

  • My configuration after switching to the faster mirrors:

  • When I close the window, another window appears to inform me that I have to Reload:

image

And I’ve changed the mirrors to the fastest ones

A quick test to see if I’ve changed the mirrors:
sudo apt update

Before changing the mirrors:

image

After changing the mirrors:




Note: I’ve had problems selecting other mirrors because, for example, they’re either slower than they were when I chose them, they’re down or they have problems updating packages, which is why I tend to use the main “official mirrors” (I don’t know what to call them).

I hope this is what you’re looking for

Jorge

2 Likes

Thanks guys. I didn’t mean to post and run without updating. I installed Elementary OS as my 3rd OS on my desktop. I’m going to try and take a video of the update process to show you guys what I mean.

1 Like

Use script or screenshots. Videos usually are unreadable