# Why my pkg is too slow?



## maziar (Nov 24, 2015)

When I use `# pkg update` on my freebsdFreeBSD it's very slow
you can see it on images:








After a few minutes I get time out error :





What should I do?
My internet is good, I have problem just on FreeBSD.
How should I fix this?


----------



## jrm@ (Nov 24, 2015)

You're downloading packagesite.txz at very slow speeds.  What happens when you simply do `% fetch http://pkg.freebsd.org/FreeBSD:10:amd64/quarterly/packagesite.txz`?


----------



## ahhyes (Nov 27, 2015)

I've been seeing the same thing from my server at the Hurricane Electric (HE) data centre in Freemont. Painfully slow for the last few days. Today it seems to have worked once, now we're back to a snails pace again..


```
root@core:~ # pkg upgrade
Updating FreeBSD repository catalogue..
```

And there it sits...

Watching the process under `truss` it hangs:

```
46402: socket(PF_INET6,0x10000002,17)  = 5 (0x5)
46402: connect(5,{ AF_INET6 [2001:4f8:3:ffe0:406a:0:16:1c]:1 },28) = 0 (0x0)
46402: getsockname(5,{ AF_INET6 [2001:470:X:XXX::XXXX]:33091 },0x7fffffff9e4c) = 0 (0x0)
46402: ioctl(5,SIOCGIFAFLAG_IN6,0xffff9d28)  ERR#6 'Device not configured'
46402: close(5)  = 0 (0x0)
46402: socket(PF_INET,0x10000002,17)  = 5 (0x5)
46402: connect(5,{ AF_INET 149.20.53.28:1 },16)  = 0 (0x0)
46402: getsockname(5,{ AF_INET 65.19.XX.XX:58565 },0x7fffffff9e4c) = 0 (0x0)
46402: close(5)  = 0 (0x0)
46402: socket(PF_INET6,SOCK_STREAM,6)  = 5 (0x5)
```


----------



## ahhyes (Nov 27, 2015)

Actually seems to be ipv6 related... if I use `pkg -4` it works right away
Using `pkg -6` hangs, the utility must be using ipv6 as a preference if available. ipv6 is working fine, and fast on my server.. just not to the FreeBSD package repositories.


----------



## aragats (Apr 25, 2017)

ahhyes said:


> Actually seems to be ipv6 related... if I use  pkg -4 it works right away


This is still actual!
Really? Just discovered this issue on a brand new FreeBSD 11.0 on Linode.


----------



## Mabedini (Feb 17, 2019)

Hi maziar 
in Iran i have same problem, I use VPN and make speed better.


----------



## jea (Jun 10, 2020)

ahhyes said:


> Actually seems to be ipv6 related... if I use `pkg -4` it works right away
> Using `pkg -6` hangs, the utility must be using ipv6 as a preference if available. ipv6 is working fine, and fast on my server.. just not to the FreeBSD package repositories.


I had the same issue on Digital Ocean as well.


----------



## aragats (Jun 11, 2020)

Could be related to another problem I solved by disabling TSO. So, in this case you may try disabling (or enabling) LRO, see ifconfig().


----------

