CPU information is inaccessible for MySQL

Bug #448656 reported by Vitaly Chekryzhev
This bug report is a duplicate of:  Bug #444479: missing apparmor access rule . Edit Remove
66
This bug affects 12 people
Affects Status Importance Assigned to Milestone
mysql-dfsg-5.1 (Ubuntu)
Triaged
Medium
Unassigned

Bug Description

Binary package hint: mysql-server-core-5.1

While loading MySQL service in system these messages appears (dmesg):

[ 16.081671] type=1503 audit(1255262780.708:66): operation="open" pid=1678 parent=1677 profile="/usr/sbin/mysqld" requested_mask="r::" denied_mask="r::" fsuid=0 ouid=0 name="/sys/devices/system/cpu/"
[ 16.349668] type=1503 audit(1255262780.975:67): operation="open" pid=1699 parent=1698 profile="/usr/sbin/mysqld" requested_mask="r::" denied_mask="r::" fsuid=0 ouid=0 name="/sys/devices/system/cpu/"
[ 17.082697] type=1503 audit(1255262781.707:68): operation="open" pid=1817 parent=1709 profile="/usr/sbin/mysqld" requested_mask="r::" denied_mask="r::" fsuid=0 ouid=0 name="/sys/devices/system/cpu/"
[ 17.500506] type=1503 audit(1255262782.127:69): operation="open" pid=1823 parent=1822 profile="/usr/sbin/mysqld" requested_mask="r::" denied_mask="r::" fsuid=0 ouid=0 name="/sys/devices/system/cpu/"
[ 18.545652] type=1503 audit(1255262783.171:70): operation="open" pid=1884 parent=1883 profile="/usr/sbin/mysqld" requested_mask="r::" denied_mask="r::" fsuid=0 ouid=0 name="/sys/devices/system/cpu/"
[ 18.646431] type=1503 audit(1255262783.271:71): operation="open" pid=1895 parent=1894 profile="/usr/sbin/mysqld" requested_mask="r::" denied_mask="r::" fsuid=0 ouid=0 name="/sys/devices/system/cpu/"

Distro: Ubuntu-9.10 development
Package version: 5.1.37-1ubuntu5 (with all dependencies)

Revision history for this message
Mathias Gug (mathiaz) wrote :

Thank you for taking the time to report this bug and helping to make Ubuntu better. Does this prevent mysql from starting correclty?

Changed in mysql-dfsg-5.1 (Ubuntu):
importance: Undecided → Low
status: New → Incomplete
Revision history for this message
neoeno (neoeno) wrote :

For me, yes it does.

Chuck Short (zulcss)
Changed in mysql-dfsg-5.1 (Ubuntu):
status: Incomplete → Confirmed
Revision history for this message
Trond Husoe (tr-huso) wrote :

Same goes here.

[ 634.638825] type=1503 audit(1256857087.602:77): operation="open" pid=4201 parent=4200 profile="/usr/sbin/mysqld" requested_mask="r::" denied_mask="r::" fsuid=0 ouid=0 name="/sys/devices/system/cpu/"

Revision history for this message
Trond Husoe (tr-huso) wrote :

This also happens when you try and reinstall mysql-server
[ 634.638825] type=1503 audit(1256857087.602:77): operation="open" pid=4201 parent=4200 profile="/usr/sbin/mysqld" requested_mask="r::" denied_mask="r::" fsuid=0 ouid=0 name="/sys/devices/system/cpu/"

Error message in window:
E: mysql-server-5.1: subprocess installed post-installation script returned error exit status 1
E: mysql-server: dependency problems - leaving unconfigured

Revision history for this message
Ivar Snaaijer (ivar-snaaijer) wrote :

