NextCloud data consistency issues and suggested workarounds

NextCloud is quite particular about performing maintenance events outside of the NC interfaces while it’s in maintenance mode.

The default set of packages in the 5.1.6 version don’t put the NC install in maintenance mode before system updates, NC package updates, system reboots, etc. This has the potential to mess with the NC database as async updates or reboots happen. I’ve seen a worst-case scenario played out in /srv/www directory deleted after reboot - where the entire /srv/www directory vanished after a reboot.

Here are some suggestions to make the situation a bit better:

  1. Put NC in maintenance mode before installing opkg updates. As an optimization, this can be selectively done only if NC packages are part of updates.
  2. Take a snapshot of the /srv partition before installing updates in 1.
  3. Take a snapshot of the /srv partition before rebooting the system
  4. Put NC in maintenance mode before rebooting the system, and take it out of maintenance mode after /srv has been mounted and any post-reboot system maintenance activities are performed.

Those are the few things that existing users can immediately do for their existing NC installations. For the next iteration of the Turris OS, though, I’d like to discuss moving NC to an LXC container instead of being offered as the OpenWrt package, though. In the current setup, there are a few drawbacks:

i. The NC version is quite old in the repos compared to the stable releases from the NC project
ii. Packages that NC recommends and depends on some functionality, like imagemagick are missing in the default set of repos.

Moving to an LXC-based install will give more flexibility to the community to manage and administer NC on Turris OS properly.