Skip to content

Include /etc/services for APT to support mirrors with DNS SRV records #253

@bbx0

Description

@bbx0

APT allows to configure a DNS SRV record to serve mirrors. This is useful to route traffic to a mirror (or cache) in the local network.

This works if the used service (http) can be mapped with its port (80) otherwise the mechanism is silently skipped in APT (connect.cc#L490, srvrec.cc#L53). The Docker image ships without /etc/services, which prevents all service/port lookups. The DNS SRV records are therefore not queried (and any DNS SRV based load-balancing does not work).

The feature is used by the official mirror http://deb.debian.org:

 As of July 2022 the SRV record is
_http._tcp.deb.debian.org.    IN      SRV     10 1 80 prod.debian.map.fastly.net.

Please could you consider shipping the netbase package or the file /etc/services in the image? It's a default feature of APT and can help to avoid traffic.

A workaround is to set up /etc/services with http 80/tcp in the Dockerfile before calling apt but this might give trouble with any package pulling in netbase as dependency.

//edit to add test case (with the upstream mirror):

$ echo "http 80/tcp" >> /etc/services
$ apt -oDebug::Acquire::SrvRecs=true update
SrvRecs: got debian.map.fastlydns.net prio: 10 weight: 1

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions