I’m running Nextcloud 20, installed via snap on Ubuntu 20.04.
I’m storing the data on an separate hard drive mounded at /media/nextcloud/data/
I’ve run snap connect nextcloud:removable-media and Nextcloud runs fine until it eventually displays the “Your data directory is not writable” error.
To fix this I’ll do the following:
Switch to root:
sudo -i
Stop nextcloud:
snap stop nextcloud
Unmount and remount the hard drive (or I can’t change permissions):
umount /media/nextcloud/data
mount -o rw /media/nextcloud/data/
all permissions must be given to the user www-data and the group www-data:
(example) chown -R www-data:www-data /media/nextcloud/data/
Thiis must also include every subdirectory in this directory.
The handling of data used for programms allowing to send Data outside the system, should never be handeld by the root user.
I discovered what was occurring by browsing dmesg.
The drive in question is an ext4 file system and had an aborted journal which caused the drive to be mounted read only. This was triggering the “Your data directory is not writable” error.
I have now repaired the journal and rebooted the computer several times, and so far seems to be working.
If I continue to have journaling problems, I’ll have to move the data to another, more reliable drive, and retire the current one.