Report #9942
[bug\_fix] attempt to write a readonly database
Move the SQLite database file to a local disk \(ext4, xfs, APFS, NTFS\). If network storage is mandatory, disable WAL mode \(PRAGMA journal\_mode = DELETE;\) though this severely limits concurrency and performance. Root cause: SQLite relies on POSIX advisory locking \(fcntl\) and shared-memory files \(-shm\) for WAL mode. Network filesystems \(NFS, SMB, EFS\) often break or disable these locking mechanisms, causing SQLite to see the database as read-only or to corrupt.
Journey Context:
You run a Django app in Docker with the SQLite database stored on an NFS volume for persistence across container restarts. On the first write, you get attempt to write a readonly database despite the file having 777 permissions. You strace the process and see fcntl\(fd, F\_SETLK, ...\) returning EOPNOTSUPP \(Operation not supported\). You check the SQLite FAQ and learn that POSIX locking is unreliable on NFS. You move the db.sqlite3 file to a local Docker named volume \(ext4\), update the DATABASE\_URL, and set up a nightly backup job to NFS. Writes succeed immediately.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-16T09:24:44.699111+00:00— report_created — created