mysql failing to start due to permission errors

Bug #227615 reported by vik
2
Affects Status Importance Assigned to Milestone
mysql-dfsg-5.0 (Ubuntu)
Invalid
Undecided
Unassigned

Bug Description

Binary package hint: mysql-server-5.0

I have installed ubuntu server 8.04, and have set up a directory structure where /var/lib is a symlink to a different volume (/mnt/fastdata/var/lib). Mysqld fails to start with the following errors in syslog:

May 7 15:51:55 vcke-gl-linux mysqld_safe[5886]: started
May 7 15:51:55 vcke-gl-linux kernel: [ 82.391726] audit(1210139515.249:2): type=1503 operation="inode_create" requested_mask="w::" denied_mask="w::" name="/mnt/fastdata/var/lib/mysql/vcke-gl-linux.lower-test" pid=5888 profile="/usr/sbin/mysqld" namespace="default"
May 7 15:51:55 vcke-gl-linux mysqld[5890]: 080507 15:51:55 [Warning] Can't create test file /var/lib/mysql/vcke-gl-linux.lower-test
May 7 15:51:55 vcke-gl-linux kernel: [ 82.393387] audit(1210139515.259:3): type=1503 operation="inode_create" requested_mask="w::" denied_mask="w::" name="/mnt/fastdata/var/lib/mysql/vcke-gl-linux.lower-test" pid=5888 profile="/usr/sbin/mysqld" namespace="default"
May 7 15:51:55 vcke-gl-linux mysqld[5890]: 080507 15:51:55 [Warning] Can't create test file /var/lib/mysql/vcke-gl-linux.lower-test
May 7 15:51:55 vcke-gl-linux kernel: [ 82.487247] audit(1210139515.349:4): type=1503 operation="inode_create" requested_mask="w::" denied_mask="w::" name="/mnt/fastdata/tmp/ib7jXL82" pid=5888 profile="/usr/sbin/mysqld" namespace="default"
May 7 15:51:55 vcke-gl-linux mysqld[5890]: ^G/usr/sbin/mysqld: Can't create/write to file '/tmp/ib7jXL82' (Errcode: 13)
May 7 15:51:55 vcke-gl-linux mysqld[5890]: 080507 15:51:55 InnoDB: Error: unable to create temporary file; errno: 13
May 7 15:51:55 vcke-gl-linux kernel: [ 82.508111] audit(1210139515.369:5): type=1503 operation="inode_mknod" requested_mask="w::" denied_mask="w::" name="/mnt/fastdata/var/run/mysqld/mysqld.sock" pid=5888 profile="/usr/sbin/mysqld" namespace="default"
May 7 15:51:55 vcke-gl-linux mysqld[5890]: 080507 15:51:55 [ERROR] Can't start server : Bind on unix socket: Permission denied
May 7 15:51:55 vcke-gl-linux mysqld[5890]: 080507 15:51:55 [ERROR] Do you already have another mysqld server running on socket: /var/run/mysqld/mysqld.sock ?
May 7 15:51:55 vcke-gl-linux mysqld[5890]: 080507 15:51:55 [ERROR] Aborting
May 7 15:51:55 vcke-gl-linux mysqld[5890]:
May 7 15:51:55 vcke-gl-linux mysqld[5890]: 080507 15:51:55 [Note] /usr/sbin/mysqld: Shutdown complete
May 7 15:51:55 vcke-gl-linux mysqld[5890]:
May 7 15:51:55 vcke-gl-linux mysqld_safe[5892]: ended

As far as I can tell, the permissions in /var/lib/mysql are correct:

$ ls -ld /var/lib/mysql
drwxr-xr-x 3 mysql mysql 4096 2008-05-07 16:09 /var/lib/mysql

$ ls -ld /mnt/fastdata/var/lib/mysql
drwxr-xr-x 3 mysql mysql 4096 2008-05-07 16:09 /mnt/fastdata/var/lib/mysql

(/var/lib/ is a symlink to /mnt/fastdata/lib)

