This is just to inform others who might encounter the same issues I had, the issue is solved.
Background
- Arch Linux
- Syncthing to share vault between Phone and Computer
Error
When attempting to run Obsidian and opening a vault it gave the error: An error occurred while loading Obsidian. Error: EACCES: permission denied, lstat '/directory/to/vault/file/
Since I assumed it was an issue with Obsidian I downloaded different versions to test, AUR package, AppImage and Snap, none worked. Figuring it was a permissions issue I tried fiddling around with that and lo and behold it worked.
Solutions
NOTICE some of the below commands can be dangerous if used wrongly, keep that in mind, and double check that you’re not accidentally bricking your system.
Local
The following assumes you don’t use Syncthing or other file sync solution/you don’t have any scripts which make new folders/notes for inside your vaults. E.g. you never make any new files(outside obsidian, I think if it’s made from within obsidian it should be fine)
You can check file permissions with:
ls -l
Change all files within the folder such that the user has read, write and execute permissions, and the group and other don’t. If you want you can have group and others have more permissions, but it’s not needed.
sudo chmod 700 -R /directory/to/vault/
Make sure that you’re the owner of all the files in the group(if you’re just in the group it’s also fine)
sudo chown -R user:user /directory/to/vault/
Sync
If you do make new files from outside Obsidian like me then you need to set it so that any new files which are made also have the right owner and permissions, otherwise whenever you change anything then you need to change permissions again, one solution is to use cron/schedule the above to run every minute, the other solution is below.
This make new files and folders automatically get group changed to your user.
sudo chmod g+s /directory/to/vault/
This make new files and folders made inside that directory have these permissions.
setfacl -dm u::rwx,g::r,o::r /directory/to/vault/
I suggest you first run the local commands and then the above two(Assuming sync is a concern), so that the old vault can be be accessed by obsidian, if you have an empty vault for sync then you can do just the above two.
This fixed it for me and now I can enter my vault as well as sync