Solved Pkg repository error

After finishing installing freeBSD 11.1 on a laptop, when I try using pkg install or pkg update I'm getting the following error:
Code:
pkg: Repository FreeBSD load error: access repo file(/var/db/pkg/repo-FreeBSD.sqlite) failed: No such file or directory
pkg: http://pkg.FreeBSD.org/FreeBSD:11:amd64/quarterly/meta.txz: No address record
repository FreeBSD has no meta file, using default settings
pkg: http://pkg.FreeBSD.org/FreeBSD:11:amd64/quarterly/packagesite.txz: No address record
Unable to update repository FreeBSD
Error updating repositories!

I searched about this error, and a few people had this error cause they were not connected in the internet. So I made sure that I was connected, and I'm connected and still getting this error.

The thing is that pkg was working properly after the install, before the reboot, just after the reboot that I got this error.

Oh! And I still don't configured any firewall.

How do I fix it?

If more info are needed, just let me know the command that I need to use.

Thanks
 
Last edited by a moderator:
First be sure if that file really isn't there. I also saw this error pop up on my system one day but the file was there so I ignored it, and eventually so did the system because now there are no further complaints.
 
First be sure if that file really isn't there. I also saw this error pop up on my system one day but the file was there so I ignored it, and eventually so did the system because now there are no further complaints.

There is 2 files, a FreeBSD.meta and a local.sqlite, but the error said about a repo-FreeBSD.sqlite
 
It means your resolver is not set up correctly, can you post the content of /etc/resolv.conf and the result of netstat -rn.

Oh! It was the resolv.conf!! for some reason after install reboot, the correct nameserver was commented and a new trash one was set for some reason.
/etc/resolv.conf

# Generated by resolvconf
search HGW-2501GNP-RC
# nameserver 192.168.1.1

nameserver 127.0.0.1
options ends0


Thanks a lot, now it's working properly
 
I fixed this issue with a simple restart of the computer. I found that it commented out my DNS at one point too. I don't know what it is about
Code:
/etc/resolv.conf
and commenting the nameserver out and replacing it with the loopback. The fact that it works after a reboot means a service probably was the cause, granted it won't help if you still have the incorrect nameserver in
Code:
/etc/resolv.conf

*EDIT
You probably don't need to restart the computer entirely, just the services related to the network (or if you find the one causing the actual issue)
 
Back
Top