tonymet
Posts: 2
Joined: Tue Jun 22, 2021 8:43 pm

[apt upgrade slow] apt mirror configuration – how to block and/or downrank slow hosts??

Tue Jun 22, 2021 8:50 pm

I've been having issues with my primary local mirror running very slow. apt-get upgrade is very slow. I would like to block or downrank that mirror to avoid using it, but continue with other mirrors


Here's my sources.list

Code: Select all

cat /etc/apt/sources.lit
deb http://raspbian.raspberrypi.org/raspbian/ buster main contrib non-free rpi
here's what happens apt-get upgrade. Downloads are usually < 1kB/sec

Code: Select all

apt-get upgrade
After this operation, 10.5 MB of additional disk space will be used.
Do you want to continue? [Y/n] y
Get:1 http://mirrors.ocf.berkeley.edu/raspbian/raspbian buster/main armhf apt armhf 1.8.2.3 [349 kB]
Questions
  • - where is the config that maps the sources.list file to mirrors? e.g. raspbian.raspberrypi.org → mirrors.ocf.berkeley.edu?
    - can I blacklist a host?
    - docs for apt , man page for sources.list don't mention automatic mirror for http scheme. It mentions mirror:// scheme. How does http:// mirror work for raspbian?

trejan
Posts: 3593
Joined: Tue Jul 02, 2019 2:28 pm

Re: [apt upgrade slow] apt mirror configuration – how to block and/or downrank slow hosts??

Tue Jun 22, 2021 9:25 pm

tonymet wrote:
Tue Jun 22, 2021 8:50 pm
- docs for apt , man page for sources.list don't mention automatic mirror for http scheme. It mentions mirror:// scheme. How does http:// mirror work for raspbian?
raspbian.raspberrypi.org is an alias for mirrordirector.raspbian.org which is running Mirrorbrain. It does basic country geo location from your IP and redirects you to a nearby mirror.
tonymet wrote:
Tue Jun 22, 2021 8:50 pm
- where is the config that maps the sources.list file to mirrors? e.g. raspbian.raspberrypi.org → mirrors.ocf.berkeley.edu?
It is server side and is maintained by the Raspbian devs.
tonymet wrote:
Tue Jun 22, 2021 8:50 pm
- can I blacklist a host?
No. All you can do is avoid using the mirror director and manually select a specific mirror. You'll need to edit /etc/apt/sources.list and change raspbian.raspberrypi.org to one of the mirrors listed on the page. If that mirror stops updating or goes down then you'll need to manually update it again. Not all the mirrors update immediately either so there may be delays.

tonymet
Posts: 2
Joined: Tue Jun 22, 2021 8:43 pm

Re: [apt upgrade slow] apt mirror configuration – how to block and/or downrank slow hosts??

Tue Jun 22, 2021 9:36 pm

Many thanks this explains a lot.

[optional] Question
* how is the mapping from sources.list → mirror implemented? does the original host 302 redirect to the mirror? I'm curious how the client is able to follow to the ultimate resource.

Thanks again for helping clarify.

trejan
Posts: 3593
Joined: Tue Jul 02, 2019 2:28 pm

Re: [apt upgrade slow] apt mirror configuration – how to block and/or downrank slow hosts??

Tue Jun 22, 2021 9:46 pm

tonymet wrote:
Tue Jun 22, 2021 9:36 pm
does the original host 302 redirect to the mirror?
Yes. Mirrorbrain sends a 302 redirect and also sends RFC6249 Link headers for alternate mirrors. apt doesn't support RFC6249 though so you're stuck with the one chosen for the 302 redirect.

wigglethemouse
Posts: 1
Joined: Tue Jun 22, 2021 11:08 pm

Re: [apt upgrade slow] apt mirror configuration – how to block and/or downrank slow hosts??

Tue Jun 22, 2021 11:10 pm

I had the same issue.

I temporarily changed my sources.list file

deb http://mirror.sjc02.svwh.net/raspbian/raspbian/ buster main contrib non-free rpi
# deb http://raspbian.raspberrypi.org/raspbian/ buster main contrib non-free rpi
# Uncomment line below then 'apt-get update' to enable 'apt-get source'
deb-src http://raspbian.raspberrypi.org/raspbian/ buster main contrib non-free rpi

steinauf
Posts: 9
Joined: Fri Jun 25, 2021 6:38 pm
Location: NY

Re: [apt upgrade slow] apt mirror configuration – how to block and/or downrank slow hosts??

Tue Jun 29, 2021 2:22 pm

wigglethemouse wrote:
Tue Jun 22, 2021 11:10 pm
I had the same issue.

I temporarily changed my sources.list file

deb http://mirror.sjc02.svwh.net/raspbian/raspbian/ buster main contrib non-free rpi
# deb http://raspbian.raspberrypi.org/raspbian/ buster main contrib non-free rpi
# Uncomment line below then 'apt-get update' to enable 'apt-get source'
deb-src http://raspbian.raspberrypi.org/raspbian/ buster main contrib non-free rpi
i've also made the same change as you as I keep encountering a bad mirror with the default link. hope they fix it soon

Return to “Advanced users”