Solved pkg: No SRV record found for the repo 'FreeBSD'

Hello.
How to fix?
Code:
# pkg update
Updating FreeBSD repository catalogue...
pkg: No SRV record found for the repo 'FreeBSD'
Fetching meta.conf: 100%    163 B   0.2kB/s    00:01    
pkg: packagesite URL error for pkg+[URL]http://pkg.FreeBSD.org/FreeBSD:13:amd64/quarterly/packagesite.pkg[/URL] -- pkg+:// implies SRV mirror type
pkg: packagesite URL error for pkg+[URL]http://pkg.FreeBSD.org/FreeBSD:13:amd64/quarterly/packagesite.txz[/URL] -- pkg+:// implies SRV mirror type
Unable to update repository FreeBSD
Error updating repositories!

My system FreeBSD 13.2-RELEASE-p3 amd64 .
Code:
pkg -vv | grep -A 50 Repositories\:
Repositories:
  FreeBSD: { 
    url             : "pkg+[URL]http://pkg.FreeBSD.org/FreeBSD:13:amd64/quarterly[/URL]",
    enabled         : yes,
    priority        : 0,
    mirror_type     : "SRV",
    signature_type  : "FINGERPRINTS",
    fingerprints    : "/usr/share/keys/pkg"
  }
Code:
pkg version -v | grep pkg
pkg-1.20.8                         >   succeeds index (index has 1.20.6)
pkgconf-1.8.1,1                    <   needs updating (index has 2.0.3,1)
 
 
I still don’t understand what needs to be done?
Wait until the DNS is updated?
 
 
Hi,

I would do this:
Bash:
# mkdir -p /usr/local/etc/pkg/repos
# cp /etc/pkg/FreeBSD.conf /usr/local/etc/pkg/repos/

Then in /usr/local/etc/pkg/repos/FreeBSD.conf change mirror_type: "srv" to mirror_type: "none"

Or according to cy@ you can instead change url: "pkg+http://pkg.FreeBSD.org/${ABI}/quarterly to url: "http://pkg.FreeBSD.org/${ABI}/quarterly.

It's all in the thread that SirDice gave, but it can be a bit confusioning if you don't know what you are looking at.
 
Note this is not a solution but a workaround. It disables picking a "good" mirror from SRV records.

You should instead investigate why you can't resolve the SRV records. You should get answers for both http and https. Example on my machine:
Code:
$ host -t SRV _http._tcp.pkg.FreeBSD.org
_http._tcp.pkg.FreeBSD.org has SRV record 50 10 80 pkg0.fra.freebsd.org.
_http._tcp.pkg.FreeBSD.org has SRV record 10 10 80 pkgmir.geo.freebsd.org.
_http._tcp.pkg.FreeBSD.org has SRV record 50 10 80 pkg0.tuk.freebsd.org.
_http._tcp.pkg.FreeBSD.org has SRV record 50 10 80 pkg0.bme.freebsd.org.
_http._tcp.pkg.FreeBSD.org has SRV record 50 10 80 pkg0.nyi.freebsd.org.
$ host -t SRV _https._tcp.pkg.FreeBSD.org
_https._tcp.pkg.freebsd.org has SRV record 10 10 443 pkgmir.geo.freebsd.org.
$
 
Thanks zirias@
It seems I have a network problem?
Code:
# host -t SRV _https._tcp.pkg.FreeBSD.org
Host _https._tcp.pkg.FreeBSD.org not found: 3(NXDOMAIN)
# host -t SRV _http._tcp.pkg.FreeBSD.org
Host _http._tcp.pkg.FreeBSD.org not found: 3(NXDOMAIN)

I'm using a http proxy which can filter something? What is the corresponding url?
 
It seems I have a network problem?
At least an issue with DNS. You could first check whether you get a valid answer from Google's nameserver:
host -t SRV _http._tcp.pkg.FreeBSD.org 8.8.8.8
This really should work. Then the question would be, what nameserver are you using, IOW what's in /etc/resolv.conf?
I'm using a http proxy which can filter something?
And how do you make pkg use it? It's most likely unrelated.
What is the corresponding url?
What do you mean? 🤷‍♂️
 
Hi.
host -t SRV _http._tcp.pkg.FreeBSD.org 8.8.8.8
Code:
host -t SRV _http._tcp.pkg.FreeBSD.org 8.8.8.8
;; connection timed out; no servers could be reached
Isn't it normal as I'm not on a domestic network?

And how do you make pkg use it? It's most likely unrelated.
I need a proxy server to join the net by setting http_proxy env variable:
Code:
$ pkg search unzip
fpc-unzip-3.2.2_4              Free Pascal routines for unzipping zip files
unzip-6.0_8                    List, test, and extract compressed files from a ZIP archive

$ unsetenv http_proxy
$ pkg search unzip
pkg: An error occured while fetching package
(...)
What do you mean?
I'm not really familiar with host syntax. I mean the _http._tcp.pkg.FreeBSD.org name references an URL? Something like http://tcp.pkg.FreeBSD.org? Is it possible to do a test with another command than host?
 
Last edited:
Looks like a case of extremely restrictive outbound firewall. So you're neither allowed to contact any external web server, nor DNS servers, and the DNS servers you're forced to use don't serve you the SRV records, which is why pkg fails with pkg+http.

