0

How can I stop apt from downloading every binary architecture but keep downloading packages available for all architectures? We know how to limit it to one architecture, but how do we block all binaries?

For example, I would rather not trust these weird packages from Microsoft:

$ cat /etc/apt/sources.list.d/microsoft-prod.list
deb [arch=amd64,arm64,armhf signed-by=/usr/share/keyrings/microsoft-prod.gpg] https://packages.microsoft.com/ubuntu/24.10/prod oracular main
$ grep '^Package' /var/lib/apt/lists/packages.microsoft.com_ubuntu_24.10_prod_dists_oracular_main_binary-amd64_Packages
Package: mssql-tools18
Package: msodbcsql18

I've tried arch=none but that gives:

Notice: Skipping acquire of configured file 'main/binary-none/Packages' as repository 'https://packages.microsoft.com/ubuntu/24.10/prod oracular InRelease' doesn't support architecture 'none'

Emptying arch= is worse because apt stops working altogether:

Error: Malformed entry 1 in list file /etc/apt/sources.list.d/microsoft-prod.list ([option] no value)
Error: The list of sources could not be read.

For use with other applications, I still want to install packages-microsoft-prod to have /usr/share/doc/packages-microsoft-prod/microsoft-prod.gpg. Surely, it must be possible to set up a filter to just allow this unique package?

$ grep-aptavail -P packages-microsoft-prod -s Package,Architecture
Package: packages-microsoft-prod
Architecture: all
Daniel T
  • 5,339

1 Answers1

1

Just set arch=all. Yes it's counterintuitive, but it works:

# cat /etc/apt/sources.list.d/microsoft-prod.list
deb [arch=all signed-by=/usr/share/keyrings/microsoft-prod.gpg] https://packages.microsoft.com/ubuntu/24.10/prod oracular main
# rm -rf /var/lib/apt/lists/*
# apt update &>/dev/null
# cd /var/lib/apt/lists
# ls packages.microsoft*
packages.microsoft.com_repos_code_dists_stable_InRelease
packages.microsoft.com_repos_code_dists_stable_main_binary-amd64_Packages
packages.microsoft.com_ubuntu_24.10_prod_dists_oracular_InRelease
packages.microsoft.com_ubuntu_24.10_prod_dists_oracular_main_binary-all_Packages
# # No binary-amd64

It works because in the naming scheme, "all" replaces the architecture name to specify the packages universal to all architectures. By specifying "all", it wants to download the same file twice but does neither that nor download the unwanted architecture. Then when apt install runs, it won't find the unwanted file in /var/lib/apt/lists.

In deb822:

Types: deb
URIs: https://packages.microsoft.com/ubuntu/24.10/prod
Suites: oracular
Components: main
Architectures: all
Signed-By: /usr/share/keyrings/microsoft-prod.gpg
Daniel T
  • 5,339