Error: Could not upgrade from version 1 to version 2: PUT .sync/readme.txt: Unknown error 2

Joplin 1.0.245 on macOS 10.15.6 and Windows 10 20H2 19042.508
Nextcloud 19.0.2 on ubuntu server (Joplin Web API 0.0.25)
all at the same hour.

I have been stuck for 1 week with this error.

I decided to start from scratch:
-delete config/joplin-desktop folder
-delete all in my .Joplin folder on Nextcloud
-re-config the nextcloud sync

and always the same error:

2020-09-10 09:33:14: “Profile directory: /Users/bruno/.config/joplin-desktop”
2020-09-10 09:33:14: “KeychainService: checking if keychain supported”
2020-09-10 09:33:14: “KeychainService: tried to set and get password. Result was:”, “mytest”
2020-09-10 09:33:14: “Client ID: c836cbbc58024142b369b9ef522e2485”
2020-09-10 09:33:14: “First start: detected locale as en_GB”
2020-09-10 09:33:14: “Trying to load 0 master keys…”
2020-09-10 09:33:14: “Loaded master keys: 0”
2020-09-10 09:33:14: “ResourceFetcher: Auto-add resources: Mode: always”
2020-09-10 09:33:14: “ResourceFetcher: Auto-added resources: 0”
2020-09-10 09:33:14: “Running migration: 20”
2020-09-10 09:33:14: “Running migration: 27”
2020-09-10 09:33:14: “Running migration: 33”
2020-09-10 09:33:14: “SearchEngine: Updating FTS table…”
2020-09-10 09:33:14: “Trying to load 0 master keys…”
2020-09-10 09:33:14: “Loaded master keys: 0”
2020-09-10 09:33:14: “Trying to load 0 master keys…”
2020-09-10 09:33:14: “Loaded master keys: 0”
2020-09-10 09:33:14: “Trying to load 0 master keys…”
2020-09-10 09:33:14: “Loaded master keys: 0”
2020-09-10 09:33:14: “app.start: doing regular boot”
2020-09-10 09:33:14: “Trying to load 0 master keys…”
2020-09-10 09:33:14: “Loaded master keys: 0”
2020-09-10 09:33:14: “Trying to load 0 master keys…”
2020-09-10 09:33:14: “Loaded master keys: 0”
2020-09-10 09:33:14: “Trying to load 0 master keys…”
2020-09-10 09:33:14: “Loaded master keys: 0”
2020-09-10 09:33:14: “RevisionService::runInBackground: Starting background service with revision collection interval 600000”
2020-09-10 09:33:15: “DecryptionWorker: cannot start because no master key is currently loaded.”
2020-09-10 09:33:18: “RevisionService::maintenance: Starting…”
2020-09-10 09:33:18: “RevisionService::maintenance: Service is enabled”
2020-09-10 09:33:18: “RevisionService::collectRevisions: Created revisions for 0 notes”
2020-09-10 09:33:18: “RevisionService::maintenance: Done in 117ms”
2020-09-10 09:33:24: “SearchEngine: Updating FTS table…”
2020-09-10 09:33:24: “SearchEngine: Updated FTS table in 40ms. Inserted: 5. Deleted: 0”
2020-09-10 09:33:44: “ResourceService::indexNoteResources: Start”
2020-09-10 09:33:45: “ResourceService::indexNoteResources: Completed”
2020-09-10 09:33:45: “ResourceService::deleteOrphanResources:”, “[]”
2020-09-10 09:33:45: “Preparing scheduled sync”
2020-09-10 09:33:45: “Saving updated Dropbox auth.”
2020-09-10 09:33:45: “Synchroniser is missing credentials - manual sync required to authenticate.”
2020-09-10 09:34:31: “Preparing scheduled sync”
2020-09-10 09:34:31: “Starting scheduled sync”
2020-09-10 09:34:31: “Sync target info:”, “{“version”:0}”
2020-09-10 09:34:31: “Sync target is new - setting it up…”
2020-09-10 09:34:32: “MigrationHandler: Sync target version is 0 or 1 - creating “locks” directory:”, “{“version”:0}”
2020-09-10 09:34:33: “MigrationHandler: Acquiring exclusive lock”
2020-09-10 09:34:34: “Could not retrieve remote date - defaulting to device date:”, “Error: Temp dir not set!
Error: Temp dir not set!
at FileApi.tempDirName (/Applications/Joplin.app/Contents/Resources/app.asar/lib/file-api.js:144:41)
at FileApi.fetchRemoteDateOffset_ (/Applications/Joplin.app/Contents/Resources/app.asar/lib/file-api.js:68:28)
at FileApi.remoteDate (/Applications/Joplin.app/Contents/Resources/app.asar/lib/file-api.js:105:42)”
2020-09-10 09:34:36: “MigrationHandler: Acquired exclusive lock:”, “{“type”:“exclusive”,“clientType”:“desktop”,“clientId”:“c836cbbc58024142b369b9ef522e2485”,“updatedTime”:1599723274000}”
2020-09-10 09:34:36: “MigrationHandler: Migrating from version 0 to version 1”
2020-09-10 09:34:38: “MigrationHandler: Done migrating from version 0 to version 1”
2020-09-10 09:34:38: “MigrationHandler: Migrating from version 1 to version 2”
2020-09-10 09:34:59: “MigrationHandler: Releasing exclusive lock”
2020-09-10 09:35:00: "Error: Could not upgrade from version 1 to version 2: PUT .sync/readme.txt: Unknown error 2 (403):
403 Forbidden

