How to avoid 'Access denied' EACCES errors with Proton Drive (& others?)

(Edit:) Ah, hubris. I thought I’d found a solution to this, but it’s unfortunately an ongoing issue with Proton Drive, not unique to Obsidian. I’ve edited the thread to reflect that and moved it to “Help”.

Nothing I’ve found prevents the problem, if I find something I’ll reply in this thread.

What does help is setting the vault folder to Download a local copy, and then as soon as the error pops up, I remove the local download of the affected folder/file, and then reenable the local download, all through the right click menu. That refreshes the file, and reverts the stuck permission to read/write.

I imagine it remains good practice to set your cloud based files to always download a local copy: Windows :: MacOS.

Background: I’ve had sporadic frustrating ‘EACCES’ ‘permission denied’ errors over 6 months, due to note files getting read-only file permissions. I had moved a vault into Proton Drive, and I used their cloud app on MacOS to access it through Obsidian which I think caused the problem. Searching here, discord and reddit, I found people with similar problems, but I didn’t find a solution that worked for me searching keywords above

I’m posting this here to hopefully to join the dots for anyone else having similar problems.
(Edit: feel free to propose solutions)

  1. Obsidian is “local first” - when accessing a cloud-based vault it can cause problems if the whole vault is not stored locally.

Obsidian’s bug listing troubleshooting message says to update Obsidian and ensure all files are local:

If you are using a third-party sync system, like iCloud or OneDrive, you need make sure that they are configured so that they keep a complete local copy of your vault.

  1. Proton Drive’s app on MacOS and Windows defaults to save storage space on the local drive by only downloading files as the user accesses them. Files that are not local have a little cloud icon to indicate this.

The solution (edit: it’s not) seems to be to set the vault folder to download:

  • Windows - right-click > “Always keep on this device”
  • MacOS - right-click > “Download”
    Their docs say these files will remain downloaded, but still sync changes with the cloud. I’ve not been trying this long enough to see if that persists with Drive app updates, or if the container is refreshed.

Other cloud services (I’ve seen iCloud, Nextcloud, OneDrive) mentioned have similar settings.

See: Sync your notes across devices - Obsidian Help

1 Like

So… I thought I had cracked it, and it seems I spoke too soon. I’ve had the problem again, so I think perhaps this post should be reworded and put into the Help category!

I had seen someone suggest pausing the sync in the Proton Drive app, then resuming after edit, but I’m likely to forget that.

What worked better for me was as soon as the error comes up r-clicking the file (or any of the folders that file is within), then “Remove download”, and then “Download now” again.

I’d welcome any ideas as to why access is denied to save changes.

Sadly Proton Drive will not work with Obsidian. Proton locks each file when it is syncing so that other apps can’t write to it. This causes the error you’re experiencing. It’s nothing to do with Obsidian, it’s fully Proton’s fault.

No other cloud sync software that I know of works this way, it’s very stupid and prevents me from using Proton Drive for a lot of things.

1 Like

Ah, ok! Thank you. I had wondered if maybe because Obsidian updates files so frequently (perhaps as often as every keypress), if Proton was also checking for updates to sync as frequently, then they could end up creating some kind of conflict. But then I thought perhaps I’d missed something about Obsidian, and seems I confirmed my own bias. :sweat_smile:

Found this on Reddit:

Currently, when the app syncs a file it locks that file to ensure that other applications don’t change it while the app is uploading or downloading data. We are working on improving the experience in this regard. A current workaround for the time being would be to pause and resume the sync to unlock the files and continue your work in Obsidian.

At least they’re working on it. I wondered if they’d be able to implement some kind of cooldown so the sync only happened when the file had remained unchanged for a period, or perhaps cache the file to sync and sync that, like a snapshot. Oh well. I was hopeful.
I’ll try to move this thread to the Help section, where it might be more useful. Hopefully that doesn’t break anything!

Don’t hold your breath - I opened a support ticket with them in July 2023 regarding this issue as it affects many other highly used applications like VSCode.

If they haven’t done anything about it in a year, it’s unlikely to happen soon.

What I do is copy my vault to Proton drive on a schedule, by using rclone, xcopy, robocopy, or similar.

I was just wondering about doing something similar. Super distracting though.

Imagining their devs made some bad assumptions about the way other apps interact with files in their cloud or something. Their support page says

Opening a file with another app (for example, if you’re working on a .doc file in Microsoft Word) will prevent it from being synced.
To successfully sync a file, close all other apps where it’s open and check the sync status in the Activities tab.

I wonder if they assumed they could rely on other apps effectively controlling their sync process.

Making a local download of the vault from Proton Drive did seem to resolve some of the problems, but today it keeps removing the local files, after seconds to a few minutes.

The effect in obsidian is that all of the content I’m working on disappears!

I do find it peculiar though how sometimes the files will sync, without trouble (it seems), but then other times the file permissions for one or two files get stuck in Read only and have to manually reverted.

I’d love to know what’s causing that so sporadically.

I’ve had a response from Proton about the files undownloading themselves - fits with my experience:

In some instances, especially if your macOS device is running low on storage, the OS may automatically clear files stored locally to free up space. Unfortunately, as of now, there isn’t a functionality that ensures files remain available offline indefinitely, which might explain the situation you’ve encountered.
Our development team is actively working on implementing a feature that will prevent macOS from automatically removing these local files. …we can’t offer a specific timeframe… …know it’s a priority for us.

I looked and was surprised how little space I had (like 12GB or so). So maybe that’s the smaller issue resolved, and my workaround working again.