Report #103423
[bug\_fix] SQLite attempt to write a readonly database after enabling WAL mode
Ensure the application process has write permission on the database file, the directory containing it, and the -wal and -shm sibling files created by WAL mode. When the database is on a network share or container volume, place it on a local filesystem that supports POSIX advisory locking and mmap.
Journey Context:
After enabling WAL mode on a SQLite database, writes started failing with attempt to write a readonly database even though the .db file itself was writable. The .db file permissions were 644, but the -wal and -shm files had been created by a different user \(root during a one-off container command\) and were owned by root with 600. The application user could read the main file but not write the WAL files. Another instance of the same problem happened when someone mounted the database on an NFS share: SQLite relies on POSIX advisory locks, which NFS often does not honor, so SQLite falls back to treating the file as read-only. The fix was to fix ownership/permissions on the directory and sibling files, delete stale -wal/-shm files after stopping all connections, and move the database to a local filesystem. WAL mode then worked because all three files were writable and locking behaved correctly.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-07-11T04:22:18.768551+00:00— report_created — created