You could complain to whoever operates this about the missing SRV records. And maybe it would be an idea to add graceful automatic fallback to pkg to work well in such a crippled environment.
 
Yes, you're right zirias@, my environment is very restrictive. Changes has been made recently, it still works two weeks ago. I think the goal is to force people to use the official Linux distribution chose by my company. Despite the workaround, pkg can upgrade some package, but not all:
Code:
$ pkg upgrade
[1/308] Fetching kf5-kdelibs4support-5.110.0.pkg:   0%    4 KiB   0.0kB/s 15:26:57 ETA
pkg: cached package kf5-kdelibs4support-5.110.0: missing or size mismatch, fetching from remote
[2/308] Fetching kf5-kdelibs4support-5.110.0.pkg:   0%    4 KiB   0.0kB/s 15:26:57 ETA
pkg: cached package kf5-kdelibs4support-5.110.0: missing or size mismatch, cannot continue
Consider running 'pkg update -f'

Running
pkg update -f don't solve.
Something blocks me as the ETA is enormous and pkg reports "stalled" before printed this error.
I am very disappointed not to be able to upgrade my OS.
 
Note this is not a solution but a workaround. It disables picking a "good" mirror from SRV records.

You should instead investigate why you can't resolve the SRV records. You should get answers for both http and https. Example on my machine:
Code:
$ host -t SRV _http._tcp.pkg.FreeBSD.org
_http._tcp.pkg.FreeBSD.org has SRV record 50 10 80 pkg0.fra.freebsd.org.
_http._tcp.pkg.FreeBSD.org has SRV record 10 10 80 pkgmir.geo.freebsd.org.
_http._tcp.pkg.FreeBSD.org has SRV record 50 10 80 pkg0.tuk.freebsd.org.
_http._tcp.pkg.FreeBSD.org has SRV record 50 10 80 pkg0.bme.freebsd.org.
_http._tcp.pkg.FreeBSD.org has SRV record 50 10 80 pkg0.nyi.freebsd.org.
$ host -t SRV _https._tcp.pkg.FreeBSD.org
_https._tcp.pkg.freebsd.org has SRV record 10 10 443 pkgmir.geo.freebsd.org.
$

I had the same issue, so like suggested I tried to receive the SRV records via 'host' command. I've noticed that sometimes the answer was OK and sometimes it timed out. Then I've checked this on my Linux and macOS dekstops and got the same result.

Next I've tried using 'dig' to receive the records and I always got an answer:
Code:
;; ANSWER SECTION:
_http._tcp.pkg.FreeBSD.org. 300    IN    SRV    50 10 80 pkg0.nyi.freebsd.org.
_http._tcp.pkg.FreeBSD.org. 300    IN    SRV    50 10 80 pkg0.fra.freebsd.org.
_http._tcp.pkg.FreeBSD.org. 300    IN    SRV    50 10 80 pkg0.fmt.freebsd.org.
_http._tcp.pkg.FreeBSD.org. 300    IN    SRV    50 10 80 pkg0.sjb.freebsd.org.
_http._tcp.pkg.FreeBSD.org. 300    IN    SRV    10 10 80 pkgmir.geo.freebsd.org.
_http._tcp.pkg.FreeBSD.org. 300    IN    SRV    50 10 80 pkg0.tuk.freebsd.org.

and...
Code:
;; ANSWER SECTION:
_http._tcp.pkg.FreeBSD.org. 586    IN    SRV    50 10 80 pkg0.sjb.freebsd.org.
_http._tcp.pkg.FreeBSD.org. 586    IN    SRV    10 10 80 pkgmir.geo.freebsd.org.
_http._tcp.pkg.FreeBSD.org. 586    IN    SRV    50 10 80 pkg0.tuk.freebsd.org.
_http._tcp.pkg.FreeBSD.org. 586    IN    SRV    50 10 80 pkg0.nyi.freebsd.org.
_http._tcp.pkg.FreeBSD.org. 586    IN    SRV    50 10 80 pkg0.fra.freebsd.org.
_http._tcp.pkg.FreeBSD.org. 586    IN    SRV    50 10 80 pkg0.fmt.freebsd.org.

;; ADDITIONAL SECTION:
pkg0.sjb.FreeBSD.org.    586    IN    A    85.30.190.140
pkg0.fmt.FreeBSD.org.    586    IN    A    192.158.248.8
pkg0.fra.FreeBSD.org.    586    IN    A    147.28.184.43
pkg0.nyi.FreeBSD.org.    586    IN    A    96.47.72.71
pkg0.tuk.FreeBSD.org.    586    IN    A    204.15.11.66
pkg0.sjb.FreeBSD.org.    586    IN    AAAA    2a02:80:0:3ffd::50:2
pkg0.fmt.FreeBSD.org.    586    IN    AAAA    2001:500:6b:d::50:2
pkg0.fra.FreeBSD.org.    586    IN    AAAA    2604:1380:4091:a001::50:2
pkg0.nyi.FreeBSD.org.    586    IN    AAAA    2610:1c1:1:606c::50:1
pkg0.tuk.FreeBSD.org.    586    IN    AAAA    2620:11c:5001:1099:1337::3

Next I tried 'host' on macOS an used Wireshark to see what is going on. When the DNS answer had an additional section, the 'host' tool showed a time out.

Finally I've checked my upstream nameservers (had a few from different providers) and removed the ones that send the additional section. Problem was gone afterwards.
 
Back
Top