Cannot ssh into my Pi-hole

Hello everybody.

I used to have a different internet provider and modem. After switching it to the current one, I was able to connect to my pyhole directly (plug monitor and keyboard in), set it to DHCP again and made it discoverable on the new device again.

But for some reason, I am unable to ssh to it via CLI - connection always times out.
I tried both old IP and new IP as well, to no avail.

I can login directly, but not via SSH.
I tried sudo apt autoclean as described here, but the problem persists.
I also tried disable my antivirus before trying to connect - no avail.

Can anybody help me find out what is goin on?

Is your Pi-hole working? Can you access it in your web browser?

I cannot, neither in web browser, nor via ssh.

The Pi originally would have had a static IP setup with the old router info. If the IP range changed between the old router and the new, this would need to be updated,

If you setup the pihole as DHCP server did you make the requisite changes to the new router?

If you mean signing in, going to armbian-config, then Network/Ip - here select DHCP and confirm - that I did and only becasue of that I can see the Pyhole again on the new router

You mean setting up the DHCP + IP-MAc bind (so the leave would not expire)? - I did that according to a manual for my eero 6 wifi (I will post the link to it, once I will be at home). I can see my Pyhole device in the settings now, but can´t connect to it.

When I read you original post it sounded like you were using the Pihole as your DHCP server which is different.

Can you ping your Pi-hole, using it's IP address that you can see in your router, from another computer?

Try connecting directly with a monitor and keyboard. Can your Pi-hole access the Internet? Try pinging an external IP, for example:

ping -c 5 1.1.1.1

Next, create a debug log. If you can access the Internet in the previous step then this can be uploaded, otherwise it will stay on your Pihole.

To do that, run the command below. At the end it will prompt you to upload it.

  • If you could access the Internet in the previous step then type y and Enter to upload. Post the token URL that it gives you in here.
  • If you could not access the Internet in the previous step, just press Enter to say No and leave it on your Pi-hole.
pihole -d

Then take a look at the log with this command:

sudo less -r /var/log/pihole/pihole_debug.log

Look for the sections below to see if anything stands out. If you were able to upload your log then we will also take a look.

*** [ DIAGNOSING ]: Operating system
Does it say it is supported?

*** [ DIAGNOSING ]: Network interfaces and addresses
Does it show the IP address?

*** [ DIAGNOSING ]: Network routing table
Does it show your router's IP as the default route?

*** [ DIAGNOSING ]: Networking
Does it show the correct network port and IP?

*** [ DIAGNOSING ]: Ports in use
Is SSH running on port 22?

*** [ DIAGNOSING ]: Discovering active DHCP servers (takes 10 seconds)
Do you see a response from your router?

If you cannot ssh using the IP address of the machine that hosts your Pi-hole, then that's an OS level issue, not a Pi-hole one.

Some OSs require specific action to allow ssh access.
You should consider to also consult forums specialising on your OS.

Hello chrislph,

As for pinging ping -c 5 1.1.1.1 - I was able to ping that site when connected to my router.

Howerever, I noticed my pyhole keeps turning off, when I connected my keyboard + mouse + monitor, it will turn off during start - my assumption is that since it is a gaming keyboard with a keybutton lights, it might be too much for it. Once I connected only keyboard and monitor, without being connected to the router, I was able to login, do the pihole-d, but the moment I plugged in the ethernet cable it keeps turning off.

I have no flipping idea why.

But I was able to create that log while not being connected to my router. I will try to get that file out and send it here.

When I tried to iplug USB, it turned off again.

Try it from a terminal window on your Pi-hole. Need to see if it's connected to your network and the Internet.

This turning off behaviour sounds like a power supply problem. Make sure you're using a good quality power supply, and if this is a Raspberry Pi, ideally the official power supply for most reliable results.

There's no need to post the debug log here – just the token URL that it gives you when it's finished. If you can't get onto the Internet then you'll need to inspect it yourself using the previous post as a guide.

Hello chrislph,

So I had to bring my pyhole to my work, where we have smaller monitors and less-resource hungry keyboards and I was able to get the log you wanted and upload it:
https://tricorder.pi-hole.net/q4ueW6Xj/

Hope you will be able to find something useful there.

The power supply problem - I bought the device more than a year ago from a man, together with the supply, so what I have is what I get.

That said, turning off just because you plug a keyboard in is not correct behaviour and will cause endless problems. You can pick up an official Raspberry Pi power supply from a Raspberry Pi supplier online, or at least pick up a dedicated normal keyboard to use with it instead of your gaming one.

I was able to look at it earlier today before it expired.

You're running Ubuntu 18.04 which is an unsupported version. You should plan to replace it with a fresh install of a current and supported version such as 24.04 LTS. Give it a static IP address and then reinstall Pi-hole on the new version.

