.ocdata missing - snap install on pi4 ubuntu

Some or all of the below information will be requested if it isn’t supplied; for fastest response please provide as much as you can :heart:


Nextcloud version:
Operating system and version: Ubuntu 20.04
Apache or nginx version: (not sure how to check. If anyone could tell me how I’ll do so)
PHP version: 7.4

I’m very new to both nextcloud, and Raspberry Pi. I’ve installed nextcloud before the regular way on an x86 and had this problem as well when I moved the data directory to and external HDD. I’ve looked through all the forums I can find, tried changing permissions, and used touch to make a new .ocdata file. nothing has worked so far. If there is any additional information I can give that would be useful, let me know (however you may have to give me the command, as I’m still very new at this)

Is this the first time you’ve seen this error? : No

Steps to replicate it:

  1. snap install
  2. mount raid0 at /mnt/nextdata
    3)mkdir /mnt/nexdata/data
    4)copy to new data dir
  3. change data dir in config
  4. restart snap nextcloud

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

/\ This is most everything I’ve done today from creating the raid0 to moving the dir. Hope it helps.
1 Like

@Andre_D I can confirm all of the same issues.
I’ve tried tons of same or similar things to your gist – that was really helpful as a checklist.

I have RPI, Nextcloud 19 with latest subversion, external SSD mounted (confirmed working).

I did a clean install 2 weeks ago, migrated a lot of data to the SSD, let NC index and everything was great.

Problem occurred when a reboot occurred from power interruption.

My main issue is, no commands or changes i make are working. The server gets hung up on something in this file not liking my paths.
sudo nextcloud.occ maintenance:mode --on
An unhandled exception has been thrown:
RuntimeException: Could not get appdata folder in /snap/nextcloud/22408/htdocs/lib/private/Files/AppData/AppData.php:94
Stack trace:
#0 /snap/nextcloud/22408/htdocs/lib/private/Files/AppData/AppData.php(110): OC\Files\AppData\AppData->getAppDataRootFolder()
#1 /snap/nextcloud/22408/htdocs/lib/private/Files/AppData/AppData.php(157): OC\Files\AppData\AppData->getAppDataFolder()
#2 /snap/nextcloud/22408/htdocs/apps/text/lib/Service/DocumentService.php(114): OC\Files\AppData\AppData->newFolder(‘documents’)
#3 [internal function]: OCA\Text\Service\DocumentService->__construct(Object(OCA\Text\Db\DocumentMapper), Object(OCA\Text\Db\StepMapper), Object(OC\Files\AppData\AppData), NULL, Object(OC\Files\Node\LazyRoot), Object(OC\Memcache\Factory), Object(OC\AppFramework\Logger), Object(OC\Share20\Manager), Object(OC\AppFramework\Http\Request), Object(OC\DirectEditing\Manager), Object(OC\Lock\MemcacheLockingProvider))
#4 /snap/nextcloud/22408/htdocs/lib/private/AppFramework/Utility/SimpleContainer.php(84): ReflectionClass->newInstanceArgs(Array)
#5 /snap/nextcloud/22408/htdocs/lib/private/AppFramework/Utility/SimpleContainer.php(101): OC\AppFramework\Utility\SimpleContainer->buildClass(Object(ReflectionClass))
#6 /snap/nextcloud/22408/htdocs/lib/private/AppFramework/Utility/SimpleContainer.php(116): OC\AppFramework\Utility\SimpleContainer->resolve(‘OCA\Text\Servic…’)
#7 /snap/nextcloud/22408/htdocs/lib/private/AppFramework/DependencyInjection/DIContainer.php(414): OC\AppFramework\Utility\SimpleContainer->query(‘OCA\Text\Servic…’)
#8 /snap/nextcloud/22408/htdocs/lib/private/AppFramework/DependencyInjection/DIContainer.php(385): OC\AppFramework\DependencyInjection\DIContainer->queryNoFallback(‘OCA\Text\Servic…’)
#9 /snap/nextcloud/22408/htdocs/lib/private/AppFramework/Utility/SimpleContainer.php(71): OC\AppFramework\DependencyInjection\DIContainer->query(‘OCA\Text\Servic…’, true)
#10 /snap/nextcloud/22408/htdocs/lib/private/AppFramework/Utility/SimpleContainer.php(101): OC\AppFramework\Utility\SimpleContainer->buildClass(Object(ReflectionClass))
#11 /snap/nextcloud/22408/htdocs/lib/private/AppFramework/Utility/SimpleContainer.php(116): OC\AppFramework\Utility\SimpleContainer->resolve(‘OCA\Text\Comman…’)
#12 /snap/nextcloud/22408/htdocs/lib/private/AppFramework/DependencyInjection/DIContainer.php(414): OC\AppFramework\Utility\SimpleContainer->query(‘OCA\Text\Comman…’)
#13 /snap/nextcloud/22408/htdocs/lib/private/ServerContainer.php(133): OC\AppFramework\DependencyInjection\DIContainer->queryNoFallback(‘OCA\Text\Comman…’)
#14 /snap/nextcloud/22408/htdocs/lib/private/Console/Application.php(221): OC\ServerContainer->query(‘OCA\Text\Comman…’)
#15 /snap/nextcloud/22408/htdocs/lib/private/Console/Application.php(136): OC\Console\Application->loadCommandsFromInfoXml(Array)
#16 /snap/nextcloud/22408/htdocs/console.php(99): OC\Console\Application->loadCommands(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#17 /snap/nextcloud/22408/htdocs/occ(11): require_once(’/snap/nextcloud…’)

Glad to know I’m not the only one with this problem. I did do a fresh install and tried it again. I got the web interface to work for a bit by changing the new directory name to something other that data (data1, in my case) but it still didn’t write to the new directory. I started getting errors when i tried accessing files. There’s something seriously wrong with the way we have to move the data dir.

I think your problem is permissions. I a not snap savy nor a fan of it, as it pulls in an extra layer of complexity. Usually i suggest to install ncp via curl installer instead.

# curl -sSL https://raw.githubusercontent.com/nextcloud/nextcloudpi/master/install.sh | bash

If for some reason u still need snap, you have to give the snap www-data user r/w access to the new data directory, but you have to find out how to do it on your own.

Hi FadeFx and @Andre_D,

Im going to migrate away from the snap install. Its def been a headache, but I need to fix this install to migrate the data properly.

Looks like theres something wrong with attempting what you mentioned. Clean install of snap never created the “www-data” user, tried changing permissions then realized:
root@drive:/mnt/usb1# groups
root@drive:/mnt/usb1# id
uid=0(root) gid=0(root) groups=0(root)

So it appears to be stuck, any ideas on how to get to migration?

@Andre_D I’ve gotten farther!

Looks like my issue was the original settings on the mounted USB drive.
Basically, the settings were only for root on the drive, using this guide to unmount, change /etc/fstab then reboot and check mounted with correct permissions df.

Once done, simply rebooting snap I get back to login. “sudo snap restart nextcloud”

Im getting a different error now, but its closer at least.