aptly-dev / aptly

aptly - Debian repository management tool
https://www.aptly.info/
MIT License
2.54k stars 369 forks source link

Unable to mirror repository apt-archive.postgresql.org #1221

Closed jawmn closed 8 months ago

jawmn commented 9 months ago

It is seems that repository apt-archive.postgresql.org is somehow broken, but apt works with it without problems. Attempt to create mirror fails with error:

$ aptly -keyring=/etc/apt/keyrings/postgresql.gpg mirror create jammy-pgdg-archive https://apt-archive.postgresql.org/pub/repos/apt jammy-pgdg-archive main
Downloading https://apt-archive.postgresql.org/pub/repos/apt/dists/jammy-pgdg-archive/InRelease...
Success downloading https://apt-archive.postgresql.org/pub/repos/apt/dists/jammy-pgdg-archive/InRelease
gpgv: Signature made Sat 16 Sep 2023 12:14:35 AM UTC
gpgv:                using RSA key B97B0AFCAA1A47F044F244A07FCC7D46ACCC4CF8
gpgv: Good signature from "PostgreSQL Debian Repository"
ERROR: unable to fetch mirror: component main not available in repo [jammy-pgdg-archive]: https://apt-archive.postgresql.org/pub/repos/apt/ jammy-pgdg-archive, use -force-components to override

If component main is omitted, then mirror creates successfully, but attempt to update this mirror fails:

$ aptly -keyring=/etc/apt/keyrings/postgresql.gpg mirror create jammy-pgdg-archive https://apt-archive.postgresql.org/pub/repos/apt jammy-pgdg-archive
Downloading https://apt-archive.postgresql.org/pub/repos/apt/dists/jammy-pgdg-archive/InRelease...
Success downloading https://apt-archive.postgresql.org/pub/repos/apt/dists/jammy-pgdg-archive/InRelease
gpgv: Signature made Sat 16 Sep 2023 12:14:35 AM UTC
gpgv:                using RSA key B97B0AFCAA1A47F044F244A07FCC7D46ACCC4CF8
gpgv: Good signature from "PostgreSQL Debian Repository"

Mirror [jammy-pgdg-archive]: https://apt-archive.postgresql.org/pub/repos/apt/ jammy-pgdg-archive successfully added.
You can run 'aptly mirror update jammy-pgdg-archive' to download repository contents
$ aptly -keyring=/etc/apt/keyrings/postgresql.gpg mirror update jammy-pgdg-archive
Downloading https://apt-archive.postgresql.org/pub/repos/apt/dists/jammy-pgdg-archive/InRelease...
Success downloading https://apt-archive.postgresql.org/pub/repos/apt/dists/jammy-pgdg-archive/InRelease
gpgv: Signature made Sat 16 Sep 2023 12:14:35 AM UTC
gpgv:                using RSA key B97B0AFCAA1A47F044F244A07FCC7D46ACCC4CF8
gpgv: Good signature from "PostgreSQL Debian Repository"
Downloading & parsing package files...
ERROR: unable to update: no candidates for https://apt-archive.postgresql.org/binary-/Packages found

But when this repo added to sources.list everything works fine and apt can install packages from it:

$ cat /etc/apt/sources.list.d/postgresql-archive.list 
deb [signed-by=/etc/apt/keyrings/postgresql.gpg] https://apt-archive.postgresql.org/pub/repos/apt jammy-pgdg-archive main
$ apt policy postgresql-16
postgresql-16:
  Installed: 16.0-1.pgdg22.04+1
  Candidate: 16.0-1.pgdg22.04+1
  Version table:
 *** 16.0-1.pgdg22.04+1 500
        500 https://apt-archive.postgresql.org/pub/repos/apt jammy-pgdg-archive/main amd64 Packages
        100 /var/lib/dpkg/status
     16~rc1-1.pgdg22.04+1 500
        500 https://apt-archive.postgresql.org/pub/repos/apt jammy-pgdg-archive/main amd64 Packages
     16~beta3-1.pgdg22.04+2 500
        500 https://apt-archive.postgresql.org/pub/repos/apt jammy-pgdg-archive/main amd64 Packages
     16~beta2-1.pgdg22.04+1 500
        500 https://apt-archive.postgresql.org/pub/repos/apt jammy-pgdg-archive/main amd64 Packages
     16~beta1-2.pgdg22.04+1 500
        500 https://apt-archive.postgresql.org/pub/repos/apt jammy-pgdg-archive/main amd64 Packages

Maybe there is a proper way to mirror this repository using aptly, which I do not know?

RobertPilja commented 8 months ago

Try the following parameters: -force-architectures -force-components

Example for bookworm-pgdg-archive:

$ aptly -architectures="amd64" -force-architectures -force-components mirror create "apt-archive.postgresql.org_bookworm-pgdg-archive" "https://apt-archive.postgresql.org/pub/repos/apt" "bookworm-pgdg-archive" main
$ aptly mirror update apt-archive.postgresql.org_bookworm-pgdg-archive
jawmn commented 8 months ago

@RobertPilja thank you very much, it works!