uninstalling Pihole


I tried to uninstall piHole from my pie4 having the following installed:

   [ ] 0    OpenSSH Client: Feature-rich SSH, SFTP and SCP client                                                    │
                             │    [ ] 3    MC: midnight commander, powerful file manager                                                            │
                             │    [ ] 5    ALSA: Advanced Linux Sound Architecture                                                                  │
                             │    [ ] 6    X.Org X Server: aka X11 - X Window System implementation                                                 │
                             │    [ ] 10   iftop: displays bandwidth usage information                                                              │
                             │    [ ] 11   IPTraf: interactive colorful ip lan monitor                                                              │
                             │    [ ] 17   Git: Clone and manage Git repositories locally                                                           │
                             │    [ ] 23   LXDE: ultra lightweight desktop                                                                          │
                             │    [ ] 28   TigerVNC Server: desktop for remote connection                                                           │
                             │    [ ] 65   Netdata: real-time performance monitoring                                                                │
                             │    [ ] 68   Remot3.it: (aka Weaved) access your device over the internet                                             │
                             │    [ ] 73   Fail2Ban: prevents brute-force attacks with ip ban                                                       │
                             │    [ ] 81   LLSP: Lighttpd | SQLite  | PHP                                                                           │
                             │    [ ] 84   Lighttpd: Extremely lightweight webserver                                                                │
                             │    [ ] 87   SQLite: Persistent single-file database system                                                           │
                             │    [ ] 89   PHP: Hypertext Preprocessor for dynamic web content                                                      │
                             │    [ ] 93   Pi-hole: block adverts for any device on your network                                                    │
                             │    [ ] 103  DietPi-RAMlog: minimal, optimised logging                                                                │
                             │    [ ] 105  OpenSSH Server: Feature-rich SSH server with SFTP and SCP support                                        │
                             │    [ ] 115  Webmin: web interface system management                                                                  │
                             │    [ ] 117  PiVPN: openvpn/wireguard server install & management tool                                                │
                             │    [ ] 182  Unbound: validating, recursive, caching DNS resolver

When I get to the stage of selecting packages to uninstall I don’t know what I should uninstall/leave.
(I uninstalled what I thought was not needed incl whiptail and screwed my system. Even dietpi-backup couldn’t run to restore my system, so I had to reinstall fresh on another pen and then do the dietpi-backup/restore from the old pen).

Having the above installed what is safe to uninstall of the additional packages the piHole uninstall presents?

THX in advance!

Simply select PiHole on first stage and if not needed Unbound. During removal, don’t select packages are offered by Pihole uninstaller. There are quite some mandatory packages that are needed for basic operation.

OK, so I don’t uninstall any of the offered packages to uninstall in addition the the main pihole one.


Yes, don’t accept any offer from the Pihole removal script. At least if you don’t know what these packages are about.

On the other hand side, you have the DietPi software catalogue. There it depends which application you still like to run. If you give an overview of what is still needed, we could probably check dependencies and give a hint what might be obsolete.

In my initial post I have included what dietpi software I have installed and intend to keep…
I just want to replace Pi-hole by Adguard.

This is what is offered:

  [i] The following dependencies may have been added by the Pi-hole install:
    dhcpcd5 git iproute2 whiptail dnsutils cron curl iputils-ping lsof netcat psmisc sudo unzip wget idn2 sqlite3 libcap2-bin dns-root-data libcap2


Just leave this all in place as already mentioned. These are core packages and removing them will break your system


The following may be removed, but the others better not indeed:

G_AGP dhcpcd5 dnsutils

How do I remove them after I have uninstalled Pi-hole?

apt-get –-purge remove ...

I presume.

The code is the command. Copy%paste it to your console.

A more manual way, as it is about APT packages and it’s good to learn how to manage them in general:

apt purge dhcpcd5 dnsutils

It will show you what will be done, also if other dependant packages are removed, and requires you to confirm. To remove then obsolete dependencies:

apt autopurge
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following packages were automatically installed and are no longer required:
  bind9-host libbind9-161 libdns1104 libgeoip1 libirs161 libisc1100 libisccc161 libisccfg163 liblmdb0 liblwres161
Use 'apt autoremove' to remove them.
The following packages will be REMOVED:
  dhcpcd5* dnsutils*
0 upgraded, 0 newly installed, 2 to remove and 0 not upgraded.
After this operation, 1044 kB disk space will be freed.
Do you want to continue? [Y/n]

What about those: bind9-host libbind9-161 libdns1104 libgeoip1 libirs161 libisc1100 libisccc161 libisccfg163 liblmdb0 liblwres161

OK. "apt autopurge "is the same as “apt autoremove” I guess.

No it’s not the same. apt autoremove will leave config files in place, apt autopurge removes packages more cleanly.

Ah in case you run a Stretch image, the “autopurge” shortcut does not yet exist and it is apt --purge autoremove instead.

Used apt autopurge as suggested. All clean now. Thanks a lot!!

Hi Joulinar,

I was having issues with Pihole and tried to uninstall Pihole but I didn’t know I had keep the dependencies.
I think it was removing git and iproute2 and after that system crashed I think, now I cannot connect anymore to the system.

Is there anything I can do??

Thank you as usual.

can you share some details on your system? What device you are running? And are you able to connect a screen + keyboard?

Yes, it’s a Orange Pi Zero running Diet Pi. It has a USB so I can connect a keyboard, but there’s no visual to help me in that case.

hmm without screen it’s quite a challenge as you don’t know what to type in.

any ideas from your side? Personally I don’t know if serial access would be working on a Orange Pi Zero.

I was able to get my hands on this software and read the micro sd contents from it (mainly for my /var/www folder since I was running a server there and had some .html and .css configs). If I reinstall Dietpi and move the contents from my dietpi backup folder to the new diet pi, would I then be able to restore the system to that backup state?

what OS is your desktop system? Linux based? Theoretically there is an option to restore a backup during initial install from an attached USB device. Means you would need to copy backup folder from SD card to another USB pen stick/HDD (depending on size. Best would be to do this on a Linux based system to be able to keep file/folder permission and sym links.