This is not a common error. It could be a disk space issue that has corrupted the database.
Does lxc list work?
You can examine the contents of the database with the following. To view the database schema (the database table names, and also their respective fields),
lxd sql global .schema
To get the list of the containers (instances), you would
lxd sql global .schema | head
PRAGMA foreign_keys=OFF;
BEGIN TRANSACTION;
CREATE TABLE schema (
id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL,
version INTEGER NOT NULL,
updated_at DATETIME NOT NULL,
UNIQUE (version)
);
INSERT INTO schema VALUES(1,13,1543511636);
INSERT INTO schema VALUES(2,14,1550571829);
So read-only access appears fine but writes no so much. /var/snap/lxd/common/lxd/database is writable and didn’t flip to read-only, right?
If it’s properly writable, then I’d suggest trying to restart LXD, that may fix the issue or if not, will probably provide a better error. This can be done with systemctl reload snap.lxd.daemon
I’ll install sqlite3 client and try to do a writing operation, is it your suggestion?
Regarding your suggestion to snap restart lxd, when I do it it apparently works fine, but after a few minutes the containers start to be unreachable, not all at once, one after the other.
They’re apparently running, except that their ports are not reachable any more.
If it happens when I’m still inside a container, basic commands like w doesn’t work anymore, saying /proc folder isn’t available.
I have to restart each container to fix it.
it seems it occurs when I try to write into the db:
lxd sql global "update instances set description ='dummy' where node_id = 1" --debug --verbose
DBUG[02-26|16:48:38] Connecting to a local LXD over a Unix socket
DBUG[02-26|16:48:38] Sending request to LXD method=POST url=http://unix.socket/internal/sql etag=
DBUG[02-26|16:48:38]
{
"database": "global",
"query": "update instances set description ='dummy' where node_id = 1"
}
Error: SQL logic error
is there any command to restart just the db subsystem (to avoid the down of the containers I experience after the restart of LXD)?