Nextcloud not working after changing directory

Hey,
i just installed Ubuntu server and Nextcloud via the integrated installer in Ubuntu.
I couldnt choose the directory for the data so i needed to change it after installation since my OS is on a drive and the data should go to a RAID.
After i mounted the raid i copyed everything from the data folder over to my new data folder (/data) and changed the path in the config.
Then i deactivated maintenance mode and got the error that the .ocdata file was not found. I checked the new directory and it was there.
(/data/.ocdata)

I already tried touch .ocdata and chmod 644 .ocdata in the directory, but it didnt work.
Any help is appreciated!

Hi @Itanium

If you have installed Nextcloud via Ubuntu Installer, you are using the Snap package: GitHub - nextcloud-snap/nextcloud-snap: ☁️📦 Nextcloud packaged as a snap

https://github.com/nextcloud-snap/nextcloud-snap/wiki/Change-data-directory-to-use-another-disk-partition

oh, sry. i should have added that i followed that howto

so i need to undo what i did in the other HowTo and then follow this or can i just follow this HowTo.
(or would be a complete fresh install be better)

If you just installed it and don’t have any data on it, I would uninstall it…

sudo snap remove --purge nextcloud

…and then reinstall it:

sudo snap install nextcloud 

After that you can follow the instructions here: Change data directory to use another disk partition · nextcloud-snap/nextcloud-snap Wiki · GitHub

i tried that but now i get the error that nextcloud can not find the directory /data or cant write in it
the path to the dir is just /data, maybe i did something wrong in the config.

'directory' => '/data'

The first section of the instructions says:

The partition you want to use must be mounted somewhere in /media/ or /mnt/. These are the only locations the snap can access under confinement with the removable-media plug. Connect the removable-media plug as mentioned in the README in order to grant the snap permission to access external drives.

oh, sry i missed that

i moved the mount to /media/data and updated the path in the config but i still get the same error
typo.
It now finds the folder, thx a lot
but i ran into another error, so i am back to googling
(i just get

{"reqId":"fgA5rSOsLISg5isoDz3a","level":3,"time":"2023-12-02T17:12:45+00:00","remoteAddr":"192.168.0.107","user":"--","app":"core","method":"GET","url":"/index.php/login","message":"Could not get appdata folder","userAgent":"Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:120.0) Gecko/20100101 Firefox/120.0","version":"27.1.3.2","exception":{"Exception":"RuntimeException","Message":"Could not get appdata folder","Code":0,"Trace":[{"file":"/snap/nextcloud/38457/htdocs/lib/private/Files/AppData/AppData.php","line":100,"function":"getAppDataRootFolder","class":"OC\\Files\\AppData\\AppData","type":"->"},{"file":"/snap/nextcloud/38457/htdocs/lib/private/Files/AppData/AppData.php","line":147,"function":"getAppDataFolder","class":"OC\\Files\\AppData\\AppData","type":"->"},{"file":"/snap/nextcloud/38457/htdocs/lib/private/Template/JSCombiner.php","line":90,"function":"newFolder","class":"OC\\Files\\AppData\\AppData","type":"->"},{"file":"/snap/nextcloud/38457/htdocs/lib/private/Template/JSResourceLocator.php","line":145,"function":"process","class":"OC\\Template\\JSCombiner","type":"->"},{"file":"/snap/nextcloud/38457/htdocs/lib/private/Template/JSResourceLocator.php","line":75,"function":"cacheAndAppendCombineJsonIfExist","class":"OC\\Template\\JSResourceLocator","type":"->"},{"file":"/snap/nextcloud/38457/htdocs/lib/private/Template/ResourceLocator.php","line":73,"function":"doFind","class":"OC\\Template\\JSResourceLocator","type":"->"},{"file":"/snap/nextcloud/38457/htdocs/lib/private/TemplateLayout.php","line":377,"function":"find","class":"OC\\Template\\ResourceLocator","type":"->"},{"file":"/snap/nextcloud/38457/htdocs/lib/private/TemplateLayout.php","line":222,"function":"findJavascriptFiles","class":"OC\\TemplateLayout","type":"::"},{"file":"/snap/nextcloud/38457/htdocs/lib/private/legacy/OC_Template.php","line":182,"function":"__construct","class":"OC\\TemplateLayout","type":"->"},{"file":"/snap/nextcloud/38457/htdocs/lib/private/Template/Base.php","line":132,"function":"fetchPage","class":"OC_Template","type":"->"},{"file":"/snap/nextcloud/38457/htdocs/lib/private/legacy/OC_Template.php","line":331,"function":"printPage","class":"OC\\Template\\Base","type":"->"},{"file":"/snap/nextcloud/38457/htdocs/index.php","line":74,"function":"printExceptionErrorPage","class":"OC_Template","type":"::"}],"File":"/snap/nextcloud/38457/htdocs/lib/private/Files/AppData/AppData.php","Line":84,"CustomMessage":"--"}}

but there is no log in the data folder ended in another folder then the default)
i already made sure that www-data:www-data has access to the nextcloud folder
sometimes i get the 503 service unavailable error after refreshing a few times