Can't run query INSERT INTO `Logs` - Running in read-only mode

Discussions related to the 1.36.x series of ZoneMinder
Post Reply
torkilt
Posts: 38
Joined: Thu Jul 06, 2017 10:56 am

Can't run query INSERT INTO `Logs` - Running in read-only mode

Post by torkilt »

Hi

Suddenlyy started seeing these and zoneminder doesn't work.

Code: Select all

...
Aug 05 19:02:44 zm zmc_m5[2520]: ERR [zmc_m5] [Can't run query INSERT INTO `Logs` ( `TimeKey`, `Component`, `ServerId`, `Pid`, `Level`, `Code`, `Message`, `File`, `Line` ) VALUES ( 1691254964.920227, 'zmc_m5', 0, 2597, 0, 'INF', 'Driveway: 000 - Opened new event 0, section start', 'zm_monitor.cpp', 1933 ): Running in read-only mode]
...
RHEL 9.2 with zoneminder-1.36.33-3.el9.x86_64.

MariaDB is running and is _not_ readonly:

Code: Select all

MariaDB [(none)]> SELECT @@global.read_only;
+--------------------+
| @@global.read_only |
+--------------------+
|                  0 |
+--------------------+
1 row in set (0.000 sec)
Suggestions? I haven't found anything else in the logs to go by. File systems are also working.

Mvh.

Torkil
torkilt
Posts: 38
Joined: Thu Jul 06, 2017 10:56 am

Re: Can't run query INSERT INTO `Logs` - Running in read-only mode

Post by torkilt »

Code: Select all

Aug 07 08:13:01 zm zmpkg.pl[21346]: DBD::mysql::st execute failed: Running in read-only mode at /usr/share/perl5/vendor_perl/ZoneMinder/Logger.pm line 627.
torkilt
Posts: 38
Joined: Thu Jul 06, 2017 10:56 am

Re: Can't run query INSERT INTO `Logs` - Running in read-only mode

Post by torkilt »

I added the following[1] while mucking around and that may have fixed it:

Code: Select all

innodb_buffer_pool_size = 2G
innodb_buffer_pool_instances = 2
innodb_log_buffer_size = 32M
innodb_log_file_size = 512M
innodb_open_files = 5000
table_open_cache = 1000
net_read_timeout = 60
net_write_timeout = 120
connect_timeout = 20
max_connections = 5000

[1] viewtopic.php?p=104746#p104746
Magic919
Posts: 1381
Joined: Wed Sep 18, 2013 6:56 am

Re: Can't run query INSERT INTO `Logs` - Running in read-only mode

Post by Magic919 »

I expect a DB restart would have cleared it. Hopefully your changes will prevent it happening again.
-
torkilt
Posts: 38
Joined: Thu Jul 06, 2017 10:56 am

Re: Can't run query INSERT INTO `Logs` - Running in read-only mode

Post by torkilt »

Magic919 wrote: Mon Aug 07, 2023 8:41 am I expect a DB restart would have cleared it. Hopefully your changes will prevent it happening again.
I expected so as well but it did not. Fingers crossed.
Magic919
Posts: 1381
Joined: Wed Sep 18, 2013 6:56 am

Re: Can't run query INSERT INTO `Logs` - Running in read-only mode

Post by Magic919 »

Did MariaDB log anything during this?
-
torkilt
Posts: 38
Joined: Thu Jul 06, 2017 10:56 am

Re: Can't run query INSERT INTO `Logs` - Running in read-only mode

Post by torkilt »

Stopped working again *grrr*

Mariadb is only showing this:

Code: Select all

Aug 27 10:43:51 zm mariadb-check-socket[3993]: Socket file /var/lib/mysql/mysql.sock exists.
Aug 27 10:43:51 zm mariadb-check-socket[3993]: No process is using /var/lib/mysql/mysql.sock, which means it is a garbage, so it will be removed automatically.
Aug 27 10:43:52 zm mariadb-prepare-db-dir[4019]: Database MariaDB is probably initialized in /var/lib/mysql already, nothing is done.
Aug 27 10:43:52 zm mariadb-prepare-db-dir[4019]: If this is not the case, make sure the /var/lib/mysql is empty before running mariadb-prepare-db-dir.
Aug 27 10:43:52 zm mariadbd[4054]: 2023-08-27 10:43:52 0 [Note] /usr/libexec/mariadbd (mysqld 10.5.16-MariaDB) starting as process 4054 ...
Aug 27 10:43:52 zm systemd[1]: mariadb.service: Main process exited, code=exited, status=1/FAILURE
Restarting zm, restarting mariadb and rebooting the box makes no difference.
torkilt
Posts: 38
Joined: Thu Jul 06, 2017 10:56 am

Re: Can't run query INSERT INTO `Logs` - Running in read-only mode

Post by torkilt »

From /var/log/mariadb/mariadb.log:

Code: Select all

2023-08-27 10:43:52 0 [ERROR] mariadbd: Can't create/write to file '/run/mariadb/mariadb.pid' (Errcode: 2 "No such file or directory")
2023-08-27 10:43:52 0 [ERROR] Can't start server: can't create PID file: No such file or directory
Found this rather ancient bug with a solution:

https://bugzilla.redhat.com/show_bug.cgi?id=1373006
Post Reply