Problem with pkg upgrade - certificate verification failed - SOLVED

I am running 14.5-RELEASE. When I run 'pkg upgrade', I now get a long series of error messages complaining about ssl certificate verification failures. I am currently unable to upgrade any packages.

# pkg upgrade 2>&1 | tee out
Updating FreeBSD repository catalogue...
Certificate verification failed for /CN=pkg.freebsd.org
10A0862BE62D0000:error:0A000086:SSL routines:tls_post_process_server_certificate:certificate verify failed:/usr/src/crypto/openssl/ssl/statem/statem_clnt.c:1890:
Certificate verification failed for /CN=pkg.freebsd.org
10A0862BE62D0000:error:0A000086:SSL routines:tls_post_process_server_certificate:certificate verify failed:/usr/src/crypto/openssl/ssl/statem/statem_clnt.c:1890:
...

The error message repeats many time. Full output is here https://termbin.com/ixwz

Does anyone know what has gone wrong?
 
Well, you were right, thanks for the hint! Chrony had stopped working for some reason and it was about 12 hours behind. Strange as it's been working for weeks. I switched over to ntpd and now everything is working again, the pkg upgrade now works. I noticed something was wrong with name service earlier too, it couldn't resolve certain names, although others worked normally. Perhaps a problem in the upstream nameservers (cloudflare). It's all working again now. I may have screwed up the chrony config of course. I'll leave it running on ntpd for the time being, I'll go back and check the chrony config when I have some time.
 
Something strange was happening in addition to the ssl cert problem, because I couldn't get network names resolved for some (but not all) sites, at the same time as I saw the ssl cert errors. The system could resolve google.com, yahoo.com, but not some uk sites, it couldn't resolve bbc.co.uk for example and came back with "name not found". It was able to resolve freebsd.org. I left it for perhaps 8 or 9 hours and tried it again, at whicn point I found name service was all working normally again, without my having changed anything. I am using local unbound, configured to talk to cloudflare dns servers, with the secure dns protocol. So it looks like something wasn't fully working in the dns chain at the time I got the ssl cert errors. However, once dns started working properly again, I still got the ssl cert errors from pkg upgrade until I switched over from chrony to ntpd and got time sync working correctly, at which point pkg upgrade worked again. It's all a bit strange because I've been running chrony for a while and pkg upgrade has been working normally, but perhaps if the clock drifts enough that might cause a problem, it may be that I didn't spot the clock drift previously. I'm sure there's a logical explanation but it's probably not worth debugging it in depth unless it starts happening more often, this is only the the first time I have ever seen this issue. Anyhow everything is back up and running normally now.
 
Back
Top