# pkg server broken?



## xtaz (Jan 20, 2019)

Is anybody else getting errors trying to use the pkg tool?


```
# pkg upgrade                                                      ~
Updating FreeBSD repository catalogue...
pkg: Repository FreeBSD load error: access repo file(/var/db/pkg/repo-FreeBSD.sqlite) failed: No such file or directory
pkg: https://pkg.FreeBSD.org/FreeBSD:12:amd64/latest/meta.txz: Forbidden
repository FreeBSD has no meta file, using default settings
pkg: https://pkg.FreeBSD.org/FreeBSD:12:amd64/latest/packagesite.txz: Forbidden
Unable to update repository FreeBSD
Error updating repositories!
```

I looks like the webserver for the following server is giving 401 forbidden in any of the actual package directories.


```
This is pkg0.bme.freebsd.org - an EU regional mirror for pkg(8).

It is generously hosted by Bytemark in York, UK.
```

And I'm assuming that the first error about the sqlite database is because pkg has maybe deleted the database because this type of error is unexpected and it's crashed out.


----------



## fulano (Jan 20, 2019)

The pkg server is working fine, the problem is in your side:


> pkg: Repository FreeBSD load error: access repo file(/var/db/pkg/repo-FreeBSD.sqlite) failed: No such file or directory



It seems that your repo-FreeBSD.sqlite  was deleted or corrupted. Try to run `pkg update -f`


----------



## obsigna (Jan 20, 2019)

xtaz said:


> Is anybody else getting errors trying to use the pkg tool?
> 
> 
> ```
> ...



This mirror can’t be used with the https: protocol, use http instead. For this you need to edit /usr/local/etc/pkg/repos/FreeBSD.conf in order to change the protocol from https to http.

In the below screenshot, the error message in German: Zertifikatsname „pkg.freebsd.org“ stimmt nicht mit der Eingabe überein. translates more or less to: Certificate name "pkg.freebsd.org" does not match the input. Actually this means, that this mirror deployed the upstream certificate of „pkg.freebsd.org“ to it's site which is technically plain wrong because for TLS „pkg0.bme.freebsd.org" is a different domain, of course.

Unless Bytemark in York, UK sorts out the certificate deployment issue, you need to use http.

PS: Now I see, that all mirrors listed on http://pkg.freebsd.org/ show the same issue. The mirrors cannot be addressed directly by https. Either use http or let mirror routing do it’s automagic.


----------



## Grzegorz Wiktorowski (Jan 20, 2019)

Trying to access:

http://pkg.freebsd.org/FreeBSD:11:amd64/latest/

or

http://pkg.freebsd.org/FreeBSD:11:amd64/quarterly/

in Edge browser on Windows 10 I see "403 Forbidden". It's not a certificate issue.

The pkg0.bme.freebsd.org mirror was inaccessible lately.


----------



## obsigna (Jan 20, 2019)

Grzegorz Wiktorowski said:


> ...
> The pkg0.bme.freebsd.org mirror was inaccessible lately.


Now it is inaccessible for me as well, however, a few hours ago I could reach it, otherwise, I would not have been able to produce the screenshot.


----------



## xtaz (Jan 20, 2019)

Seems like someone has definitely broken something then. Hopefully it gets sorted out soon. As for https, I know that http is the default, but https has usually always worked fine. I would think it would be unlikely that https would be removed as a method for fetching packages. But as you guys are finding that http isn't working either then I guess it's a larger problem than that.


----------



## Grzegorz Wiktorowski (Jan 20, 2019)

There is the problem with the mirror:

https://forums.freebsd.org/threads/access-to-freebsd-mirrors.68905/

Maybe the mirror is going to be resuscitated.


----------



## twllnbrck (Jan 20, 2019)

Same here. I had been thinking of opening another 'something is wrong with pkg(8)'-topic but I was reassured by this thread  .


----------



## Machiaveli (Jan 20, 2019)

Ahah would follow the same path but luckily found this thread


----------



## xtaz (Jan 21, 2019)

Well my config points directly to pkg.freebsd.org and so if that pkg0.bme.freebsd.org server has been dead since Xmas it should have been removed from the GeoIP DNS surely? I see that thread has a list of all of the package mirrors and so if I am still having the same problem later tonight at least I can change the config to point to a specific mirror instead and see if that works.

Someone else on the mailing lists has noticed this as well: https://lists.freebsd.org/pipermail/freebsd-questions/2019-January/284142.html


----------



## Grzegorz Wiktorowski (Jan 21, 2019)

It seems the pkg0.bme.freebsd.org mirror is in a good state now.


----------



## talsamon (Jan 21, 2019)

I had a similar problem with 11.2 yesterday. /var/db/pkg/repo-FreeBSD.sqlite did not exist. I had to to run `pkg-static install -f pkg`. This solved the problem.


----------



## Machiaveli (Jan 22, 2019)

Grzegorz Wiktorowski said:


> It seems the pkg0.bme.freebsd.org mirror is in a good state now.



Things are sorted out, thanks for the update. I had no need to run `pkg update` nor `pkg-static install -f pkg`.
As soon as pkg() was called, /var/db/pkg/repo-FreeBSD.sqlite was fetched from pkg0.bme.freebsd.org


----------

