Pi-hole and DNS issues after power outage

Pi-hole and DNS issues after power outage

Today we had an power outage and when the power came back, I found out that most of the webpages are not really working (but the internet connection as a whole seemed to be operational). After short investigation I realized that my Pi-hole powered DNS running on a Raspberry Pi is to blame.

To keep this short, the problem was that during the few hour long power outage, Raspberry Pi lost the track about time and when it get back online, it was few hours off.

The name resolution was failing because of that.

I have RPI configured in a way it should sync the time automatically.

However that wasn’t working because DNS name resolution was not working.

So to sync the time I need DNS and to be able to use DNS I need to sync time first – Catch-22.

Solution was simple – disable automatic time sync, set rough time manually, enable the automatic time sync:

$ sudo timedatectl set-ntp 0
$ sudo timedatectl set-time '20:14:00'
$ sudo timedatectl set-ntp 0

Note that I had to disable the automatic time sync first in order to be able to set time manually and avoid a related error:

$ sudo timedatectl set-time '20:08:00'
Failed to set time: Automatic time synchronization is enabled

I hope this blog post will help someone or at least it will help me if I hit this ever again :)

Comments are closed.