Table 'Monitors' is read only

Support and queries relating to all previous versions of ZoneMinder
Locked
gessel
Posts: 26
Joined: Sat Jan 24, 2004 12:24 am

Table 'Monitors' is read only

Post by gessel »

Odd error. I'm logged in as admin. It worked fine for quite some time. I haven't spent a lot of time debugging, but if there's an easy answer it would save me time.

I can't change the state of Zone minder (from stopped to start for example) or change the funciton of the cameras because "Table 'Monitors' is read only"

-David
User avatar
zoneminder
Site Admin
Posts: 5215
Joined: Wed Jul 09, 2003 2:07 pm
Location: Bristol, UK
Contact:

Post by zoneminder »

Do you have any wierd permissions on the actual database files? Or is the table locked for update by something else that might be running? You can have mysql read-only tables but I think you have to specifically generate them.
Phil
gessel
Posts: 26
Joined: Sat Jan 24, 2004 12:24 am

Post by gessel »

Not that I'm aware of. I didn't change any of the database permissions and I tried rebooting which in theory should have released any rogue applications.

There's nothing much in the log files either...

It is possible the machine was compromised by someone mischevious, but there are none of the usual signs (missing log files, odd file entries, etc.)

-David
User avatar
cordel
Posts: 5210
Joined: Fri Mar 05, 2004 4:47 pm
Location: /USA/Washington/Seattle

Post by cordel »

Check the database integrity. Sounds like something might have gotten corrupted.
first you can try:

Code: Select all

mysqlcheck --all-databases --auto-repair -ppassword -u user
and If that can't repair everything then stop zm and mysql and run:

Code: Select all

myisamchk --silent --force --fast --update-state -O key_buffer=64M \
-O sort_buffer=64M -O read_buffer=1M -O write_buffer=1M \
/var/lib/mysql/*/*.MYI
Corey
gessel
Posts: 26
Joined: Sat Jan 24, 2004 12:24 am

fixed - bad blocks

Post by gessel »

After much futzing it became apparent that this was a hardware problem with the /var partition. As this is mounted as /dev/hda6, what I needed to do was fsck it in a fairly agressive way to get the blocks mapped out and any thus broken files remapped. Fortunately nothing critical seems to have been hosed.

Code: Select all

umount /dev/hda6 
unmounts the drive

Code: Select all

e2fsck -c -c -D -f -F -k -v -y /dev/hda6
does a non-destructive read/write and found 27 bad blocks (total, most probably on the OEM table, but reverified).
-p found errors, but they were a bit too serious to fix in "not likely to hose" mode. There is some risk of totally hosing your drive, so backup first.[/code]
jameswilson
Posts: 5111
Joined: Wed Jun 08, 2005 8:07 pm
Location: Midlands UK

Post by jameswilson »

having probs myself
tried the usual

Code: Select all

Stopping ZoneMinder:                                            [  OK  ]
[root@id1461 ~]# myisamchk --silent --force --fast --update-state -O key_buffer=                                         64M \
> -O sort_buffer=64M -O read_buffer=1M -O write_buffer=1M \
> /var/lib/mysql/*/*.MYI
myisamchk: MyISAM file /var/lib/mysql/zm/Events.MYI
myisamchk: warning: 1 client is using or hasn't closed the table properly
myisamchk: MyISAM file /var/lib/mysql/zm/Frames.MYI
myisamchk: warning: Table is marked as crashed and last repair failed
myisamchk: warning: Size of indexfile is: 262320128      Should be: 136311808
myisamchk: warning: Size of datafile is: 204207030       Should be: 194865450
myisamchk: error: Can't read indexpage from filepos: -1
myisamchk: Error writing file '/var/lib/mysql/zm/Frames.MYI' (Errcode: 5)
myisamchk: MyISAM file /var/lib/mysql/zm/Frames.MYI
myisamchk: error: 5 when fixing table
im having this too niether ofthe fix commands do fix it

any clues?
James Wilson

