Skip to content

[BUGFIX] Debian installer: robust contrib repo detection for deb822 + mirror lists#1677

Merged
microtechno9000 merged 1 commit intoautomatic-ripping-machine:mainfrom
mschabhuettl:main
Feb 17, 2026
Merged

[BUGFIX] Debian installer: robust contrib repo detection for deb822 + mirror lists#1677
microtechno9000 merged 1 commit intoautomatic-ripping-machine:mainfrom
mschabhuettl:main

Conversation

@mschabhuettl
Copy link
Copy Markdown
Contributor

Description

The Debian installer script currently detects contrib repositories by grepping apt-cache policy output for strings like bookworm-updates/contrib. This approach is brittle and produces false negatives on Debian 12 systems using modern APT configurations, especially:

  • deb822 sources (/etc/apt/sources.list.d/*.sources)
  • mirror+file:///etc/apt/mirrors/*.list mirror lists

As a result, the installer repeatedly warns that bookworm-updates/contrib is missing even when Components: ... contrib ... is correctly configured for bookworm, bookworm-updates, and bookworm-security.

This change replaces the fragile apt-cache policy string matching with a more robust detection strategy:

  • Primary: parse apt-get indextargets (APT’s effective index target list) to confirm Component: contrib for the relevant suite/codename.
  • Support Debian suite aliases commonly present in Release metadata (stable, stable-updates, stable-security) in addition to codename suites.
  • Fallbacks: parse deb822 *.sources stanzas and classic sources.list / *.list formats if needed.

Behavior is unchanged in terms of requirements:

  • contrib for the base suite remains required
  • updates/contrib and security/contrib remain recommended (warn + prompt)

Dependencies: none.

Fixes # (issue title here)

Type of change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update

How Has This Been Tested?

Reproduced and verified on Debian 12 (Bookworm) using deb822 sources with mirror lists:

Example /etc/apt/sources.list.d/*.sources stanza:

Types: deb deb-src
URIs: mirror+file:///etc/apt/mirrors/debian.list
Suites: bookworm bookworm-updates bookworm-backports
Components: main contrib non-free non-free-firmware
Signed-By: /usr/share/keyrings/debian-archive-keyring.gpg

Steps

  1. Configure Debian 12 APT sources using deb822 .sources and mirror+file mirror lists including contrib.
  2. Run apt update (ensure indexes refresh successfully).
  3. Run the installer script.

Expected Results

  • If bookworm-updates includes contrib, the installer should NOT print the warning:
    Missing bookworm-updates/contrib repository.

  • If bookworm-updates does NOT include contrib, the installer should still print the warning and prompt to continue.

  • Docker

  • Other (Debian 12 Bookworm, deb822 .sources, mirror+file mirror lists)

Checklist:

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have tested that my fix is effective or that my feature works

Changelog:

  • Replace contrib repo detection logic with parsing of apt-get indextargets (and fallbacks) to avoid false negatives.
  • Accept Debian suite aliases (stable, stable-updates, stable-security) in addition to codename suites.

…y across deb822 + mirror lists

- Replace `apt-cache policy` grep checks with APT index target parsing to avoid false negatives
- Accept Debian suite aliases (stable, stable-updates, stable-security) in addition to codename suites
- Add fallbacks for deb822 `*.sources` and classic `sources.list`/`*.list` formats
- Prevent repeated “Missing bookworm-updates/contrib” warnings when contrib is already configured
@sonarqubecloud
Copy link
Copy Markdown

@microtechno9000
Copy link
Copy Markdown
Collaborator

Does this make any changes to the wiki?

@mschabhuettl
Copy link
Copy Markdown
Contributor Author

mschabhuettl commented Jan 30, 2026

Does this make any changes to the wiki?

Sorry. What do you mean?

@microtechno9000
Copy link
Copy Markdown
Collaborator

The ARM Wiki points to
Ubuntu 20.04 (install script) (Run the Debian script)

Are there changes to this page that are required, or should the Ubuntu automatic script be updated to reflect running the script for those using debian/ubuntu.

I have not run this script and do not maintain it, hence asking.

@SylvainMT
Copy link
Copy Markdown
Contributor

The ARM Wiki points to Ubuntu 20.04 (install script) (Run the Debian script)

Are there changes to this page that are required, or should the Ubuntu automatic script be updated to reflect running the script for those using debian/ubuntu.

I have not run this script and do not maintain it, hence asking.

You are referring to a wiki page that does not apply, this is the Debian Installation script. Not the Ubuntu one.

I have not reviewed this change myself but this is a bug I've been trying to track down for a long time now. This seems like a good fix for it. I should test it to see if it works. But I love that this was brought up!

I shall review.

Copy link
Copy Markdown
Collaborator

@microtechno9000 microtechno9000 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

approving, noting ubuntu and debian wiki just point to this script

@microtechno9000 microtechno9000 merged commit 894bcf9 into automatic-ripping-machine:main Feb 17, 2026
11 of 13 checks passed
uprightbass360 pushed a commit to uprightbass360/automatic-ripping-machine-neu that referenced this pull request Feb 18, 2026
… mirror lists (automatic-ripping-machine#1677)

fix(installer): correctly detect contrib for bookworm-updates/security across deb822 + mirror lists

- Replace `apt-cache policy` grep checks with APT index target parsing to avoid false negatives
- Accept Debian suite aliases (stable, stable-updates, stable-security) in addition to codename suites
- Add fallbacks for deb822 `*.sources` and classic `sources.list`/`*.list` formats
- Prevent repeated “Missing bookworm-updates/contrib” warnings when contrib is already configured
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants