Nextcloud

From Elvanör's Technical Wiki
Revision as of 09:39, 26 October 2025 by Elvanor (talk | contribs) (→‎Server)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Client

  • Sometimes the client can get stuck in very, very long operations (especially if you move or changed large folders around). This is normal - you can check the progress of what's going on in /home/elvanor/.config/Nextcloud/logs/. If it still writes to a log there, everything is fine, you just need to wait.
  • There is also a nextcloud_sync.log file, located at /home/elvanor/.local/share/Nextcloud/. There is probably a bug there as this file should be present in /home/elvanor/.config/Nextcloud/.

Server

General

  • The Nextcloud server log (located at data/nextcloud.log) can grow very big and should be deleted from time to time.
  • Each file version (and deleted files) are kept in data/elvanor/files_versions and data/elvanor/files_trashbin. Those folders can grow a lot and should be purged as well, however they can be very useful in case of serious issues. For instance, at some point I had a corrupted Calibre database - Calibre could not load it and would crash everytime. Restoring a previous version fixed the issue.
  • To retrieve a previous version of a file, use the web interface, it's easy and more robust than trying to find the correct file directly in the files_versions directory (if at all possible).

Installation & Configuration

  • It's recommended to disable the MySQL log bin and set the transaction isolation level to READ-COMMITTED. This can be done permanently by editing /etc/my.cnf and modifying the following lines (be careful, this is a global setting on all databases):
disable_log_bin
#log-bin
transaction-isolation = READ-COMMITTED
  • Setup a cron job:
crontab -u apache -e
  • Add the following line:
*/5  *  *  *  * php -f /srv/net.elvanor/nextcloud/cron.php
  • You can check with crontab -u apache -l.

Locked Files

  • I guess this should not happen, but if the server is refusing to sync because of locked files, you can manually purge all locks by directly connecting to the database and issuing:
DELETE FROM net_elvanor_nextcloud.oc_file_locks WHERE true;

Maintenance

  • Following commands can be issued if you run into issues (into the Nextcloud directory):
sudo -u apache php occ maintenance:repair --include-expensive
sudo -u apache php occ db:add-missing-indices
sudo -u apache php occ files:scan-app-data
sudo -u apache php occ files:scan --all
sudo -u apache php occ files:cleanup
  • The files:scan --all can take a long time, you can check if it's still ongoing by looking at the data/nextcloud.log. Better to run it without any Nextcloud clients running if possible.