Fresh 12.0 install cannot fetch pkg repository catalog

Try one of the other mirrors listed on http://pkg.freebsd.org (page down). Replace in /etc/pkg/FreeBSD.conf, line url: "pkg+http://pkg.FreeBSD.org/${ABI}/quarterly", with new mirror address.

FreeBSD.org pkg mirror is using, quote: "MaxMind GeoLite based geo-dns to choose a close mirror for you.". According to maxmind.com:
Databases

GeoLite2 databases are free IP geolocation databases comparable to, but less accurate than, Max
Mind’s GeoIP2 databases.

GeoLite databases deemed less accurate by the provider himself, chances are there you might get to a better mirror redirected.

Side note, 12.0 is end of life, and not supported anymore.
 
Just to let you know... that didn't work.

Code:
Updating FreeBSD repository catalogue...
pkg:  http://pkg0.nyi.FreeBD.org/FreeBSD:12:amd64/quarlerly/meta.txz:  Operation timed out.
 
You could try doubling FETCH_{RETRY,TIMEOUT} in /usr/local/etc/pkg.conf. Try updating again, fail -> double once more. It's strange that you can ping that host and if you have no proxy there's nothing in between... :/
EDIT: can you see the connection in netstat -ap tcp?
 
I'll be honest, I have been doing networking for over 20 years and I suspect it's because it's trying to use IPV6 when it shouldn't. I have no evidence of that and I haven't yet built a kernel without IPv6 in it. It's just experience talking.

I have the FETCH_TIMEOUT set to 200 and FETCH_RETRY set to 3

average ping time to pkg0.nyi.freebsd.org is 46.844 ms

Nameservers are all IPv4 and I can resolve any name.

netstat -ap tcp returns:

tcp4 0 0 192.168.15.166.46417 pkg0.nyi.freebsd.http SYN_SENT

immediately after sending the pkg command

It seems to be stuck there....

Eventually it times out having not received a SYNC_ACK from the remote server. I have not installed any firewall software that I know of.
 
I suspect it's because it's trying to use IPV6 when it shouldn't.
If you suspect that, try setting the environment to IP_VERSION 4 , if it works make it permanent in /usr/local/etc/pkg.conf (man pkg.conf(5)).
average ping time to pkg0.nyi.freebsd.org is 46.844 ms

The problem is not the route to pkg0.nyi.freebsd.org. The request from pkg on your system to download packages is redirected by geo-dns to another mirror. That mirror could be overburdened by requests for example.

Maybe pkg is here to blame. You could try pkg from ports (version 14.4.6, quarterly=1.13.2_1). In case you want to rollback, a copy is in /var/cache/pkg present, or create a package with pkg-create(8).

There is an alternative to retrieve the packages as a temporary solution, unorthodox, more laborious (a little), by creating a local repository, populated with packages downloaded from a repository of your choice, not geo-dns.

In short, determine a directory for the local repository with structure ../pkg/All/, fetch meta.txz and packagesite.txz manually, place them under ../pkg/, create/edit /usr/local/etc/pkg/repos/FreeBSD.conf, point it to the local repository.

To populate repository: pkg install -r <name of the local repo> -n texinfo > texinfo, clean up, add text to file texinfo (e.g. with vim(1)'s global text manipulation function), so the end result for each line looks like, e.g.:
Code:
fetch http://pkg.freebsd.org/FreeBSD:12:amd64/quarterly/All/<package file name>.txz

Place that file in ../pkg/All, run sh texinfo. Install package with pkg add in ../pkg/All/.

meta.txz and packagesite.txz need to be fetch again from time to time, after checking http://pkg.freebsd.org/FreeBSD:12:amd64/quarterly.

I once did it that way.
 
From thread heading, probably you need to first upgrade package repository and then use package system.
REPO_AUTOUPDATE = true; in /usr/local/etc/pkg.conf by default. I have set it to false for convenience; this reminds us you should check this file for any non-defaults you might have set. EDIT: njbelf: you already successfully bootstrapped ports-mgmt/pkg?
 
I suspect it's because it's trying to use IPV6 when it shouldn't.
Try adding the -4 option: pkg -4 update; pkg -4 upgrade

Code:
     -4      pkg will use IPv4 for fetching repository and packages.
See pkg(8)

But, if your system doesn't have an IPv6 address then it shouldn't even try to use IPv6.
 
Back
Top