About error "attempt to write a readonly database" in pioreactor.sqlite

Hello, I’ve encountered a problem recently. For some reason, the pioreactor.sqlite file can no longer be written to.

I checked the ownership and permissions of the file, and they are as follows:
-rw-rw-r-- 1 pioreactor www-data 233267200 Aug 29 02:37 pioreactor.sqlite

I also checked the permissions of the folder where this file is stored, storage, and found them to be:
drwxrws--- 12 pioreactor www-data 4096 Dec 1 13:47 storage

I found that the read_only attribute of pioreactor.sqlite is 0.

I checked the ownership of lighttpd, and the result is:
www-data 4474 0.0 0.5 3988 2816 ? Ss Nov30 0:01 /usr/sbin/lighttpd -D -f /etc/lighttpd/lighttpd.conf
pioreac+ 5283 0.0 0.3 7532 1792 pts/0 S+ 14:11 0:00 grep --color=auto lighttpd

The ownership of flask is as follows:
pioreac+ 5281 0.0 0.3 7532 1792 pts/0 S+ 14:11 0:00 grep --color=auto flask

From what I can tell, all the permissions seem normal.

  1. However, when I try to operate the reactor through the UI, none of the records can be saved, and occasionally I get the error message: “attempt to write a readonly database.”
  2. When I run commands via sqlite3, I can only insert data if I execute sudo sqlite3 pioreactor.sqlite. Otherwise, I receive the “attempt to write a readonly database” error.

I’m not sure how to resolve this issue. Could you help me?

And because of this issue, when I add another reactor to the cluster, the interface is never able to display multiple reactors.

What are the permissions on the other sqlite files, pioreactor.sqlite-shm and pioreactor.sqlite-wal, try:

ls -al .pioreactor/storage/pioreactor.sqlite*

They should all look like:

-rwxrwx--- 1 pioreactor www-data

The result is as follows::
> -rw-rw-r-- 1 pioreactor www-data 18767872 Dec 1 15:21 .pioreactor/storage/pioreactor.sqlite

-rw-r–r-- 1 pioreactor www-data 233267200 Dec 1 13:48 .pioreactor/storage/pioreactor.sqlite.bakup
-rw-r–r-- 1 pioreactor www-data 32768 Dec 1 15:37 .pioreactor/storage/pioreactor.sqlite-shm
-rw-r–r-- 1 pioreactor www-data 98912 Dec 1 15:37 .pioreactor/storage/pioreactor.sqlite-wal

So I’m not too sure how it happened, but the problem is likely there with the -shm and -wal files. Try the following:

chmod 770 .pioreactor/storage/pioreactor.sqlite-shm
chmod 770 .pioreactor/storage/pioreactor.sqlite-wal

And try again

Thank you , This is useful.

What’s strange is that I had suspected these two files before, so I deleted them. After running the operations on the interface again, these two files were automatically generated, and then the same issue reappeared as described above.