(update) service mysql start on Red Hat Enterprise Linux ES release 4 (Nahant)

C. Ed Felt ed at thefelts.net
Thu Oct 5 06:49:01 MDT 2006


C. Ed Felt wrote:

> How to hose your mysql installation on the latest version of RHE:
>
>   1. Install latest version of RHE [Red Hat Enterprise Linux ES release
>      4 (Nahant)], then "yum update all"
>   2. "rpm -e" on all mysql packages (of course RHE only supports MySQL
>      4 :( )!!!!
>   3. Install latest RHE mysql rpms from mysql.com:
>      MySQL-client-standard-5.0.24-0.rhel4.i386.rpm      
> MySQL-shared-standard-5.0.24-0.rhel4.i386.rpm
>      MySQL-devel-standard-5.0.24-0.rhel4.i386.rpm       
> MySQL-standard-debuginfo-5.0.24-0.rhel4.i386.rpm
>      MySQL-server-standard-5.0.24-0.rhel4.i386.rpm      
> MySQL-test-standard-5.0.24-0.rhel4.i386.rpm
>      MySQL-shared-compat-5.0.24-0.rhel4.i386.rpm
>   4. Reboot, mysql is not running :(.
>
> What I have discovered so far:
>
>    * If I am sshed in to the server as root I can start mysql with no
>      problems:
>      mysql service start
>      tail /var/log/messages
>      Oct  2 07:28:14 mt11 lsb_log_message:  succeeded
>    * If I just "reboot" the server, mysql does not start (though it is
>      set to start on boot):
>      tail /var/log/messages
>      Oct  2 07:25:42 mt11 kernel: audit(1159788342.728:0): avc:      
> denied  { append } for  pid=4756 exe=/usr/sbin/mysqld
>      path=/var/lib/mysql/mt11.caflo.com.err dev=dm-3 ino=1687799
>      scontext=user_u:system_r:mysqld_t tcontext=root:object_r:var_lib_t
>      tclass=file
>      Oct  2 07:25:42 mt11 kernel: audit(1159788342.728:0): avc:      
> denied  { append } for  pid=4756 exe=/usr/sbin/mysqld
>      path=/var/lib/mysql/mt11.caflo.com.err dev=dm-3 ino=1687799
>      scontext=user_u:system_r:mysqld_t tcontext=root:object_r:var_lib_t
>      tclass=file
>      Oct  2 07:25:42 mt11 kernel: audit(1159788342.735:0): avc:      
> denied  { write } for  pid=4756 exe=/usr/sbin/mysqld name=mysql
>      dev=dm-3 ino=1687745 scontext=user_u:system_r:mysqld_t
>      tcontext=root:object_r:var_lib_t tclass=dir
>      Oct  2 07:25:42 mt11 kernel: audit(1159788342.766:0): avc:      
> denied  { read write } for  pid=4756 exe=/usr/sbin/mysqld
>      name=ibdata1 dev=dm-3 ino=1687800
>      scontext=user_u:system_r:mysqld_t tcontext=root:object_r:var_lib_t
>      tclass=file
>      Oct  2 07:26:17 mt11 lsb_log_message:  failed
>
> From preliminary googling, looks like it's an SE Linux issue.  Any 
> suggestions?
>
It took me a while to get back to this issue.

Turned out it was a much simpler issue than I thought.

The biggest clue was:
"Oct  2 07:25:42 mt11 kernel: audit(1159788342.728:0): avc:      denied  
{ append } for  pid=4756 exe=/usr/sbin/mysqld
     path=/var/lib/mysql/mt11.caflo.com.err dev=dm-3 ino=1687799"

Looking at these files showed me:

[ed at mt11 ~]$ ls -lh /var/lib/mysql/
total 21M
-rw-rw----  1 mysql mysql  10M Oct  2 07:15 ibdata1
-rw-rw----  1 mysql mysql 5.0M Oct  2 07:28 ib_logfile0
-rw-rw----  1 mysql mysql 5.0M Sep 22 20:17 ib_logfile1
-rw-rw----  1 mysql root 7.1K Oct  5 07:32 mt11.caflo.com.err
drwx--x--x  2 mysql mysql 4.0K Sep 22 20:00 mysql
drwx------  2 mysql mysql 4.0K Sep 25 20:49 openser
drwxr-xr-x  2 mysql mysql 4.0K Sep 22 20:00 test

So, I just chowned the file mt11.caflo.com.err to the proper group and user:

chown mysql:mysql /var/lib/mysql/mt11.caflo.com.err

to get:

[ed at mt11 ~]$ ls -lh /var/lib/mysql/
total 21M
-rw-rw----  1 mysql mysql  10M Oct  2 07:15 ibdata1
-rw-rw----  1 mysql mysql 5.0M Oct  2 07:28 ib_logfile0
-rw-rw----  1 mysql mysql 5.0M Sep 22 20:17 ib_logfile1
-rw-rw----  1 mysql mysql 7.1K Oct  5 07:32 mt11.caflo.com.err
drwx--x--x  2 mysql mysql 4.0K Sep 22 20:00 mysql
drwx------  2 mysql mysql 4.0K Sep 25 20:49 openser
drwxr-xr-x  2 mysql mysql 4.0K Sep 22 20:00 test

rebooted, and mysql started just fine

So it looks like my issue was simply starting mysql the first time as 
root and the mysql user (which is the user that is used to start mysql 
at boot time) not being able to write to the file mt11.caflo.com.err 
when rebooting.

So mysql starts just fine on a reboot now.

Thanks for the seggestions.  I'll make sure to su to mysql user before I 
restart mysql again.

-- 

*Thank You,*

*C. Ed Felt*
ed at thefelts.net <mailto:ed at thefelts.net>
*chat: *edeefelt(aim), edeefelt (yahoo), edeefelt at hotmail.com (msn)
http://www.thefelts.net <http://www.thefelts.net/>




More information about the PLUG mailing list