Skip to content

All Base (Noble) mirrors show "Unreachable" due to Cloudflare blocking pycurl's default user-agent on archive.ubuntu.com #276

Closed

Description

@HollagenDew

Description

In the Software Sources mirror selector, all Base (Noble) Ubuntu mirrors
show "Unreachable" even though they are fully accessible via apt and curl.
The issue affects Linux Mint 22.1 Xia.


Root Cause

The get_url_last_modified() function in mintSources.py uses pycurl
with its default user-agent to fetch ls-lR.gz from the base_default
mirror (archive.ubuntu.com) to establish a reference timestamp.

However, archive.ubuntu.com is behind Cloudflare, which blocks pycurl's
default user-agent with a 403 Forbidden response. This causes
pycurl.INFO_FILETIME to return -1, making default_mirror_date = None.

Since every candidate mirror's freshness is compared against
default_mirror_date, all mirrors fail the check and are marked
"Unreachable" regardless of their actual availability.


Steps To Reproduce

  1. Open Software Sources
  2. Click on Base (Noble) mirror selector
  3. All mirrors show "Unreachable"
  4. Meanwhile, sudo apt update works perfectly fine

Proof of the 403 Block

Running the exact same logic mintSources uses internally without a user-agent:

import pycurl, datetime
c = pycurl.Curl()
c.setopt(pycurl.URL, "https://archive.ubuntu.com/ubuntu/ls-lR.gz")
c.setopt(pycurl.CONNECTTIMEOUT, 5)
c.setopt(pycurl.TIMEOUT, 30)
c.setopt(pycurl.FOLLOWLOCATION, 1)
c.setopt(pycurl.NOBODY, 1)
c.setopt(pycurl.OPT_FILETIME, 1)
c.perform()
print(c.getinfo(pycurl.HTTP_CODE))    # Returns 403
print(c.getinfo(pycurl.INFO_FILETIME)) # Returns -1

The Fix

Adding a browser-like user-agent to the pycurl request in
get_url_last_modified() in mintSources.py:

c.setopt(pycurl.USERAGENT, "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36")

This returns HTTP 200 with a valid Last-Modified timestamp, allowing
all mirrors to be evaluated correctly.


Expected Behavior

Base (Noble) mirrors should display their actual download speeds.

Actual Behavior

All Base (Noble) mirrors show "Unreachable".


Screenshots

Before fix — all mirrors showing "Unreachable":
Image

Terminal proof of Cloudflare 403 block (without user-agent):
Image

Terminal proof after fix (HTTP 200 with user-agent):
Image

After fix — mirrors showing actual speeds:
Image


System Information

OS Linux Mint 22.1 Xia
Base Ubuntu 24.04 Noble
mintsources 2.3.2
mint-mirrors 1.2.9

Additional Notes

  • sudo apt update works perfectly fine — this is purely a GUI issue
  • The bug is caused by Cloudflare's bot protection blocking pycurl's
    default user-agent specifically on archive.ubuntu.com
  • This likely affects all users whose systems resolve archive.ubuntu.com
    through Cloudflare, which may be region-dependent
  • A simple one-line fix in get_url_last_modified() resolves the issue completely

Activity

  1. clefebvre commented on May 20, 2026

    @clefebvre
    Member

    Thanks for this, great analysis.

  2. added a commit that references this issue on May 20, 2026
  3. clefebvre commented on May 21, 2026

    @clefebvre
    Member

    Fixed in 2.4.2.

  4. mscheper commented on Jun 13, 2026

    @mscheper

    @clefebvre and @HollagenDew: Thanks so much for the analysis and the patch.

    But for what my opinion as a busybody end user is worth, the real issue is with Cloudflare. Since whatever 'bot protection' they've set up can be hacked around just by adding fake user-agents to requests, it isn't really protection at all, just a useless hindrance for legitimate traffic. It sets a bad precedent, because correct user-agent headers are important for appropriately formatted responses, browser statistics and more.

    Has this been raised with Cloudflare?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions