NextCloud Snap - Removable Media Issue

TL;DR: Can’t get NextCloud Snap to use external drive, even when removable-media is connected. Could it be an issue with the Snap connection?

I am trying to migrate my NextCloud data to a new server. I want to use the NextCloud Snap.

However, I cannot get it to utilize my external hard drive. Whether I am setting it up as a fresh install with an empty folder, or trying to point it to my existing data, NextCloud will not use my external drive.

I am on a Raspberry Pi 4 running Ubuntu 18.04 64-bit.

I’ve been following this guide, and many forum posts.

The commands I used:

sudo mkdir -p /media/FirstOfTheSun/NextcloudSnap/data
sudo chown -R root:root /media/FirstOfTheSun/NextcloudSnap
sudo chmod -R 770 /media/FirstOfTheSun/NextcloudSnap
sudo snap install nextcloud
sudo snap connect nextcloud:removable-media
wait 1 # nano didn't load the file the first time i did this
sudo nano /var/snap/nextcloud/current/nextcloud/config/autoconfig.php
# change to: 'directory' => '/media/FirstOfTheSun/NextcloudSnap/data',
sudo snap restart nextcloud.php-fpm
sudo snap restart nextcloud # for good measure
sudo nextcloud.manual-install [user] [password]

Where it should have put the data:

$ sudo ll /media/FirstOfTheSun/NextcloudSnap/data/
total 8
drwxrwx--- 2 root root 4096 Apr 30 08:15 ./
drwxrwx--- 3 root root 4096 Apr 30 08:15 ../

Where it actually did put the data:

$ sudo ll /var/snap/nextcloud/common/nextcloud/data
total 20
drwxrwx--- 4 root root 4096 Apr 30 08:31 ./
drwxr-x--- 4 root root 4096 Apr 30 08:30 ../
-rw-r--r-- 1 root root 542 Apr 30 08:31 .htaccess
-rw-r--r-- 1 root root 0 Apr 30 08:31 .ocdata
drwxr-xr-x 3 root root 4096 Apr 30 08:31 appdata_ocheh8esus5e/
drwxr-xr-x 3 root root 4096 Apr 30 08:31 [user]/
-rw-r--r-- 1 root root 0 Apr 30 08:31 index.html
-rw-r--r-- 1 root root 0 Apr 30 08:30 nextcloud.log

So it didn’t pick up the right location automatically. Fine, I’ll change the directory manually.

$ sudo nextcloud.occ config:system:set datadirectory --value="/media/FirstOfTheSun/NextcloudSnap/data/"
System config value datadirectory set to string /media/FirstOfTheSun/NextcloudSnap/data/
$ sudo grep datadirectory /var/snap/nextcloud/current/nextcloud/config/config.php
'datadirectory' => '/media/FirstOfTheSun/NextcloudSnap/data/',
$ sudo snap disable nextcloud
$ sudo mv /var/snap/nextcloud/common/nextcloud/data/ /media/FirstOfTheSun/NextcloudSnap/
$ sudo snap enable nextcloud

Confirm that the data transferred:

$ sudo ll /media/FirstOfTheSun/NextcloudSnap/data
total 20
drwxrwx--- 4 root root 4096 Apr 30 08:31 ./
drwxrwx--- 4 root root 4096 Apr 30 08:49 ../
-rw-r--r-- 1 root root 542 Apr 30 08:31 .htaccess
-rw-r--r-- 1 root root 0 Apr 30 08:31 .ocdata
drwxr-xr-x 5 root root 4096 Apr 30 08:32 appdata_ocheh8esus5e/
drwxr-xr-x 3 root root 4096 Apr 30 08:31 [user]/
-rw-r--r-- 1 root root 0 Apr 30 08:31 index.html
-rw-r--r-- 1 root root 0 Apr 30 08:30 nextcloud.log

Confirm that removable-media is connected:

$ sudo snap connections nextcloud
Interface Plug Slot Notes
network nextcloud:network :network -
network-bind nextcloud:network-bind :network-bind -
removable-media nextcloud:removable-media :removable-media manual

Go to the web interface:

Your data directory is invalid Ensure there is a file called ".ocdata" in the root of the data directory.

Try to use occ:

RuntimeException: Could not get appdata folder in /snap/nextcloud...

(+18 lines of stack trace)

Entry from /etc/fstab if it helps:

UUID=[uuid] /media/FirstOfTheSun auto nosuid,nodev,nofail 0 0

What am I missing here? Running sudo snap connect nextcloud:removable-media seems to resolve this for most people. Is there a bug in the Pi 4 Ubuntu x64 implementation?