403 Forbidden



nginx

Code: 403
Error: Could not upgrade from version 1 to version 2: PUT .sync/readme.txt: Unknown error 2 (403): <html>
<head><title>403 Forbidden</title></head>
<body>
<center><h1>403 Forbidden</h1></center>
<hr><center>nginx</center>
</body>
</html>

    at newError (/Applications/Joplin.app/Contents/Resources/app.asar/lib/WebDavApi.js:399:11)
    at WebDavApi.exec (/Applications/Joplin.app/Contents/Resources/app.asar/lib/WebDavApi.js:429:10)"
2020-09-10 09:35:00: "Req 09:34:37: MKCOL https://xxxxxx.fr/nextcloud/remote.php/webdav/.Joplin/.lock/ {"headers":{"Authorization":"********","If-None-Match":"JoplinIgnore-211","User-Agent":"Joplin/1.0"},"timeout":120000,"maxRetry":0}"
2020-09-10 09:35:00: "Res 09:34:37: "
2020-09-10 09:35:00: "Req 09:34:37: PUT https://xxxxxx.fr/nextcloud/remote.php/webdav/.Joplin/.sync/version.txt {"headers":{"Authorization":"********","If-None-Match":"JoplinIgnore-33544","User-Agent":"Joplin/1.0","Content-Length":"1"},"body":"1","timeout":120000,"maxRetry":0}"
2020-09-10 09:35:00: "Res 09:34:37: "
2020-09-10 09:35:00: "Req 09:34:38: PUT https://xxxxxx.fr/nextcloud/remote.php/webdav/.Joplin/info.json {"headers":{"Authorization":"********","If-None-Match":"JoplinIgnore-78431","User-Agent":"Joplin/1.0","Content-Length":"13"},"body":"{\"version\":1}","timeout":120000,"maxRetry":0}"
2020-09-10 09:35:00: "Res 09:34:38: "
2020-09-10 09:35:00: "Req 09:34:38: PUT https://xxxxxx.fr/nextcloud/remote.php/webdav/.Joplin/.sync/readme.txt {"headers":{"Authorization":"********","If-None-Match":"JoplinIgnore-5956","User-Agent":"Joplin/1.0","Content-Length":"482"},"body":"2020-07-16: In the new sync format, the version number is stored in /info.json. However, for backward compatibility, we need to keep the old version.txt file here, otherwise old clients will automatically recreate it, and assume a sync target version 1. So we keep it here but set its value to \"2\", so that old clients know that they need to be upgraded. This directory can be removed after a year or so, once we are confident that all clients have been upgraded to recent versions.","timeout":120000,"maxRetry":0}"
2020-09-10 09:35:00: "Res 09:34:38: <html>
<head><title>403 Forbidden</title></head>
<body>
<center><h1>403 Forbidden</h1></center>
<hr><center>nginx</center>
</body>
</html>
"
2020-09-10 09:35:00: "Req 09:34:38: MKCOL https://xxxxxx.fr/nextcloud/remote.php/webdav/.Joplin/locks/ {"headers":{"Authorization":"********","If-None-Match":"JoplinIgnore-76425","User-Agent":"Joplin/1.0"},"timeout":120000,"maxRetry":0}"
2020-09-10 09:35:00: "Res 09:34:38: <?xml version="1.0" encoding="utf-8"?>
<d:error xmlns:d="DAV:" xmlns:s="http://sabredav.org/ns">
  <s:exception>Sabre\DAV\Exception\MethodNotAllowed</s:exception>
  <s:message>The resource you tried to create already exists</s:message>
