Can't restore Nextcloud

My YunoHost server

Hardware: VPS bought online
YunoHost version: 11.1.20
I have access to my server : Through SSH & through the webadmin
Are you in a special context or did you perform some particular tweaking on your YunoHost instance ? : yes
If yes, please explain: The ssh connection port has been changed to 6789

Description of my issue

Hello all!

I just restored my Yunohost server after moving to another provider. All seems well, except I cannot restore Nextcloud.

Trace file:

I don’t know what to search for in this file…

Thanks a lot!

2023-06-10 17:46:46,042: DEBUG - + find /var/www/nextcloud/ -type d -print0
2023-06-10 17:46:46,043: DEBUG - + xargs -0 chmod 0755
2023-06-10 17:46:46,193: DEBUG - + find /home/ -type f -print0
2023-06-10 17:46:46,194: DEBUG - + xargs -0 chmod 0640
2023-06-10 17:46:46,201: WARNING - chmod: missing operand after ‘0640’
2023-06-10 17:46:46,204: WARNING - Try ‘chmod --help’ for more information.

That’s very strange :thinking:

Sounds like a stupid edge case where the xargs command fails because the find command doesn’t find any file …

Let’s try to run sudo touch /home/ to create a dummy file “foobar”

Will open a PR to fix the issue


Thanks for the suggestion, @Aleks . It changed things:

  • it seems that the users folders have been created
  • but “touch: cannot touch ‘/home/’: No such file or directory”


Do I create the data folder and try again?

EDIT: I created it, and the restore finished. I had to create a .ocdata file in data. But it’s not good, I think, because I can’t sync (the client receives 403-errors). It seems it was not the thing to do…

Hmmm maybe just a permission issue to fix … Did you create it after the upgrade was completed ?

No, I created (with mkdir) the folder, then launched the restore again. And then the Nextcloud web interface was here, and complained of the absence of .ocdata file.

Note: I did not include the files in my Nextcloud backup, and intended to synchronize them all. I hope it’s not the cause of the problem…

I think the restoration is not complete. I typed the command sudo -u www-data php8.0 occ files:scan-app-data, to see if it could force a rescan. But I received

An unhandled exception has been thrown:
Doctrine\DBAL\Exception: Failed to connect to the database: An exception occurred in the driver: could not find driver in /var/www/nextcloud/lib/private/DB/Connection.php:140

So I wonder what happened. Maybe I could remove Nextcloud and recreate from scratch, but I have calendars too in Nextcloud, and I don’t know where they’re stored and do not want to lose them.

(same result with sudo -u nextcloud php8.0 occ files:scan-app-data)

Sooo if i understand correctly you created the .ocdata after the upgrade was complete (not trying to point it as the cause, just trying to understand)

Anyway if you created it manually, then this may just be a permission issue and we need to find out what’s the proper permission for this file and compare it to the current permission … so let’s check ls -l .ocdata (from whichever place this file actually is in)

-rw-r–r-- 1 nextcloud nextcloud 0 Jun 11 13:50 .ocdata

I created this file after the restore was done, yes (and I think I chowned it just after its creation). It’s here:


On my old VPS, the permissions are the same - well a bit more restrictive:

-rw-r----- 1 nextcloud nextcloud 0 Jun 2 10:53 .ocdata

Hello again! @Aleks did you see my last message? Do you have an idea?

Maybe I should just uninstall and start from scratch, without a restore… What do you think?

I would say try fixing the permissions with chmod o-rwx .ocdata

Done. Same errors…

Here is a screenshot of the client:

  • there are multiple “403 Forbidden on PUT”
  • there are also some “500 Internal Server Error on PUT”

In nextcloud.log:

