Nextcloud
Hosting Nextcloud Yourself
Hosting a Nextcloud instance on your own can be challenging. You could rely on YunoHost or other pre-configured platforms, but here I describe how I host and maintain my installation manually.
Handling a Server Error Caused by a Missing clamav-daemon
I uninstalled clamav-daemon and Elasticsearch, since I was not using these features and ClamAV had been causing continuous issues (including the well-known false positives when scanning PDFs for credit card numbers — something I do not need at all).
I had already disabled Full-Text Search for several days, but I had not disabled the Antivirus app. After removing Elasticsearch and ClamAV, everything seemed fine until I performed an upgrade of my Nextcloud instance.
Suddenly, I was greeted with:
“An internal server error occurred.”
The Nextcloud log showed that the system was still trying to connect to the missing ClamAV daemon.
To inspect the log, change into your Nextcloud installation directory and run:
sudo -u www-data php occ log:tail
This will stream the most recent log entries. The shortened error message in my case was:
Error core RuntimeException: Cannot connect to "/var/run/clamav/clamd.ctl":
No such file or directory (code 2) at apps/files_antivirus/lib/Scanner/ExternalClam.php line 41
Because the web interface was no longer accessible, I had two options to restore functionality:
- Reinstall ClamAV, or
- Disable the antivirus app inside Nextcloud.
I chose the latter. Disabling the app via the command line is straightforward:
# Change into the Nextcloud installation directory
cd /var/www/nextcloud
# List installed apps (enabled and disabled)
sudo -u www-data php occ app:list
# Disable the files_antivirus scanner
sudo -u www-data php occ app:disable files_antivirus
After disabling the app, the Nextcloud web interface became accessible again and the system returned to normal operation.