</d:error>
"
2020-09-10 09:35:00: "Req 09:34:39: MKCOL https://xxxxxx.fr/nextcloud/remote.php/webdav/.Joplin/temp/ {"headers":{"Authorization":"********","If-None-Match":"JoplinIgnore-22864","User-Agent":"Joplin/1.0"},"timeout":120000,"maxRetry":0}"
2020-09-10 09:35:00: "Res 09:34:39: "
2020-09-10 09:35:00: "Req 09:34:39: PUT https://xxxxxx.fr/nextcloud/remote.php/webdav/.Joplin/.sync/version.txt {"headers":{"Authorization":"********","If-None-Match":"JoplinIgnore-56137","User-Agent":"Joplin/1.0","Content-Length":"1"},"body":"2","timeout":120000,"maxRetry":0}"
2020-09-10 09:35:00: "Res 09:34:39: "
2020-09-10 09:35:00: "Req 09:34:42: PUT https://xxxxxx.fr/nextcloud/remote.php/webdav/.Joplin/.sync/readme.txt {"headers":{"Authorization":"********","If-None-Match":"JoplinIgnore-48198","User-Agent":"Joplin/1.0","Content-Length":"482"},"body":"2020-07-16: In the new sync format, the version number is stored in /info.json. However, for backward compatibility, we need to keep the old version.txt file here, otherwise old clients will automatically recreate it, and assume a sync target version 1. So we keep it here but set its value to \"2\", so that old clients know that they need to be upgraded. This directory can be removed after a year or so, once we are confident that all clients have been upgraded to recent versions.","timeout":120000,"maxRetry":0}"
2020-09-10 09:35:00: "Res 09:34:42: <html>
<head><title>403 Forbidden</title></head>
<body>
<center><h1>403 Forbidden</h1></center>
<hr><center>nginx</center>
</body>
</html>
"
2020-09-10 09:35:00: "Req 09:34:49: PUT https://xxxxxx.fr/nextcloud/remote.php/webdav/.Joplin/.sync/readme.txt {"headers":{"Authorization":"********","If-None-Match":"JoplinIgnore-47533","User-Agent":"Joplin/1.0","Content-Length":"482"},"body":"2020-07-16: In the new sync format, the version number is stored in /info.json. However, for backward compatibility, we need to keep the old version.txt file here, otherwise old clients will automatically recreate it, and assume a sync target version 1. So we keep it here but set its value to \"2\", so that old clients know that they need to be upgraded. This directory can be removed after a year or so, once we are confident that all clients have been upgraded to recent versions.","timeout":120000,"maxRetry":0}"
2020-09-10 09:35:00: "Res 09:34:49: <html>
<head><title>403 Forbidden</title></head>
<body>
<center><h1>403 Forbidden</h1></center>
<hr><center>nginx</center>
</body>
</html>
"
2020-09-10 09:35:00: "Req 09:34:59: PUT https://xxxxxx.fr/nextcloud/remote.php/webdav/.Joplin/.sync/readme.txt {"headers":{"Authorization":"********","If-None-Match":"JoplinIgnore-92216","User-Agent":"Joplin/1.0","Content-Length":"482"},"body":"2020-07-16: In the new sync format, the version number is stored in /info.json. However, for backward compatibility, we need to keep the old version.txt file here, otherwise old clients will automatically recreate it, and assume a sync target version 1. So we keep it here but set its value to \"2\", so that old clients know that they need to be upgraded. This directory can be removed after a year or so, once we are confident that all clients have been upgraded to recent versions.","timeout":120000,"maxRetry":0}"
2020-09-10 09:35:00: "Res 09:34:59: <html>
<head><title>403 Forbidden</title></head>
<body>
<center><h1>403 Forbidden</h1></center>
<hr><center>nginx</center>
</body>
</html>
"
2020-09-10 09:35:00: "Req 09:35:00: DELETE https://xxxxxx.fr/nextcloud/remote.php/webdav/.Joplin/locks/exclusive_desktop_c836cbbc58024142b369b9ef522e2485.json {"headers":{"Authorization":"********","If-None-Match":"JoplinIgnore-29040","User-Agent":"Joplin/1.0"},"timeout":120000,"maxRetry":0}"
2020-09-10 09:35:00: "Res 09:35:00: "
2020-09-10 09:35:00: "Operations completed: "
2020-09-10 09:35:00: "Total folders: 1"
2020-09-10 09:35:00: "Total notes: 5"
2020-09-10 09:35:00: "Total resources: 3"
2020-09-10 09:35:00: "There was some errors:"
2020-09-10 09:35:00: "Error: Could not upgrade from version 1 to version 2: PUT .sync/readme.txt: Unknown error 2 (403): <html>
<head><title>403 Forbidden</title></head>
<body>
<center><h1>403 Forbidden</h1></center>
<hr><center>nginx</center>
</body>
</html>

