Nextcloud stuck in maintenance mode

Hello.

I have been using Nextcloud for some time now, but i recently made some changes that have put my nextcloud snap in permanent maintenance mode.

When nextcloud was running i had 2 fused drives located at /mnt/cloud and everything was working great, then i started getting random demounts so i changed to mergerfs, the fuse works great and is still /mnt/cloud.

But now i cant get nextcloud out of maintenance mode, i have checked Config.php and maintenance mode is set to False. Data directory is still the same.It has been updated, and restarted. But still in maintenance mode.

when i run:
/mnt/cloud/data$ sudo nextcloud.occ maintenance:mode --off

I get this response:

Nextcloud or one of the apps require upgrade - only a limited number of commands are available
You may use your browser or the occ upgrade command to do the upgrade
Your data directory is not writable
Permissions can usually be fixed by giving the webserver write access to the root directory. See https://docs.nextcloud.com/server/20/go.php?to=admin-dir_permissions.

An unhandled exception has been thrown:
Exception: Environment not properly prepared. in /snap/nextcloud/25276/htdocs/lib/private/Console/Application.php:168
Stack trace:
#0 /snap/nextcloud/25276/htdocs/console.php(99): OC\Console\Application->loadCommands(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#1 /snap/nextcloud/25276/htdocs/occ(11): require_once('/snap/nextcloud...')
#2 {main}bro@prometheus:/mnt/cloud/data$

Any one have an idea what is going wrong here ?

Please let me know if you need something more from me, im quite new at this and have tried looking up the issue, but cant seem to figure it out.

for me this has happened after updating. seems I am as lost as you were. If i figure it out I will reply in case it can help anyone.