When trying to unistall apache2 there is a problem it happen. I try to unistall the apache2 files from raspberry pi 4 but when i try this command

$ sudo apt-get purge apache2

after it finished it says:

dpkg: warning: while removing apache2, directory '/var/www/html' not empty so not removed

does anyone know how to fix it?

  • 2
    The Raspberry Pi is irrelevant to the question.
    – joan
    May 17, 2023 at 15:39
  • Don't ever use apt-get use apt
    – Milliways
    May 17, 2023 at 22:28
  • 1
    That comment means that you've added some of your own (not package maintained) files into /var/www/html and apt or apt-get (doesn't matter) can't remove them. It's not specific to the RPi.
    – Dougie
    May 18, 2023 at 10:03

1 Answer 1


Delete the directory and contents manually if they are not needed.

The purge process does not know if it is safe to delete the directory and contents or not.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.