System admin is disabled and won't upgrade from 12.0.22 to 12.0.28.4

I’m getting the following error when trying to upgrade the system admin module in which I paid for.

Please wait while module actions are performed
Installing sysadmin
FATAL ERROR
INSERT INTO `sysadmin_options` (`key`, value) VALUES 
('fail2ban_whitelist', '127.0.0.1') [nativecode=145 ** Table 
'./asterisk/sysadmin_options' is marked as crashed and should be 
repaired]
Trace Back/var/www/html/admin/modules/sysadmin/install.php:63 die_freepbx()

  [0]: INSERT INTO `sysadmin_options` (`key`, value) VALUES 
('fail2ban_whitelist', '127.0.0.1') [nativecode=145 ** Table 
'./asterisk/sysadmin_options' is marked as crashed and should be 
repaired]



/var/www/html/admin/libraries/modulefunctions.class.php:2311 include_once()

  [0]: /var/www/html/admin/modules/sysadmin/install.php



/var/www/html/admin/libraries/modulefunctions.class.php:2263 module_functions->_doinclude()

  [0]: /var/www/html/admin/modules/sysadmin/install.php

  [1]: sysadmin



/var/www/html/admin/libraries/modulefunctions.class.php:1821 module_functions->_runscripts()

  [0]: sysadmin

  [1]: install

  [2]: 



/var/www/html/admin/page.modules.php:283 module_functions->install()

  [0]: sysadmin



/var/www/html/admin/config.php:341 include()

  [0]: /var/www/html/admin/page.modules.php

I tried using the upgrade scripts to upgrade my freepbx and it seemed to go well but got this error:

Wed May  6 22:18:33 EDT 2015 UPGRADE 100% COMPLETED
UPDATE sysadmin_options set value = "false" WHERE `key` = "upgrade_lock" [nativecode=145 ** Table './asterisk/sysadmin_options' is marked as crashed and should be repaired]
Fetching FreePBX settings with gen_amp_conf.php..
/usr/local/sbin/amportal: line 52: export: `\(Michael': not a valid identifier
/usr/local/sbin/amportal: line 52: export: `Gates\)': not a valid identifier

I’m running freepbx version 6.12.65-27

Any help would be greatly appreciated.

Mysql is in a crashed state. You need to repair it. This is outside the scope of FreePBX. If you want to know how to fix it use Google or search our forums. This has been answered several times.

A little more detail is need here as I’m not that advanced of a user, I usally just stay in the GUI. I ran the command mysql -u root and while in mysql I used the command show databases; which resulted in the following:

+--------------------+
| Database           |
+--------------------+
| information_schema |
| asterisk           |
| asteriskcdrdb      |
| backup             |
| mysql              |
| test               |
+--------------------+

backup is there because I copied everythig in the /var/lib/mysql/aserisk to /var/lib/mysql/backup as a means to backup the database. Don’t know if that is how you do it. (Some guidance would be nice)

I then ran the command:

repair table asteriskcdrdb.cdr;

which resulted in the following output:

 +-------------------+--------+----------+----------+
| Table             | Op     | Msg_type | Msg_text |
+-------------------+--------+----------+----------+
| asteriskcdrdb.cdr | repair | status   | OK       |
+-------------------+--------+----------+----------+
1 row in set (11.89 sec)

However the error still persists. The error seems to be saying something about sysadmin_options but I have no idea how to fix this. I don’t mind getting my hands a little dirty but mysql and Linux is not my area of expertise (That’s why I’m using www.bing.com which got me this far thanks to your help). I am also not someone who just takes takes and never gives back. I have given back by contributing some custom scripts via pastebin (sending sms messages when offline and in order)and I have also bought several commercial modules like sysadmin pro and endpoint manager (neither of which work because of this error) even though this is just for a home lab. I’m a Cisco Call Manager Guy but have been looking at Freepbx for a few years now. I’m saying all of this not as a way of getting into an online fight because I’m not into that, but I’m just looking for a little more guidance than “It’s a mysql issue and we don’t support that here”. You did package it with your product right? If it doesn’t work then your product doesn’t work right? Then that means you support it! (At least the data within the tables) If I’m out of line here then I apologize in advance. Any help is appreciated, I guess worst case scenario I backup my settings and custom scripts and reinstall. I don’t even mind paying for commercial support as a means of supporting the community because I really like this project. I’m just not sure how much work is involved in the fix ($$). I’m a technician too so I know the issue could be deeper than what we have so far. Again any guidance/help is appreciated.

All you had to do was search for “fix mysql crashed tables” on the internet or on the forums. That’s all I was saying. I never once said “Its a mysql issue and we dont support that here”

All you have to do is run:

mysqlcheck -A --auto-repair

And all I am asking you to do is some due diligence. It took my 5 minutes to find that command. I didn’t get the command last night because I replied on my phone

Appreciate the help, I will try that. Again I wasn’t trying to pick a fight here but sometimes the answer is easy to find when you know what you are looking for. My area of expertise is in Networking so I contribute to another open source project called Pfsense. My point here is that when new people come in and ask questions there is a snarkyness to some answers that people give. I apologize if I took your answer for snarkeyness.

Just ran the command and the problem is corrected.

Thanks you sir.