I got the same errors in syslog, added
/sys/devices/system/cpu/ r,
and
/sys/devices/system/* r,
to the apparmor config for mysql, but no go.

upgraded 9.04 to 9.10, i have my database in a non standard folder, mentioned in the apparmor file since 9.04.

Revision history for this message
JBB (jaybrianb) wrote :

You may have a permission issue. Did you change the directories mysql is accessing. For me, this was resolved by granting the mysql user under which mysql runs access to the relevant directories (/log/mysql /lib/mysql /etc/mysql).

i.e.,

chown -R mysql:mysql <dirs in question here>

Revision history for this message
Vitaly Chekryzhev (13hakta) wrote :

2JBB: No, using only default values from package. Data folders have right permissions, and as I suppose it really shouldn't depend on it.

vitaly:/var/lib$ ls -l mysql
total 28764
-rw-r--r-- 1 mysql mysql 0 2009-10-08 12:18 debian-5.1.flag
-rw-rw---- 1 mysql mysql 18874368 2009-11-01 03:17 ibdata1
-rw-rw---- 1 mysql mysql 5242880 2009-11-01 11:15 ib_logfile0
-rw-rw---- 1 mysql mysql 5242880 2009-05-31 14:32 ib_logfile1
drwx------ 2 mysql mysql 12288 2009-08-18 20:34 kvop
drwxr-xr-x 2 mysql mysql 4096 2009-10-08 12:18 mysql
-rw------- 1 mysql mysql 6 2009-08-18 20:34 mysql_upgrade_info
drwx------ 2 mysql mysql 12288 2009-11-01 00:43 photohost
drwx------ 2 mysql mysql 4096 2009-05-31 14:40 phpmyadmin
drwx------ 2 mysql mysql 4096 2009-09-07 00:45 ramdim
drwx------ 2 mysql mysql 4096 2009-07-31 01:34 ravall_uckov

Revision history for this message
Marek Šabo (zeratul) wrote :

Confirmed on fresh Kubuntu 9.10:
after calling /etc/init.d/mysql script server fails to start an dmesg shows following:

17672.383215] type=1503 audit(1257090344.464:108): operation="open" pid=23872 parent=23871 profile="/usr/sbin/mysqld" requested_mask="r::" denied_mask="r::" fsuid=0 ouid=0 name="/sys/devices/system/cpu/

Revision history for this message
Ihon (ion-shaitan) wrote :

This is caused by AppArmor, if you stop AppArmor via

/etc/init.d/apparmor stop

start Mysql via

/etc/init.d/mysql start

My Sql will run and you can now restart apparmor via

/etc/init.d/apparmor start

Now I try to find the necessary setting for the apparmor profile.

Cheers,

Ihon

Revision history for this message
Marek Šabo (zeratul) wrote :

Suggestion: Add line

/sys/devices/system/* r,

to your /etc/apparmor.d/usr.sbin.mysqld

Then check your syslog/mysql-log again if there is something else e.g. i personnaly had problem with package in kubuntu. After adding rule I saw error in log complaining about bdb something. I opened /etc/mysql/my.cnf and commented the line with bdb option and it runs now.

HTH,

Regards,

Marek

Revision history for this message
Vitaly Chekryzhev (13hakta) wrote :

So, disabling AppArmor is not a proper solution, while MySQL may be misconfigured.

Revision history for this message
Marek Šabo (zeratul) wrote :

Disabling AppArmor may not be desirable solution, but as you see there could be error in apparmor's mysql configuration and then in configuration of mysql itself. When you disable apparmor for debugging you are one step ahead because mysql now actually produces some logs why it can't start (eg in my case some option that just needed to be commented. I doubt that mysqld would run with proper mysql conf and misconfigured apparmor).

Revision history for this message
Quantico (liarevalo) wrote :

i update 9.04 to 9.10 and the same problem profile="/usr/sbin/mysqld" requested_mask="::r" denied_mask="::r" fsuid=1000 ouid=0 name="/sys/devices/system/cpu/" i try to disable apparmor and add /sys/devices/system/* r, into /etc/apparmor.d/usr.sbin.mysqld and it does not work. help please

Revision history for this message
andrew1056 (andrew-oke) wrote :

I also get this as well:

[ 29.296223] type=1503 audit(1257447657.740:26): operation="open" pid=1405 parent=1404 profile="/usr/sbin/mysqld" requested_mask="r::" denied_mask="r::" fsuid=0 ouid=0 name="/sys/devices/system/cpu/"
[ 29.890030] type=1503 audit(1257447658.332:27): operation="open" pid=1428 parent=1427 profile="/usr/sbin/mysqld" requested_mask="r::" denied_mask="r::" fsuid=0 ouid=0 name="/sys/devices/system/cpu/"
[ 30.359761] type=1503 audit(1257447658.800:28): operation="open" pid=1486 parent=1435 profile="/usr/sbin/mysqld" requested_mask="r::" denied_mask="r::" fsuid=0 ouid=0 name="/sys/devices/system/cpu/"
[ 30.993438] type=1503 audit(1257447659.436:29): operation="open" pid=1501 parent=1500 profile="/usr/sbin/mysqld" requested_mask="r::" denied_mask="r::" fsuid=0 ouid=0 name="/sys/devices/system/cpu/"
[ 32.005413] type=1503 audit(1257447660.448:30): operation="open" pid=1534 parent=1533 profile="/usr/sbin/mysqld" requested_mask="r::" denied_mask="r::" fsuid=0 ouid=0 name="/sys/devices/system/cpu/"
[ 32.588044] eth0: no IPv6 routers present
[ 33.102948] type=1503 audit(1257447661.544:31): operation="open" pid=1550 parent=1549 profile="/usr/sbin/mysqld" requested_mask="r::" denied_mask="r::" fsuid=0 ouid=0 name="/sys/devices/system/cpu/"
[ 33.113770] type=1503 audit(1257447661.556:32): operation="open" pid=1560 parent=1559 profile="/usr/sbin/mysqld" requested_mask="r::" denied_mask="r::" fsuid=0 ouid=0 name="/sys/devices/system/cpu/"

This only happens on startup. Once I'm in a user session I can start mysql with sudo service mysql start.

Revision history for this message
Quantico (liarevalo) wrote :

if you check after update to 9.10 en synaptic the mysql server and client are not installed, just check to install and aplly the changes and it wil work.

the problem in my case was that the files that have the soket was deleted.

so i check out in grep mysqld /var/log/daemon.log

Nov 6 09:32:58 quantico-laptop /etc/init.d/mysql[1803]: error: 'Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)'
Nov 6 09:32:58 quantico-laptop /etc/init.d/mysql[1803]: Check that mysqld is running and that the socket: '/var/run/mysqld/mysqld.sock' exists!

Revision history for this message
mcfang (ubuntu-mcfang) wrote :

I got the same audit errors, however these are a red herring as the problem had nothing to do with apparmor.

Check your daemon.log as it should have information about the actual cause, my daemon.log showed:
mysqld: 091107 14:03:37 [ERROR] /usr/sbin/mysqld: unknown option '--skip-bdb'
mysqld: 091107 14:03:37 [ERROR] Aborting

removing the "skip-bdb" option in /etc/mysql/my.cnf solved it.

If you are upgrading a mysql install it is likely your my.cnf had "skip-bdb" which is no longer supported by the mysql server. New installs do not have this problem as they use a clean my.cnf

Revision history for this message
Alyssa (peridot121) wrote :

The following worked for me
1. Edit /etc/apparmor.d/usr.sbin.mysqld and add the line
/sys/devices/system/cpu/ r,
2. Restart apparmor (as root): /etc/init.d/apparmor restart

Revision history for this message
maraja (ugo-grandolini) wrote :

following the thread at:
http://ubuntuforums.org/archive/index.php/t-1305921.html

I also solved the issue by commenting the following line:

skip-bdb

in /etc/mysql/my.cnf

long life toUbuntu!
:)

Revision history for this message
Marek Šabo (zeratul) wrote :

That is upgrade related issue as well, usually they both come hand in hand (adding apparmor permission and commenting skip-bdb). I was referring to this in my earlier post.

Glad you got it working now.

Revision history for this message
MarcRandolph (mrand) wrote :

Howdy, and thank you for taking the time to report this bug and helping to make Ubuntu better. This particular bug has already been reported and appears to be a duplicate, so it is being marked as such. Please look at the other bug report to see if there is any missing information that you can provide, or to see if there is a workaround for the bug. Additionally, any further discussion regarding the bug should occur in the other report. Please feel free to continue to report any other bugs you may find.

Changed in mysql-dfsg-5.1 (Ubuntu):
importance: Low → Medium
status: Confirmed → Triaged
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

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