# pkg update; Operation timed out; dnsmasq



## gqgunhed (Jan 10, 2021)

I have a similiar behavior like mentioned in an older post.
Whenever I try to run `pkg update` I receive a timeout:

```
Updating FreeBSD repository catalogue...                                                   
pkg: http://pkg.freebsd.org/FreeBSD:12:amd64/quarterly/meta.txz: Operation timed out       
repository FreeBSD has no meta file, using default settings                                
pkg: http://pkg.freebsd.org/FreeBSD:12:amd64/quarterly/packagesite.txz: Operation timed out
Unable to update repository FreeBSD                                                        
Error updating repositories!
```

I tried with `drill pkg.freebsd.org SRV` as mentioned in the other post and discovered that my dnsmasq does not report properly:

```
;; ->>HEADER<<- opcode: QUERY, rcode: NOERROR, id: 63983                
;; flags: qr aa rd ra ; QUERY: 1, ANSWER: 0, AUTHORITY: 0, ADDITIONAL: 0
;; QUESTION SECTION:                                                    
;; pkg.freebsd.org.     IN      SRV                                     
;; ANSWER SECTION:                                                      
;; AUTHORITY SECTION:                                                   
;; ADDITIONAL SECTION:                                                  
;; Query time: 0 msec                                                   
;; SERVER: 10.0.0.1
;; WHEN: Sun Jan 10 10:57:41 2021                                       
;; MSG SIZE  rcvd: 33
```

So I looked through my /usr/local/etc/dnsmasq.conf and checked my active options.
After disabling the option "*filterwin2k*", which according to dnsmasq() does the following:


> The requests blocked are for records of types SOA and SRV, and type ANY where the requested name has underscores, to catch LDAP requests.


So after disabling *filterwin2k* and a `service dnsmasq restart` I get the following result:

```
;; ->>HEADER<<- opcode: QUERY, rcode: NOERROR, id: 17311                                                        
;; flags: qr rd ra ; QUERY: 1, ANSWER: 1, AUTHORITY: 1, ADDITIONAL: 0                                           
;; QUESTION SECTION:                                                                                            
;; pkg.freebsd.org.     IN      SRV                                                                             
;; ANSWER SECTION:                                                                                              
pkg.freebsd.org.        1469    IN      CNAME   pkgmir.geo.freebsd.org.                                         
;; AUTHORITY SECTION:                                                                                           
geo.freebsd.org.        1469    IN      SOA     gns1.freebsd.org. hostmaster.freebsd.org. 1 7200 1800 259200 900
;; ADDITIONAL SECTION:                                                                                          
;; Query time: 0 msec                                                                                           
;; EDNS: version 0; flags: ; udp: 1232                                                                          
;; SERVER: 10.0.0.1                                                                                            
;; WHEN: Sun Jan 10 11:07:23 2021                                                                               
;; MSG SIZE  rcvd: 121
```

Now this looks much better.
But my `pkg update` still runs into timeout. Hmm, strange.
So I reset my `pkg` by issuing the follwing commands:

```
rm /usr/local/etc/pkg/*
rm /usr/local/etc/pkg.conf
```
(I had an entry for a proxy in the latter one which caused the timeout, but the SRV was broken, too ;-)) and after that my `pkg` returns to normal operation:

```
Updating FreeBSD repository catalogue...                      
Fetching meta.conf: 100%    163 B   0.2kB/s    00:01          
Fetching packagesite.txz: 100%    6 MiB   6.4MB/s    00:01    
Processing entries: 100%                                      
FreeBSD repository update completed. 30172 packages processed.
All repositories are up to date.
```

I hope this troubleshooting helps someone.


----------



## SirDice (Jan 10, 2021)

Reinstall ports-mgmt/pkg. The /usr/local/etc/pkg.conf actually contains a couple of useful aliases. If you reinstall it will be restored.


----------

