Skip to content

Driver Manager reports "You appear to be offline": archive.ubuntu.com returns 403 to default Python-urllib User-Agent #110

Open

Description

@dvokhmintsev
Image

Summary

Driver Manager incorrectly reports "You appear to be offline" on a fully online system. The connectivity probe in mintdrivers.py is a single urllib.request.urlopen("http://archive.ubuntu.com", timeout=10) call with the default Python-urllib/X.Y User-Agent, which archive.ubuntu.com now answers with HTTP 403 Forbidden. The bare except: then classifies any failure as "offline".

This is a separate regression from #108 (closed 2026-01-16), but on the same code path: that issue was resolved by reverting the probe to archive.ubuntu.com, and now that endpoint itself rejects the request. The mintdrivers connectivity check has now broken twice on Mint 22.x; it would be worth replacing it with something more durable (see suggestions below).

Environment

  • Linux Mint 22 (wilma)
  • mintdrivers 1.8.1
  • Python 3.12.3
  • NetworkManager: nmcli networking connectivity check returns full
  • Browser, apt, curl: all work

Reproduction

$ curl -sS -o /dev/null -w '%{http_code}\n' -A 'Python-urllib/3.12' http://archive.ubuntu.com
403
$ curl -sS -o /dev/null -w '%{http_code}\n' -A 'Mozilla/5.0'        http://archive.ubuntu.com
200
$ curl -sS -o /dev/null -w '%{http_code}\n' -A ''                   http://archive.ubuntu.com
200
$ python3 -c "import urllib.request; urllib.request.urlopen('http://archive.ubuntu.com', timeout=10)"
urllib.error.HTTPError: HTTP Error 403: Forbidden

Launching mintdrivers then prints:

Checking Internet connectivity...
  --> Computer is offline

…and shows the offline page, even though the machine is online.

Root cause

/usr/lib/linuxmint/mintdrivers/mintdrivers.py, lines ~162–180:

def check_connectivity(self, reference):
    try:
        urllib.request.urlopen(reference, timeout=10)
        return True
    except:
        return False

@idle
def check_internet_or_live_media(self, widget=None):
    self.show_page("refresh_page")
    print ("Checking Internet connectivity...")
    try:
        urllib.request.urlopen("http://archive.ubuntu.com", timeout=10)
        ...
    except:
        print ("  --> Computer is offline")

Two design problems:

  1. Default Python-urllib/* User-Agent is filtered server-side by archive.ubuntu.com. This is a global condition (every Mint user is affected), not a local misconfiguration.
  2. Bare except: silently turns any error (HTTP 4xx/5xx, TLS issue, captive-portal HTML, redirect loop, proxy quirk) into "offline", which is a poor signal.

Suggested fix

In order of increasing robustness:

(a) Minimal change — set a non-default User-Agent on the probe:

req = urllib.request.Request(
    "http://archive.ubuntu.com",
    headers={"User-Agent": "mintdrivers/1.8.1"},
)
urllib.request.urlopen(req, timeout=10)

(b) Better — probe the user's actual configured mirror (as suggested by @svalentin1984 in #108), e.g. read it from /etc/apt/sources.list.d/official-package-repositories.list or via python3-apt. That makes the probe representative of what apt will actually do, and immune to anti-bot filtering on the upstream Ubuntu mirror.

(c) Best — delegate the decision to NetworkManager, which already maintains an authoritative connectivity state used everywhere else in Mint:

from gi.repository import NM
client = NM.Client.new(None)
online = client.get_connectivity() == NM.ConnectivityState.FULL

This eliminates the network call from mintdrivers entirely — no hard-coded host, no UA, no bare except:. NM already does the probe (against connectivity-check.ubuntu.com) and exposes the verdict via D-Bus.

Impact

Every Mint 22 user without a custom workaround currently sees the offline page in Driver Manager and cannot install drivers despite being online. The trigger is server-side, so this will keep happening to new users until the probe is changed. Given that #108 was opened in January and the same connectivity check has now broken in a different way, a more durable approach (NM API, or the user's configured mirror) seems worth doing once.

Activity

  1. FabioLeitao commented on Jun 6, 2026

    @FabioLeitao

    This appears to be fixed in the current master by commit 186bebd (released in 1.8.8, 2026-01-16).

    The connectivity probe was iteratively reworked:

    • 1.8.5 (acd7dc6): replaced urllib.request.urlopen with socket.create_connection — removed the User-Agent issue entirely
    • 1.8.8 (186bebd): changed target from 8.8.8.8:53 to archive.ubuntu.com:443 to probe the actual APT repository

    Current code in mintdrivers.py:

    socket.create_connection(("archive.ubuntu.com", 443), timeout=10)

    No HTTP request is made, so there is no User-Agent to filter. The bug described here no longer exists in 1.8.8+. Feel free to close if you confirm.

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