{“reqId”:“4BlsQh5C6vP2MBxfXjqm”,“level”:3,“time”:“2023-06-19T15:37:31+00:00”,“remoteAddr”:“2a01:e0a:3cc:f370:279d:d5d8:2aa8:e9bc”,“user”:“lara”,“app”:“PHP”,“method”:“PUT”,“url”:“/nextcloud/remote.php/dav/files/lara/4.%20Journal/2023/2023-06/”,“message”:“file_put_contents(/home/ Journal/2023/2023-06/ Failed to open stream: Permission denied at /var/www/nextcloud/lib/private/Files/Storage/Local.php#313”,“userAgent”:“Mozilla/5.0 (Linux) mirall/3.9.0-20230616.170352.c6c6c61f5-1.0~jammy1 (Nextcloud, linuxmint-5.15.0-75-generic ClientArchitecture: x86_64 OsArchitecture: x86_64)”,“version”:“”,“data”:{“app”:“PHP”}}

(I think it’s the 403 errors: permission denied)

{“reqId”:“iKr8hb6UEbkTL4DfY1iz”,“level”:3,“time”:“2023-06-19T15:37:31+00:00”,“remoteAddr”:“2a01:e0a:3cc:f370:279d:d5d8:2aa8:e9bc”,“user”:“lara”,“app”:“webdav”,“method”:“PUT”,“url”:“/nextcloud/remote.php/dav/files/lara/4.%20Journal/2023/”,“message”:“Erreur en copiant le fichier \u00e0 destination (copi\u00e9 : -1 octet, taille du fichier attendue : 860 octets)”,“userAgent”:“Mozilla/5.0 (Linux) mirall/3.9.0-20230616.170352.c6c6c61f5-1.0~jammy1 (Nextcloud, linuxmint-5.15.0-75-generic ClientArchitecture: x86_64 OsArchitecture: x86_64)”,“version”:“”,“exception”:{“Exception”:“Sabre\DAV\Exception”,“Message”:“Erreur en copiant le fichier \u00e0 destination (copi\u00e9 : -1 octet, taille du fichier attendue : 860 octets)”,“Code”:0,“Trace”:[{“file”:“/var/www/nextcloud/3rdparty/sabre/dav/lib/DAV/Server.php”,“line”:1137,“function”:“put”,“class”:“OCA\DAV\Connector\Sabre\File”,“type”:“->”},{“file”:“/var/www/nextcloud/3rdparty/sabre/dav/lib/DAV/CorePlugin.php”,“line”:492,“function”:“updateFile”,“class”:“Sabre\DAV\Server”,“type”:“->”,“args”:[“*** sensitive parameters replaced ***”]},{“file”:“/var/www/nextcloud/3rdparty/sabre/event/lib/WildcardEmitterTrait.php”,“line”:89,“function”:“httpPut”,“class”:“Sabre\DAV\CorePlugin”,“type”:“->”},{“file”:“/var/www/nextcloud/3rdparty/sabre/dav/lib/DAV/Server.php”,“line”:472,“function”:“emit”,“class”:“Sabre\DAV\Server”,“type”:“->”},{“file”:“/var/www/nextcloud/3rdparty/sabre/dav/lib/DAV/Server.php”,“line”:253,“function”:“invokeMethod”,“class”:“Sabre\DAV\Server”,“type”:“->”},{“file”:“/var/www/nextcloud/3rdparty/sabre/dav/lib/DAV/Server.php”,“line”:321,“function”:“start”,“class”:“Sabre\DAV\Server”,“type”:“->”},{“file”:“/var/www/nextcloud/apps/dav/lib/Server.php”,“line”:366,“function”:“exec”,“class”:“Sabre\DAV\Server”,“type”:“->”},{“file”:“/var/www/nextcloud/apps/dav/appinfo/v2/remote.php”,“line”:35,“function”:“exec”,“class”:“OCA\DAV\Server”,“type”:“->”},{“file”:“/var/www/nextcloud/remote.php”,“line”:172,“args”:[“/var/www/nextcloud/apps/dav/appinfo/v2/remote.php”],“function”:“require_once”}],“File”:“/var/www/nextcloud/apps/dav/lib/Connector/Sabre/File.php”,“Line”:279,“message”:“Erreur en copiant le fichier \u00e0 destination (copi\u00e9 : -1 octet, taille du fichier attendue : 860 octets)”,“exception”:{},“CustomMessage”:“Erreur en copiant le fichier \u00e0 destination (copi\u00e9 : -1 octet, taille du fichier attendue : 860 octets)”}}

This file ( weights indeed 860 bytes. I don’t know if it’s the same issue.

I am a boiled noodle.

When I saw that Nextcloud would not sync, I uploaded via SFTP my files (after the rescan, I think). And they were still owned by root. chown -R nextcloud:nextcloud . in the /home/<my_user>/files`, and tada.

I really don’t know why there was an error in the begining, before I sent the files via SFTP, though.

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.