Ubuntu Forums ubuntu.com - launchpad.net - ubuntu help  

Go Back   Ubuntu Forums > The Ubuntu Forum Community > Main Support Categories > Server Platforms
Register Reset Password Forum Help Forum Council Search Today's Posts Mark Forums Read

Ubuntu 9.10 is out!!!

When downloading Ubuntu 9.10 please consider using bittorrent to get your copy of Ubuntu.

The Ubuntu Developers Summit for Lucid Lynx will be held the week of 16-Nov-2009 till 20-Nov-2009 in Dallas, TX USA. Visit the the Ubuntu wiki for more information about UDS and how to participate remotely.

Server Platforms
Discussion regarding the Ubuntu Server Edition. For more information on the Ubuntu Server Team, please visit their wiki page or Launchpad page.

 
Thread Tools Display Modes
Old June 3rd, 2008   #1
heddhunter
First Cup of Ubuntu
 
Join Date: Jun 2008
Beans: 3
Question mysql/bizarre permission denied errors as root

i'm having a very weird problem installing mysql. i created a big RAID-5 array (/dev/md0) mounted on /var/media. if i do

mysql_install_db --datadir=/var/media/mysql

i get:

$ sudo mysql_install_db --datadir=/var/media/mysql
Installing MySQL system tables...
080603 20:22:53 [Warning] Can't create test file /var/media/mysql/monolith.lower-test
080603 20:22:53 [Warning] Can't create test file /var/media/mysql/monolith.lower-test
ERROR: 1005 Can't create table 'db' (errno: 13)
080603 20:22:53 [ERROR] Aborting

080603 20:22:53 [Note] /usr/sbin/mysqld: Shutdown complete

Installation of system tables failed!


It works just fine if I install it on /var/lib/mysql, or /tmp, or anywhere else basically. Of course, I'm out of space everywhere else and I want to use the giant RAID i put together specifically for this purpose...

I don't have any problem creating files on this partition as root, or as a normal user in a directory that has user write permission.

I just noticed message like this in the system log:

Jun 3 20:22:53 monolith kernel: [ 9834.697327] audit(1212549773.394:53): type=1503 operation="inode_create" requested_mask="w::" denied_mask="w::" name="/var/media/mysql/monolith.lower-test" pid=11679 profile="/usr/sbin/mysqld" namespace="default"

That's a new one on me... ?

Last edited by heddhunter; June 3rd, 2008 at 11:35 PM..
heddhunter is offline   Reply With Quote
Old June 4th, 2008   #2
windependence
Tall Cafè Ubuntu
 
windependence's Avatar
 
Join Date: May 2007
Location: Phoenix, Arizona USA
Beans: 2,588
Kubuntu 8.10 Intrepid Ibex
Re: mysql/bizarre permission denied errors as root

Check the ownership AND permissions on /var/lib/mysql and make them excactly the same on /var/media.

Also, from googling, it looks like this is an apparmor problem. I disable apparmor in my installs because IMHO it causes more problems than it's worth.

-Tim
__________________
"Better to use a Mac and be thought a fool than to use Windows and remove all doubt"
www.windependence.org
Get your Windependence today!
windependence is offline   Reply With Quote
Old June 4th, 2008   #3
heddhunter
First Cup of Ubuntu
 
Join Date: Jun 2008
Beans: 3
Re: mysql/bizarre permission denied errors as root

Quote:
Originally Posted by windependence View Post
Check the ownership AND permissions on /var/lib/mysql and make them excactly the same on /var/media.

Also, from googling, it looks like this is an apparmor problem. I disable apparmor in my installs because IMHO it causes more problems than it's worth.

-Tim
you're right, it was an apparmor issue. i set it to complain on mysqld instead of enforce and now i'm good to go.

i am new to ubuntu (but have a dozen years of unix/bsd/redhat under my belt) so i'd never heard of apparmor before today. i think you are right about it being more trouble than it's worth.
heddhunter is offline   Reply With Quote
Old June 5th, 2008   #4
Xerp
Way Too Much Ubuntu
 
Xerp's Avatar
 
Join Date: Jul 2007
Location: London
Beans: 260
Ubuntu 8.04 Hardy Heron
Re: mysql/bizarre permission denied errors as root

I've also just hit this one, but I'm not doing anything "funny" - everything is the installation default. AppArmor won't let MySQL start. Would this class as a bug? Surely the default apt-get install mysql should work?

What needs to be changed? I assume it is something in /etc/apparmor.d/usr.sbin.mysqld

For now I am testing and have simply disabled the whole of AppArmor. Ultimately this is not what I want to do

I have the default:

# vim:syntax=apparmor
# Last Modified: Tue Jun 19 17:37:30 2007
#include <tunables/global>

/usr/sbin/mysqld {
#include <abstractions/base>
#include <abstractions/nameservice>
#include <abstractions/user-tmp>
#include <abstractions/mysql>

capability dac_override,
capability setgid,
capability setuid,

/etc/hosts.allow r,
/etc/hosts.deny r,

/etc/group m,
/etc/passwd m,

/etc/mysql/*.pem r,
/etc/mysql/conf.d/ r,
/etc/mysql/conf.d/* r,
/etc/mysql/my.cnf r,
/usr/sbin/mysqld mr,
/usr/share/mysql/** r,
/var/lib/mysql/ r,
/var/lib/mysql/** rwk,
/var/log/mysql/ r,
/var/log/mysql/* rw,
/var/run/mysqld/mysqld.pid w,
/var/run/mysqld/mysqld.sock w,
}

And it won't let MySQL create the socket, /var/run/mysqld/mysqld.sock

I get:

kernel: [ 1185.380430] audit(1212667771.111:15): type=1503 operation="inode_permission" requested_mask="w::" denied_mask="w::" name="/var/lib/lwidentity/lwidentity_privileged/pipe" pid=6770 profile="/usr/sbin/mysqld" namespace="default"

and

/etc/init.d/mysql[6932]: error: 'Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)'
Xerp is offline   Reply With Quote

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 05:13 AM.


vBulletin ©2000 - 2009, Jelsoft Enterprises Ltd. Ubuntu Logo, Ubuntu and Canonical © Canonical Ltd. Tango Icons © Tango Desktop Project. bilberry