Correct use of apt proxy

When creating an apt proxy, we are asked for the “distribution”. So I went ahead and created two apt proxies for bionic and focal called bionic and focal.

I then configured the apt repos on my hosts like so:

deb<distro> <distro> main restricted universe multiverse

which works perfectly well.

However, we discovered that when upgrading a bionic host to focal using do-release-upgrade, the process switches the second instance of <distro> to the new distro name. So

deb bionic main restricted universe multiverse


deb focal main restricted universe multiverse

and to my amusement, the bionic repository began happily proxying and caching packages from the focal distro!


Which brings me to my question: if an apt proxy is agnostic of distribution, why bother with the distribution at all?

I tested this by creating a new apt proxy, called ubuntu, and for the distribution I put in ubuntu. This seems to work completely fine, reduces configuration complexity, and avoids the do-release-upgrade issue described above, as my apt sources now look like:

deb <distro> main restricted universe multiverse

Is there a gotcha I’m missing here? I’m aware of this issue to support multiple distributions in the same repository, but it seems to me that we already have this support?

1 Like

I believe [NEXUS-23790] APT proxies: "distribution" field is required but should not be - Sonatype JIRA speaks to what you found. From that ticket, it looks like it’s not needed for proxy but presumably needed for hosted in the current implementation. I am not clear if the bug is that it should be needed for proxy or that it shouldn’t show as a (required) field for proxy. But hope that helps.