Disclaimer: The above is pure theory and may work on a good day with the wind behind it. etc etc.
http://www.securitywarehouse.co.uk
dgessel
Posts: 1
Joined: Mon Nov 28, 2005 12:06 am

helpful

Post by dgessel »

In the end, my drive got flaky. I have had a chron job running fsck daily ever since my last post, and haven't had the same problems since. This is not recommended procedure, your mileage may vary, but it is working for me. The server is running headless at the moment, so I can't pull up the command to reference it.

Check df to make sure you're good on space too.
jameswilson
Posts: 5111
Joined: Wed Jun 08, 2005 8:07 pm
Location: Midlands UK

Post by jameswilson »

its not full. that was my first thought!

i have tried running fsck but as i need it to run on md0 i dont know how

thanks anyway. I reakon its had a bad power down, but as mqsql cant repair it self the thing is currently down!
James Wilson

Disclaimer: The above is pure theory and may work on a good day with the wind behind it. etc etc.
http://www.securitywarehouse.co.uk
User avatar
zoneminder
Site Admin
Posts: 5215
Joined: Wed Jul 09, 2003 2:07 pm
Location: Bristol, UK
Contact:

Post by zoneminder »

jameswilson wrote:myisamchk: Error writing file '/var/lib/mysql/zm/Frames.MYI' (Errcode: 5)
This looks like an I/O error so it may be that your disk is on the way out. Any other errors in /var/log/messages? md0 is a RAID partition usually, do you have it striped or mirrored? It may be that you can add in a different disk and rebuild the RAID but I'm afraid I don't know exactly how.
Phil
SlovakJoe
Posts: 32
Joined: Mon Mar 17, 2008 9:27 pm

Post by SlovakJoe »

In case it helps anyone else, here's how the above problem worked out for me.

The symptoms in my case were that filters weren't being run. A check of /var/zmdc.log revealed

Code: Select all

05/27/2008 23:27:03.079696 zmdc[22862].INF [Starting pending process, zmaudit.pl -c]
05/27/2008 23:27:03.088442 zmdc[22862].INF ['zmaudit.pl -c' starting at 08/05/27 23:27:03, pid = 23277]
05/27/2008 23:27:05.127264 zmdc[22862].ERR ['zmaudit.pl -c' exited abnormally, exit status 9]
After running

Code: Select all

mysqlcheck --all-databases --auto-repair -ppassword -u user
it output the following

Code: Select all

mysql.columns_priv                                 OK
mysql.db                                           OK
mysql.func                                         OK
mysql.help_category                                OK
mysql.help_keyword                                 OK
mysql.help_relation                                OK
mysql.help_topic                                   OK
mysql.host                                         OK
mysql.proc                                         OK
mysql.procs_priv                                   OK
mysql.tables_priv                                  OK
mysql.time_zone                                    OK
mysql.time_zone_leap_second                        OK
mysql.time_zone_name                               OK
mysql.time_zone_transition                         OK
mysql.time_zone_transition_type                    OK
mysql.user                                         OK
zm.Config                                          OK
zm.ControlPresets                                  OK
zm.Controls                                        OK
zm.Devices                                         OK
zm.Events                                          OK
zm.Filters                                         OK
zm.Frames                                          OK
zm.Groups                                          OK
zm.MonitorPresets                                  OK
zm.Monitors                                        OK
zm.States                                          OK
zm.Stats
error    : Table './zm/Stats' is marked as crashed and should be repaired
zm.TriggersX10                                     OK
zm.Users                                           OK
zm.ZonePresets                                     OK
zm.Zones                                           OK

Repairing tables
zm.Stats                                           OK
As of the time of this writing I can't be sure if the filter is being run now. It doesn't appear to. After checking with the ZM options via the web interface, it appears the filters should've run by now. I'll keep you all posted.
User avatar
cordel
Posts: 5210
Joined: Fri Mar 05, 2004 4:47 pm
Location: /USA/Washington/Seattle

Post by cordel »

Are you running an old version of ZM. You should think about updating to at least 1.22.3
Locked