Read only database with local+server instalation on the same machine #6695
Replies: 2 comments
-
The "attempt to write a readonly database" and EACCES errors happen because both your local and server (container) Trilium installations are trying to access the same data directory at the same time. SQLite, which Trilium uses for its database, doesn't support concurrent write access from multiple processes—this leads to file locking and permission issues, especially when one process is running inside a container with different user permissions than your local user. That's why changing the directory for one of the installations resolves the problem: each instance gets its own database and file locks, avoiding conflicts and permission errors (source). For your backup question: Trilium stores backups in a "backup" folder inside the data directory it is running from. In container/server mode, this means backups go wherever the container's data directory is mapped (e.g., Best practice is to always use separate data directories for local and server installations on the same machine to avoid these conflicts. The Docker documentation and data directory wiki have more details on configuring this. To reply, just mention @dosu. How did I do? Good | Irrelevant | Incorrect | Verbose | Hallucination | Report 🐛 | Other |
Beta Was this translation helpful? Give feedback.
-
The "readonly database" error happens because both your local and server (container) Trilium instances are trying to access the same data directory at the same time. Trilium doesn't have built-in logic to prevent this kind of conflict—if both processes point to the same directory (like For your backup question: in server/container setups, backups are always stored inside the data directory that Trilium is running from. If you mount a host directory (like Recent documentation updates clarify these behaviors, but there isn't yet a warning or automatic handling for dual local+server setups. It would be helpful to add a note to the wiki or a startup warning about this scenario (Docker install docs PR). To reply, just mention @dosu. How did I do? Good | Irrelevant | Incorrect | Verbose | Hallucination | Report 🐛 | Other |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Description
Problem
I have been using local+server installation on the same machine for a while to be able to access the notes from my phone, recently (i think after the latest update 0.97.2) whenever I want to open the notes locally it doesn't open, and when I open it from the terminal i get this error:
When I turn on the container the trilium application opens but it keeps giving a toast
attempt to write a read only database
then it throws is error:But editing the notes from the server is feasible without any error
I am using this image ghcr.io/triliumnext/trilium:v0.98.0 with Podman, I tried with Docker but it is the same problem, so I don't think it is the issue
I used this command to run the container
podman run -d -p 0.0.0.0:1234:8080 -v ~/trilium-data:/home/node/trilium-data ghcr.io/triliumnext/trilium:v0.98.0
Solution
Because the container has a storage at
~/trilium-data
I suspected that the application (local installation) is trying to access it instead of/home/rami/.local/share/trilium-data
where its actual database is, which I think it is what is happening because when I change the directory name the application opens and works witout any problems, so what i rerun the container with the new directory name to become:podman run -d -p 0.0.0.0:1234:8080 -v ~/trilium-data-server:/home/node/trilium-data ghcr.io/triliumnext/trilium:v0.98.0
and all works perfeclty
Fixes
I suggest either updating the wiki for the serve installation, or updates the Trilium app to solve the wrong directory access problem when dual installation (local + server)
Side question
When backing up the database on the server installation, the backup file is still stored in the container and not in the local storage
~/trilium-data
, shouldn't is be stored there?TriliumNext Version
0.97.2
What operating system are you using?
Ubuntu
What is your setup?
Local + server sync
Operating System Version
Ubuntu 24.04.3
Error logs
No response
Beta Was this translation helpful? Give feedback.
All reactions