Operation timed out

Hi everybody,
I have slow internet connection and while I run pkg commands it timed out but google ping ok!
Code:
root@unix:/usr/home/user # pkg update -f
Updating FreeBSD repository catalogue...
Fetching meta.txz: 100%    944 B   0.9kB/s    00:01  
Fetching packagesite.txz: 100%  222 KiB   5.7kB/s    00:40  
pkg: http://pkg.FreeBSD.org/FreeBSD:10:i386/latest/packagesite.txz: Operation timed out
Unable to update repository FreeBSD
root@unix:/usr/home/user # ping 8.8.8.8
PING 8.8.8.8 (8.8.8.8): 56 data bytes
64 bytes from 8.8.8.8: icmp_seq=0 ttl=40 time=229.071 ms
64 bytes from 8.8.8.8: icmp_seq=1 ttl=40 time=220.222 ms
64 bytes from 8.8.8.8: icmp_seq=2 ttl=40 time=228.368 ms
^C
--- 8.8.8.8 ping statistics ---
3 packets transmitted, 3 packets received, 0.0% packet loss
round-trip min/avg/max/stddev = 220.222/225.887/229.071/4.016 ms
root@unix:/usr/home/user #

How can I set the time more than the default on FreeBSD Internet connections?
 
What does drill pkg.freebsd.org SRV return? pkg(8) uses an SRV record to ensure it is going to the closest mirror while the web browser is just likely just getting the A record for an IPv4 address of one of the mirrors. If the SRV record query is not working then your local DNS server is broken.

EDIT: See below for a better example. Sorry for not double checking before asking. Thanks kpa.
 
What does drill pkg.freebsd.org SRV return? pkg(8) uses an SRV record to ensure it is going to the closest mirror while the web browser is just likely just getting the A record for an IPv4 address of one of the mirrors. If the SRV record query is not working then your local DNS server is broken.

The proper query is actually this:

Code:
% drill _http._tcp.pkg.freebsd.org SRV     
;; ->>HEADER<<- opcode: QUERY, rcode: NOERROR, id: 7330
;; flags: qr rd ra ; QUERY: 1, ANSWER: 5, AUTHORITY: 3, ADDITIONAL: 2
;; QUESTION SECTION:
;; _http._tcp.pkg.freebsd.org.  IN      SRV

;; ANSWER SECTION:
_http._tcp.pkg.freebsd.org.     268     IN      SRV     10 10 80 pkgmir.pkg.freebsd.org.
_http._tcp.pkg.freebsd.org.     268     IN      SRV     50 10 80 pkg0.nyi.freebsd.org.
_http._tcp.pkg.freebsd.org.     268     IN      SRV     50 10 80 pkg0.isc.freebsd.org.
_http._tcp.pkg.freebsd.org.     268     IN      SRV     50 10 80 pkg0.bme.freebsd.org.
_http._tcp.pkg.freebsd.org.     268     IN      SRV     50 10 80 pkg0.ydx.freebsd.org.

;; AUTHORITY SECTION:
pkg.freebsd.org.        3568    IN      NS      gns1.freebsd.org.
pkg.freebsd.org.        3568    IN      NS      gns2.freebsd.org.
pkg.freebsd.org.        3568    IN      NS      gns0.freebsd.org.

;; ADDITIONAL SECTION:
pkgmir.pkg.freebsd.org. 268     IN      A       77.88.40.109
pkgmir.pkg.freebsd.org. 268     IN      AAAA    2a02:6b8:b010:1001::50:1

;; Query time: 0 msec
;; SERVER: 127.0.0.1
;; WHEN: Wed May  6 04:53:04 2015
;; MSG SIZE  rcvd: 354

The SRV records are documented in the pkg-repository(5) manual page.
 
I was going to say something cool about using '+short' but it appears drill(1) doesn't handle it properly:
Code:
dice@armitage:~ % dig _http._tcp.pkg.freebsd.org SRV +short
50 10 80 pkg0.isc.freebsd.org.
50 10 80 pkg0.bme.freebsd.org.
50 10 80 pkg0.ydx.freebsd.org.
10 10 80 pkgmir.pkg.freebsd.org.
50 10 80 pkg0.nyi.freebsd.org.
Code:
dice@armitage:~ % drill _http._tcp.pkg.freebsd.org SRV +short
;; ->>HEADER<<- opcode: QUERY, rcode: NXDOMAIN, id: 22594
;; flags: qr rd ra ; QUERY: 1, ANSWER: 0, AUTHORITY: 1, ADDITIONAL: 0
;; QUESTION SECTION:
;; +short.      IN      SRV

;; ANSWER SECTION:

;; AUTHORITY SECTION:
.       86190   IN      SOA     a.root-servers.net. nstld.verisign-grs.com. 2015050600 1800 900 604800 86400

;; ADDITIONAL SECTION:

;; Query time: 0 msec
;; SERVER: 80.69.66.67
;; WHEN: Wed May  6 13:03:07 2015
;; MSG SIZE  rcvd: 99
That's a shame because I use '+short' a lot in scripts :(
 
This page is first on the google search so I thought to post a reply.

If you read pkg.conf(5) you encounter two variables or parameters namely FETCH_TIMEOUT ( time in seconds after which timeout occurs) and FETCH_RETRY (no of retries after timeout) both set to defaults 30(seconds) and 3 respectively. Thus you get an operation timeout after 90(30 x 3) seconds which on a slow connection is common.

To solve the problem you increase timeout (time) or retries in /usr/local/etc/pkg.conf by uncommenting FETCH_TIMEOUT and/or FETCH_RETRY lines and changing timeout value to say 200 seconds, let the retry set to default if you want.

I had this problem a month ago on my virtualbox setup and this solved my problem.
 
Last edited by a moderator:
Thanks galadriel,

That definitely solved the issue for me!

I had ping times of 20-40ms and pkg was having a warm time downloading the x11/kde package.
 
Back
Top