This seems to be a problem if the directory for mysql data is anywhere outside /var/lib/mysql : http://ubuntuforums.org/showthread.php?t=782224

I have tried purging and re-installing mysql-server-5.0 to no avail.

Other info:
$ apt-cache policy mysql-server-5.0
mysql-server-5.0:
  Installed: 5.0.51a-3ubuntu5
  Candidate: 5.0.51a-3ubuntu5
  Version table:
 *** 5.0.51a-3ubuntu5 0
        500 http://ftp.netspace.net.au hardy/main Packages
        100 /var/lib/dpkg/status

$ lsb_release -rd
Description: Ubuntu 8.04
Release: 8.04

Revision history for this message
vik (askvictor) wrote :
Revision history for this message
Nick Barcet (nijaba) wrote : Re: [Bug 227615] [NEW] mysql failing to start due to permission errors

vik wrote:
> This seems to be a problem if the directory for mysql data is anywhere
> outside /var/lib/mysql : http://ubuntuforums.org/showthread.php?t=782224

Thanks a lot ofr taking the time to report this problem and help us make
Ubuntu better.

There is now an apparmor profile enabled by default for mysql that will
prevent mysql to access non standard area of the file system. Puting
the mysql profile in complain mode using "sudo aa-complain" as described
in [1] should show you this in the logs.

To fix this, you will need to add /mnt/fastdata/var/lib/mysql to the
list of authorized paths in the apparmor mysql profile you will find in
/etc/apparmor.d/.

Marking this bug as invalid as it reflects an intended behaviour.

[1] https://help.ubuntu.com/8.04/serverguide/C/apparmor.html

status invalid

Nick Barcet (nijaba)
Changed in mysql-dfsg-5.0:
status: New → Invalid
Revision history for this message
grryf (ndo-wp) wrote :

What I did was flushing privileges after moving to another server, then my new root password changed to this from old server but i didnt know that and i did remove mysql-server and reinstall it again hoping to not use flush privileges again. This caused so horrible-many-hours-wasting problem. BUG REPORT!!!
apt-get remove --purge mysql-server

It was a few problems while reinstalling mysql-server
1. /var/lib/dpkg/info/mysql-server-5.0.postinst: line 143: /etc/mysql/conf.d/old_passwords.cnf: No such file or directory
2. Something like /lib/modules/apparmor could not be found
3. Something like /lib/modules/2.6.28***/** coun't be found because the directory 2.6.28 wasnt existed

Some log (not mine):
Setting up mysql-client-5.0 (5.0.51a-3ubuntu5.1) ...
Setting up mysql-server-5.0 (5.0.51a-3ubuntu5.1) ...
 * Stopping MySQL database server mysqld [ OK ]
/var/lib/dpkg/info/mysql-server-5.0.postinst: line 143: /etc/mysql/conf.d/old_passwords.cnf: No such file or directory
dpkg: error processing mysql-server-5.0 (--configure):
 subprocess post-installation script returned error exit status 1
Errors were encountered while processing:
 mysql-server-5.0
E: Sub-process /usr/bin/dpkg returned an error code (1)

How I fixed it?:

sudo bash
chown -R mysql:mysql /var/lib/mysql/mysql/
(it was root:root)
touch /etc/mysql/my.cnf
chown -R mysql:mysql /etc/mysql/
(it was root:root)
apt-get install mysql-server
/etc/init.d/mysql stop
/etc/init.d/mysql start
(it was fail before)
.........[ OK ]

!!!!!!!!!!!!!!...............

Best Regards,
grryf

Very similar:
http://ubuntuforums.org/showthread.php?t=891109&highlight=grryf

ndo@ks31258:/lib/modules$ ls
2.6.24-24-generic
(not .28)

Revision history for this message
grryf (ndo-wp) wrote :

sorry wrong topic, i dont know how to remove the comment....

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Bug attachments

Remote bug watches

Bug watches keep track of this bug in other bug trackers.