# freebsd 13.1 pkg bootstrap not working



## Entmatix (Aug 12, 2022)

Hello. It's my first time dealing with freebsd.
Just installed it on bear metal Intel NUC. Installation was OK, but after that I'm unable to bootstrap pkg.


```
root@freebsd-nuc:~ # uname -a
FreeBSD freebsd-nuc 13.1-RELEASE FreeBSD 13.1-RELEASE releng/13.1-n250148-fc952ac2212 GENERIC amd64

root@freebsd-nuc:~ # ifconfig
re0: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> metric 0 mtu 1500
    options=8209b<RXCSUM,TXCSUM,VLAN_MTU,VLAN_HWTAGGING,VLAN_HWCSUM,WOL_MAGIC,LINKSTATE>
    ether 94:c6:91:1e:98:92
    inet 192.168.77.15 netmask 0xffffff00 broadcast 192.168.77.255
    media: Ethernet autoselect (100baseTX <full-duplex>)
    status: active
    nd6 options=29<PERFORMNUD,IFDISABLED,AUTO_LINKLOCAL>
lo0: flags=8049<UP,LOOPBACK,RUNNING,MULTICAST> metric 0 mtu 16384
    options=680003<RXCSUM,TXCSUM,LINKSTATE,RXCSUM_IPV6,TXCSUM_IPV6>
    inet6 ::1 prefixlen 128
    inet6 fe80::1%lo0 prefixlen 64 scopeid 0x2
    inet 127.0.0.1 netmask 0xff000000
    groups: lo
    nd6 options=21<PERFORMNUD,AUTO_LINKLOCAL>

root@freebsd-nuc:~ # ping -c 4 pkg.freebsd.org
PING pkgmir.geo.freebsd.org (213.138.116.73): 56 data bytes
64 bytes from 213.138.116.73: icmp_seq=0 ttl=45 time=64.400 ms
64 bytes from 213.138.116.73: icmp_seq=1 ttl=45 time=63.791 ms
64 bytes from 213.138.116.73: icmp_seq=2 ttl=45 time=64.869 ms
64 bytes from 213.138.116.73: icmp_seq=3 ttl=45 time=63.676 ms

--- pkgmir.geo.freebsd.org ping statistics ---
4 packets transmitted, 4 packets received, 0.0% packet loss
round-trip min/avg/max/stddev = 63.676/64.184/64.869/0.482 ms

root@freebsd-nuc:~ # pkg bootstrap
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+http://pkg.FreeBSD.org/FreeBSD:13:amd64/quarterly, please wait...
*nothing happens for hours*
```
For me it's look like network works well, but pkg for some reason can't bootstrap itself. I've tried to change mirror in /usr/local/etc/pkg/repos/FreeBSD.conf with

```
FreeBSD: {
  url: "pkg+http://pkg.FreeBSD.org/${ABI}/quarterly",
}
```
I've tried all urls for amd64 from here - http://pkg.freebsd.org . None of them works. I can ping, but pkg can't bootstrap. What do I do wrong? Thanks.

Upd. Info about NIC


```
iwm0@pci0:2:0:0:    class=0x028000 rev=0x10 hdr=0x00 vendor=0x8086 device=0x24fb subvendor=0x8086 subdevice=0x2110

    vendor     = 'Intel Corporation'

    device     = 'Dual Band Wireless-AC 3168NGW [Stone Peak]'

    class      = network

re0@pci0:3:0:0:    class=0x020000 rev=0x15 hdr=0x00 vendor=0x10ec device=0x8168 subvendor=0x8086 subdevice=0x2067

    vendor     = 'Realtek Semiconductor Co., Ltd.'

    device     = 'RTL8111/8168/8411 PCI Express Gigabit Ethernet Controller'

    class      = network

    subclass   = ethernet
```


----------



## SirDice (Aug 12, 2022)

Proxy? Outgoing firewall that's blocking the requests?

What does `fetch -v http://pkg.freebsd.org/FreeBSD:13:amd64/quarterly/packagesite.pkg` do?


----------



## Entmatix (Aug 12, 2022)

```
fetch -v http://pkg.freebsd.org/FreeBSD:13:amd64/quarterly/packagesite.pkg

resolving server address: pkg.freebsd.org:80

failed to connect to pkg.freebsd.org:80

fetch: http://pkg.freebsd.org/FreeBSD:13:amd64/quarterly/packagesite.pkg: Operation timed out
```

No proxy, no active firewall on freebsd side. Router doesn't restrict any connections. If it could say anything in the same LAN I have a dozen of computers under macos/linux/windows. They work fine, e.g. I'm able to curl from slackware PC:


```
curl http://pkg.freebsd.org/FreeBSD:13:amd64/quarterly/packagesite.pkg --output p.pkg

  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current

                                 Dload  Upload   Total   Spent    Left  Speed

100 6443k  100 6443k    0     0  3293k      0  0:00:01  0:00:01 --:--:-- 3292k
```


----------



## eternal_noob (Aug 12, 2022)

Is your system time correct? I had troubles to connect to freebsd.org when the time was incorrectly set.

If so, run ntp(d) to fix it.


----------



## Entmatix (Aug 12, 2022)

It's correct. Anyway I ran the command. Date hasn't changed. Bootstrapping still not working.


----------



## Entmatix (Aug 13, 2022)

I've just reinstalled freebsd and tried it in another network - no success. So I believe my home network is not the root of this problem.

Upd. Seems like fetch unable to get anything I've tried. I can ping, I can drill (tried 1.1.1.1, 1.0.0.1, 8.8.8.8 as dns servers), I can traceroute, but I can't fetch...


----------



## Entmatix (Aug 13, 2022)

Added info about NIC.

I bootstrapped pkg manually, but that doesn't solve the problem with fetch...


```
root@freebsd-nuc:~ # drill pkg0.twn.freebsd.org | grep -A1 '^;; ANSWER'
;; ANSWER SECTION:
pkg0.twn.freebsd.org.   2774    IN      A       140.113.168.171

root@freebsd-nuc:~ # ping -c 2 pkg0.twn.freebsd.org
PING pkg0.twn.freebsd.org (140.113.168.171): 56 data bytes
64 bytes from 140.113.168.171: icmp_seq=0 ttl=45 time=275.877 ms
64 bytes from 140.113.168.171: icmp_seq=1 ttl=45 time=275.712 ms
--- pkg0.twn.freebsd.org ping statistics ---
2 packets transmitted, 2 packets received, 0.0% packet loss
round-trip min/avg/max/stddev = 275.712/275.794/275.877/0.082 ms

root@freebsd-nuc:~ # pkg -d update
DBG(1)[11529]> pkg initialized
Updating FreeBSD repository catalogue...
DBG(1)[11529]> PkgRepo: verifying update for FreeBSD
DBG(1)[11529]> PkgRepo: need forced update of FreeBSD
DBG(1)[11529]> Pkgrepo, begin update of '/var/db/pkg/repo-FreeBSD.sqlite'
DBG(1)[11529]> Request to fetch http://pkg0.twn.freebsd.org/FreeBSD:13:amd64/quarterly/meta.conf
DBG(1)[11529]> opening libfetch fetcher
DBG(1)[11529]> Fetch > libfetch: connecting
DBG(1)[11529]> Fetch: fetching from: http://pkg0.twn.freebsd.org/FreeBSD:13:amd64/quarterly/meta.conf with opts "i"
*nothing*
```

Upd. Seems like I found culprit. Curious, how one person can block all freebsd mirrors for a region.


----------

