Installing pkg tool is taking forever.

I just installed FreeBSD on a new PC, it has wi-fi working perfectly. But when I try to install something via pkg, it has the message saiyng that the tool is not installed on my system, then I click "y", then it says "fetching pkg tool etc. please wait..." and it stays on this text forever, with no error or interruption. I left my computer on a entire night on this screen and when I was back it was still the same.
 
You might want to check your internet connection. That said, even if pkg(7) couldn't reach the internet it should eventually time-out and produce an error.
 
As I said on the post, the wi-fi is working with ping.
In today's networking world, ping is no longer strongly correlated with actual reachability. For example, some servers intentionally do not reply to ping, but perform their intended service (to save bandwidth). The DNS server of my ISP is set up this way. On the other hand, some traffic providers intentionally fake ping responses to give the impression of good uptime and high speed, without loading their internal networks.

Also, what are you actually doing? You are saying things like "message saying that", "click y" and "fetching pkg tool", which doesn't sound like you are using pkg directly. Have you tried it much simpler, logged in as root, and using pkg from the command line? By using -v and -d, you can get additional version and debug information, to see what works and what doesn't.
 
Could you post the output of
uname -a
pkg -vv | sed -nE -e '/^OSVERSION|^ABI/ p' -e '/^Repositories:/,$ p'
Uname -a: FreeBSD <hostname> 14.3-RELEASE FreeBSD 14.3-RELEASE releng/14.3-n271432-8c9ce319fef7 GENERIC amd64

pkg -vv | sed -nE -e '/^OSVERSION|^ABI/ p' -e '/^Repositories:/,$ p': The package management tool is not yet installed on your system. Do you want to fetch and install it now? [y/N]:
 
Ah, I had completely forgotten about that little trap. What's a trap? Dig a big hole in the forest, cover it with some thin cloth or mesh, spread leaves and twigs over it, big animal walks across, falls into the hole, you have now captured a big animal with very little danger and effort. Works great in cartoons (like road runner versus coyote).

Here the trap is that a newly installed FreeBSD system does not have the pkg tool installed. The pkg tool is itself a package, which can be installed and upgraded by pkg, so how do you solve this "chicken and egg problem"? A new install comes with a small program, called pkg-static, which has fundamentally one purpose: To install the real pkg. It is peg-static you are interacting with right now.

Look at the man page for pkg-static (same as pkg), try running it with a single -v option, or the -d option, and see what happens. Or run it without any options/arguments, or with -h to get help.
 
A new install comes with a small program, called pkg-static, which has fundamentally one purpose: To install the real pkg. It is peg-static you are interacting with right now.
Ehm, no. The base OS comes with pkg(7) (/usr/sbin/pkg). Its purpose is to 'proxy' commands to pkg(8) if it exists[*], and 'bootstrap' installing ports-mgmt/pkg (pkg(8); /usr/local/sbin/pkg). pkg-static(8) is a statically compiled version of pkg(8) and installed with the ports-mgmt/pkg package. That said, after unpacking the package with the bootstrap, it does use the pkg-static that's in the package files to install itself.

[*] It does this because, by default, /usr/sbin/ is defined in PATH before /usr/local/sbin/.

The OP's pkg(7) seems to be forever stuck on the fetching of the package phase.

then it says "fetching pkg tool etc. please wait..."
What's the exact message? We need to know exactly where it's stuck.

These are the messages you're supposed to see:
Code:
root@fbsd-test:~ # pkg
The package management tool is not yet installed on your system.
Do you want to fetch and install it now? [y/N]: y
Bootstrapping pkg from pkg+https://pkg.FreeBSD.org/FreeBSD:14:amd64/quarterly, please wait...
Verifying signature with trusted certificate pkg.freebsd.org.2013102301... done
Installing pkg-2.4.2...
Extracting pkg-2.4.2: 100%
pkg: not enough arguments
Usage: pkg [-v] [-d] [-l] [-N] [-j <jail name or id>|-c <chroot path>|-r <rootdir>] [-C <configuration file>] [-R <repo config dir>] [-o var=value] [-4|-6] <command> [<args>]

For more information on available commands and options see 'pkg help'.
root@fbsd-test:~ #
 
Back
Top