Skip to content

ci: Tier 2 Linux container jobs fetch from one Ubuntu mirror only; reuse the host apt mirror list as a fallback #5510

Closed

Description

@vpacher

Problem

The Tier 2 Linux jobs that run in the stock ubuntu:26.04 container fetch every package from one source, archive.ubuntu.com over HTTP (/etc/apt/sources.list.d/ubuntu.sources). There is no other mirror to fall back to. These jobs are the build job's Install Git 📦 and Install Tier 2 Packages 📦 steps, and the runtime delta install in rust/tools/linux-validate/ci-runtime.py in the tests jobs. Jobs on the prebaked image or the Dell runner do not fetch from the archive.

On 2026-11-23 the archive was slow or unreachable from GitHub's hosted runners for hours:

#5504 (#5506, #5508) makes the retries recover after a timeout, but a retry against the same slow source cannot help.

The host jobs already have a fallback: the runner image's /etc/apt/apt-mirrors.txt lists the Azure mirror (http://azure.archive.ubuntu.com/ubuntu/) and the HTTPS archive (https://archive.ubuntu.com/ubuntu/) for apt's mirror+file: method, and ci/host_apt_mirrors.py sets their order (#1269).

Proposal

  1. Keep the mirror URIs in one place: ci/host_apt_mirrors.py exports the list it recognizes (Azure and the Ubuntu archive), and a function that writes a container mirror list from it.
  2. In the build job's container, before the first apt-get update in Install Git 📦, point ubuntu.sources at mirror+file:/etc/apt/apt-mirrors.txt. The bootstrap list uses HTTP only (Azure, then http://archive.ubuntu.com/ubuntu/): the stock image has no ca-certificates until Install Git 📦 installs them. The security pocket keeps its own source.
  3. Use the same list in the containers that ci-runtime.py starts, so the runtime delta install can fall back too.
  4. Keep the existing bounds: Acquire::Retries, the 15 to 20 s transport timeouts, the 180 s command bounds and the step limits.

Open question for the PR: which mirror goes first in the container. #1269 saw slow Azure transfers on the host (run 39788036193) and put the HTTPS archive first; in the container HTTPS is only possible after the bootstrap. The PR measures both orders on hosted runners and records the result.

Tests

  • RED: ci/test_tier2_apt_cache.py (and the runtime tests) check that the container steps write the mirror list from the shared definition before the first apt-get update, and that ubuntu.sources names mirror+file:. Today both fail.
  • A test in ci/test_host_apt_mirrors.py checks that the host recognizer and the container list use the same URIs.
  • A real run of the changed steps in ubuntu:26.04: the install works through the mirror list, and with the first mirror unreachable it falls back to the second.

Activity

  1. vpacher commented on Nov 23, 2026

    @vpacher
    MemberAuthor

    Claiming: #5510

    Decisions:

    • Mirror order in the container: start with the order the host uses after host_apt_mirrors.py (archive first) where HTTPS is possible, and Azure HTTP first for the bootstrap, where it is not. The PR measures both orders on hosted runners; if Azure is slower there too, the bootstrap puts the HTTP archive first and keeps Azure as the fallback.
    • One definition: the URIs live in ci/host_apt_mirrors.py; the container steps call it, so the host and container lists cannot drift apart.

    Plan (one PR, after #5508 lands, since it touches the same steps): RED tests for the container mirror list and the shared URIs, then GREEN in Install Git 📦 and ci-runtime.py, with a real ubuntu:26.04 run that blocks the first mirror.

  2. added
    ready
    on Nov 23, 2026
  3. vpacher commented on Nov 23, 2026

    @vpacher
    MemberAuthor

    Plan update: a third mirror, and Azure first in the container.

    Container mirror list, in order:

    1. http://azure.archive.ubuntu.com/ubuntu/ (Azure, where the hosted runners are; the runner image also lists it first)
    2. http://archive.ubuntu.com/ubuntu/ (Canonical)
    3. http://mirrors.edge.kernel.org/ubuntu/ (kernel.org's CDN mirror, outside both Azure and Canonical; HTTPS once ca-certificates is installed)

    Packages stay signed by the archive's Release files, so a third mirror does not change what is trusted. The risk is lag: a mirror that syncs later can miss a version that runtime-packages.txt pins, and apt then falls through to the next mirror. On 2026-11-23 all three served resolute and resolute-updates with the same index date (2026-11-22 12:43 UTC). The security pocket keeps its own source. The list lives once in ci/host_apt_mirrors.py, and the PR checks the fallback with the first mirror blocked.

  4. vpacher commented on Nov 23, 2026

    @vpacher
    MemberAuthor

    Correction to the plan, after a test: a mirror+file: list does not fix the failure we saw.

    Test in ubuntu:26.04 (apt 3.2), first mirror a fake that accepts connections and never answers, second mirror archive.ubuntu.com:

    Acquire settings apt-get update under timeout 180
    Retries 3, Timeout 20 (as in the step) exit 124 after 180 s, 4 Ign from the fake mirror
    Retries 0, 1 or 3, Timeout 10 exit 124 after 180 s, 8 Ign from the fake mirror

    apt falls back file by file and waits the full timeout on the dead mirror for each index file; it never marks a mirror as dead. A fake mirror that sent invalid data was left within 2 s, so the list only helps when a mirror fails fast. In run 45159376402, apt-get update hung in all 3 attempts.

    Also, the hosted runners are not always in Azure: the host Fast Gate jobs of the same day fetched from http://us-east-2.ec2.archive.ubuntu.com (09:14Z) and https://archive.ubuntu.com (10:49Z). The runner image's mirror list follows the cloud.

    New plan: the existing retry loop points the main source at a different mirror on each attempt, so a hanging mirror costs one 180 s attempt:

    1. the runner's own mirror (the first plain-HTTP entry of the host's /etc/apt/apt-mirrors.txt, mounted read-only into the container); archive.ubuntu.com if there is none;
    2. http://archive.ubuntu.com/ubuntu/;
    3. http://mirrors.edge.kernel.org/ubuntu/.

    security.ubuntu.com stays as its own source (it answered in every test). ci/host_apt_mirrors.py holds the fallback list and the rule for the runner's mirror; a test runs the step's shell against the same fixtures, so the two cannot differ. ci-runtime.py uses the next mirror for its one timeout retry. The PR test repeats the fake hanging mirror: attempt 1 hangs, attempt 2 passes.

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

Metadata

Metadata

Assignees

Labels

ready

Type

No type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions