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.