Your router is the DHCP server but it is not giving out any DNS server to clients. You can fix this in your router by ensuring that Pi-hole's IP address is added to the DHCP local/LAN DNS section. When this has been fixed, take your devices off and back on to your network to pick up the change and the Pi-hole DNS.

Your earlier log contained a lot of these entries:

config error is REFUSED (EDE: network error)

which means it wasn't able to reach any DNS servers at that time. Later entries show it resolving okay, and the log showed that it was able to successfully test a domain against Google's 8.8.8.8. Be mindful of any router config or networking which would prevent the Pi-hole from reaching the Internet.

You have IPv6 upstream DNS servers ticked, but no external IPv6 routing in the OS so you won't be able to reach them. Untick those so that you are only using IPv4 servers. You can still resolve IPv6 records if needed via the IPv4 servers.

Finally, your /etc/resolv.conf file, which is how the OS knows where to do its DNS lookups, showed a pair of 192.168.110.x addresses, but your OS is on a 10.211.114.x network and it's not clear that it would be able to reach those servers. Maybe it could if this addressing comes from one of these mesh-based range extenders, as they often bridge both networks so things don't break.

Summary

  • Pi-hole should be running on a supported OS
  • configured with a static IP on the local network
  • able to reach the router and the Internet
  • be using DNS servers that it can reach
  • not firewalled or blocked by anything running externally or on the OS itself
  • using IPv4 upstream servers
  • the router's DHCP needs the Pi-hole IP address adding to its local/LAN settings so it can give it out
  • fix any power-related issues with a quality power supply, or workaround for now with a standard keyboard

Gee, thanks for looking at that, that´s a lot of work, I will slowly get to it.
Noob question: is there any way to upgrade Ubuntu to current stable version WITHOUT reinstalling and losing all the data in the pyhole?

I am asking because I don´t know how to export my current settings, since I can´t access the GUI via http://<IP_ADDPRESS_OF_YOUR_PI_HOLE>/admin/

Yes, you can export your Pi-hole lists, rules and so on using the Teleporter feature. This can be found in the GUI at Settings > Teleporter > Backup, and is also accessible from the terminal

cd
pihole -a -t backup.tar.gz

This creates a file called backup.tar.gz in your home directory. To save a copy, perhaps the easiest way is to plug a USB stick into the Pi, find where it is mounted with the lsblk command, and copy the backup there. That might look something like this

Check where the USB is mounted (/media/chris/SDCARD in this case)

$ lsblk
NAME             MAJ:MIN RM  SIZE RO TYPE  MOUNTPOINTS
...
sdb                8:16   1 59.5G  0 disk  
└─sdb1             8:17   1 59.5G  0 part  /media/chris/SDCARD
...

Change to home directory

$ cd

Copy the backup file to the USB stick and check it's there

$ cp ./backup.tar.gz /media/chris/SDCARD
$ ls -l /media/chris/SDCARD
...check the file is showing there

Eject the USB stick

$ sync
$ umount /media/chris/SDCARD

Now you can wipe the SD card and install a fresh copy of Ubuntu, or if you are using it just for Pi-hole, Pi OS might be a better choice since it's the OS intended for the Pi.

Finally, give it a static IP on the network – you will need to work with your router to do this properly. make sure you can ping it on your network and SSH into it.

Once it has a working static IP, reinstall Pi-hole and then use the above Teleporter section to pull in your backup file and re-add your lists.

Hello Chris,
How do I untick the IPv6 without GUI access?
Can it be done via CLI?

Also, I tried to do the backup and it seems to successfully copy it to my USB, but when I plug it to my windows working station PC to check its contents, its empty.

Where are you seeing the ticked IPv6 that you need to untick? I'm not sure where you mean.

When you plug it back into the Pi, can you see the backup file still on there? Windows can only see certain filesystem formats so it may depend on how the USB stick was formatted, but the main thing is that Linux on the Pi can see it when you plug it back in. Don't forget to eject it cleanly using the previous commands.

Where are you seeing the ticked IPv6 that you need to untick? I'm not sure where you mean.

Untick IPv6 - you mentioned in one of your previous comments: "You have IPv6 upstream DNS servers ticked, but no external IPv6 routing in the OS so you won't be able to reach them. Untick those so that you are only using IPv4 servers. You can still resolve IPv6 records if needed via the IPv4 servers."

Can I do this via CLI? Because I cannot access the admin webpage

When you plug it back into the Pi, can you see the backup file still on there? Windows can only see certain filesystem formats so it may depend on how the USB stick was formatted, but the main thing is that Linux on the Pi can see it when you plug it back in. Don't forget to eject it cleanly using the previous commands.

I thought so - yes, Linux can see it.

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.