URGENT - repair_database.sh failing - Permissions Denied

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
Locked
krobertson71
Posts: 444
Joined: Tue Feb 11, 2014 10:16 pm

URGENT - repair_database.sh failing - Permissions Denied

Post by krobertson71 »

Getting the following when trying to run ./repair_database.sh

Code: Select all

nagios@nagiasp01 scripts]$ ./repair_databases.sh 
mysqld (pid  10167) is running...
mysqld (pid  10167) is running...
DATABASE: nagios
TABLE:    
/usr/local/nagiosxi/scripts/repairmysql.sh: line 49: pushd: /var/lib/mysql/nagios: Permission denied
ERROR: Could not change to dir: /var/lib/mysql/nagios
mysqld (pid  10167) is running...
DATABASE: nagiosql
TABLE:    
/usr/local/nagiosxi/scripts/repairmysql.sh: line 49: pushd: /var/lib/mysql/nagiosql: Permission denied
ERROR: Could not change to dir: /var/lib/mysql/nagiosql
Stopping ndo2db: done.
Starting ndo2db: done.
Running configuration check...
Stopping nagios:. done.
Starting nagios: done.
Getting this error after a restart. Normally repairing the database works fine. Now I am getting this. Nothing has been changed in nagios. The directory /var/lib/mysql/nagios is owned by mysql|mysql.

Code: Select all

SQL: SQL Error [ndoutils] : Table './nagios/nagios_servicestatus' is marked as crashed and should be repaired SQL: SQL Error [ndoutils] : Table './nagios/nagios_servicestatus' is marked as crashed and should be repaired SQL: SQL Error [ndoutils] : Table './nagios/nagios_servicestatus' is marked as crashed and should be repaired SQL: SQL Error [ndoutils] : Table './nagios/nagios_servicestatus' is marked as crashed and should be repaired SQL: SQL Error [ndoutils] : Table './nagios/nagios_servicestatus' is marked as crashed and should be repaired SQL: SQL Error [ndoutils] : Table './nagios/nagios_servicestatus' is marked as crashed and should be repaired SQL: SQL Error [ndoutils] : Table './nagios/nagios_servicestatus' is marked as crashed and should be repaired
User avatar
tgriep
Madmin
Posts: 9190
Joined: Thu Oct 30, 2014 9:02 am

Re: URGENT - repair_database.sh failing - Permissions Denied

Post by tgriep »

The repair_database script has to be run as root. Login as root and then run the script, that should work for you.
Be sure to check out our Knowledgebase for helpful articles and solutions!
krobertson71
Posts: 444
Joined: Tue Feb 11, 2014 10:16 pm

Re: URGENT - repair_database.sh failing - Permissions Denied

Post by krobertson71 »

That I knew. Turns out the nagios user was removed from the "wheel". Once our linux team correct the scripts ran normally.

Thank you and sorry for the disturbance. They made that change without informing us so it was a stressful moment.
dwhitfield
Former Nagios Staff
Posts: 4583
Joined: Wed Sep 21, 2016 10:29 am
Location: NoLo, Minneapolis, MN
Contact:

Re: URGENT - repair_database.sh failing - Permissions Denied

Post by dwhitfield »

No problem. That's what we are here for. Can we go ahead and lock the thread?
krobertson71
Posts: 444
Joined: Tue Feb 11, 2014 10:16 pm

Re: URGENT - repair_database.sh failing - Permissions Denied

Post by krobertson71 »

Sorry yes. You can lock it up.
dwhitfield
Former Nagios Staff
Posts: 4583
Joined: Wed Sep 21, 2016 10:29 am
Location: NoLo, Minneapolis, MN
Contact:

Re: URGENT - repair_database.sh failing - Permissions Denied

Post by dwhitfield »

Great, just wanted to be sure.
Locked