Code: 403
Error: Could not upgrade from version 1 to version 2: PUT .sync/readme.txt: Unknown error 2 (403): <html>
<head><title>403 Forbidden</title></head>
<body>
<center><h1>403 Forbidden</h1></center>
<hr><center>nginx</center>
</body>
</html>

    at newError (/Applications/Joplin.app/Contents/Resources/app.asar/lib/WebDavApi.js:399:11)
    at WebDavApi.exec (/Applications/Joplin.app/Contents/Resources/app.asar/lib/WebDavApi.js:429:10)"
2020-09-10 09:35:01: "DecryptionWorker: cannot start because no master key is currently loaded."

This seems to be a permission error:

2020-09-10 09:35:00: "Req 09:34:49: PUT https://xxxxxx.fr/nextcloud/remote.php/webdav/.Joplin/.sync/readme.txt {"headers":{"Authorization":"********","If-None-Match":"JoplinIgnore-47533","User-Agent":"Joplin/1.0","Content-Length":"482"},"body":.........
2020-09-10 09:35:00: "Res 09:34:49: <html>
<head><title>403 Forbidden</title></head>
<body>
<center><h1>403 Forbidden</h1></center>
<hr><center>nginx</center>
</body>
</html>

So you might want to check why it’s not allowed to write to file .Joplin/.sync/readme.txt

Permissions seems corrects:

bruno@localhost:~/.nextcloud/data/9d67e72f9807/bruno/files$ cd .Joplin/
total 32
drwxr-xr-x 7 bruno psacln 4096 sept. 10 09:34 .
drwxr-xr-x 6 bruno psacln 4096 sept.  7 15:46 ..
-rw-r--r-- 1 bruno psacln   13 sept. 10 09:34 info.json
drwxr-xr-x 2 bruno psacln 4096 sept. 10 09:34 .lock
drwxr-xr-x 2 bruno psacln 4096 sept. 10 09:47 locks
drwxr-xr-x 2 bruno psacln 4096 sept. 10 09:34 .resource
drwxr-xr-x 2 bruno psacln 4096 sept. 10 09:34 .sync
drwxr-xr-x 2 bruno psacln 4096 sept. 10 09:34 temp
bruno@localhost:~/.nextcloud/data/9d67e72f9807/bruno/files/.Joplin$ cd .sync/
total 12
drwxr-xr-x 2 bruno psacln 4096 sept. 10 09:34 .
drwxr-xr-x 7 bruno psacln 4096 sept. 10 09:34 ..
-rw-r--r-- 1 bruno psacln    1 sept. 10 09:47 version.txt

Seems a Nextcloud problem with my config: it could not synchronise a readme.txt file (ok for readme2.txt)

Finally, it was due to a nginx/apache rule in Plesk Wordpress Toolkit to protect Wordpress.

Now nextcloud synchro work fine.

More here

1 Like