apparmor denies unlink of mysql socket

Bug #970366 reported by Jon "The Nice Guy" Spriggs
38
This bug affects 9 people
Affects Status Importance Assigned to Milestone
apparmor (Ubuntu)
Invalid
Undecided
Unassigned
mysql-5.5 (Ubuntu)
Confirmed
Undecided
Unassigned

Bug Description

After an update today, I'm now getting the following in /var/log/syslog

Mar 31 21:36:20 home kernel: [1065086.980908] type=1400 audit(1333226180.904:267): apparmor="STATUS" operation="profile_replace" name="/usr/sbin/mysqld" pid=31228 comm="apparmor_parser"
Mar 31 21:36:22 home kernel: [1065088.348786] type=1400 audit(1333226182.271:268): apparmor="DENIED" operation="unlink" parent=1 profile="/usr/sbin/mysqld" name="/run/mysqld/mysqld.sock" pid=31232 comm="mysqld" requested_mask="d" denied_mask="d" fsuid=114 ouid=114
Mar 31 21:36:22 home kernel: [1065088.921899] type=1400 audit(1333226182.843:269): apparmor="DENIED" operation="unlink" parent=1 profile="/usr/sbin/mysqld" name="/run/mysqld/mysqld.pid" pid=31232 comm="mysqld" requested_mask="d" denied_mask="d" fsuid=114 ouid=114
Mar 31 21:36:22 home kernel: [1065088.926422] init: mysql main process (31232) terminated with status 1
Mar 31 21:36:22 home kernel: [1065088.926520] init: mysql respawning too fast, stopped

And, unsurprisingly, MySQL is failing to start.

I've worked around this for now by putting MySQL into "complain" mode in AppArmor, but it would be good to see this resolved?

ProblemType: Bug
DistroRelease: Ubuntu 12.04
Package: mysql-server 5.5.22-0ubuntu1
ProcVersionSignature: Ubuntu 3.2.0-19.30-generic 3.2.11
Uname: Linux 3.2.0-19-generic i686
NonfreeKernelModules: nvidia
ApportVersion: 2.0-0ubuntu2
Architecture: i386
Date: Sat Mar 31 21:43:35 2012
InstallationMedia: Ubuntu 9.10 "Karmic Koala" - Release i386 (20091028.5)
Logs.var.log.daemon.log:

MySQLConf.etc.mysql.conf.d.mysqld.safe.syslog.cnf:
 [mysqld_safe]
 syslog
MySQLVarLibDirListing: ['performance_schema', 'mysql_upgrade_info', 'openfire', 'debian-5.1.flag', 'motp', 'phpmyadmin', 'mysql', 'gammu', 'labnetwork', 'debian-5.5.flag', 'CampFireManager', 'ibdata1', 'owncloud', 'ib_logfile0', 'test', 'syslog', 'cfm2', 'ib_logfile1']
PackageArchitecture: all
ProcEnviron:
 SHELL=/bin/bash
 TERM=screen-bce
 PATH=(custom, no user)
 LANG=en_GB.UTF-8
SourcePackage: mysql-5.5
UpgradeStatus: Upgraded to precise on 2012-03-19 (12 days ago)
modified.conffile..etc.apparmor.d.usr.sbin.mysqld: [modified]
mtime.conffile..etc.apparmor.d.usr.sbin.mysqld: 2012-03-31T21:39:06.530295

Revision history for this message
Jon "The Nice Guy" Spriggs (jontheniceguy) wrote :
Revision history for this message
Launchpad Janitor (janitor) wrote :

Status changed to 'Confirmed' because the bug affects multiple users.

Changed in mysql-5.5 (Ubuntu):
status: New → Confirmed
Revision history for this message
K Lor (lorentz-y) wrote :

I've a fresh 12.04 installation, all updates installed..

Revision history for this message
Cruncher (ubuntu-wkresse) wrote :

This blog presents a fix that works for me. Seems to be a misconfiguration in apparmor.
http://tanghus.net/2012/03/yet-another-mysql-vs-apparmor-barf/

tags: added: apparmor
Changed in apparmor (Ubuntu):
status: New → Invalid
Revision history for this message
Ma11011s (7-launchpad-warmelink-info) wrote :

I had the same issue. I could start MySQL again by placing the following in the mysql configfile:
 [mysqld]
 innodb_force_recovery = 4

After that MySQL started successfully. I have no idea if this is recommend, maybe the bug will appear again later. But for those encountering this issue maybe this helps.

Revision history for this message
Burak Göksoy (rbgoksoy) wrote :

İ have Lamp on Ubuntu Server 12.04 and i am working on Moodle in this server. I had same issue, i looked /var/log/syslog and these lines are the being problem;

Nov 17 07:58:47 localhost kernel: [ 5553.205348] Out of memory: Kill process 678 (mysqld) score 121 or sacrifice child
Nov 17 07:58:47 localhost kernel: [ 5553.205553] Killed process 678 (mysqld) total-vm:337344kB, anon-rss:61480kB, file-rss:0kB
Nov 17 07:58:47 localhost kernel: [ 5553.229584] init: mysql main process (678) killed by KILL signal
Nov 17 07:58:47 localhost kernel: [ 5553.229781] init: mysql main process ended, respawning
Nov 17 07:58:47 localhost kernel: [ 5553.491673] init: mysql main process (1886) terminated with status 1
Nov 17 07:58:47 localhost kernel: [ 5553.491705] init: mysql main process ended, respawning
Nov 17 07:58:48 localhost kernel: [ 5553.524505] init: mysql post-start process (1887) terminated with status 1
Nov 17 07:58:48 localhost kernel: [ 5553.566303] init: mysql main process (1905) terminated with status 1
Nov 17 07:58:48 localhost kernel: [ 5553.566332] init: mysql respawning too fast, stopped
Nov 17 07:59:41 localhost kernel: [ 5606.836903] init: mysql main process (1934) terminated with status 1
Nov 17 07:59:41 localhost kernel: [ 5606.836958] init: mysql main process ended, respawning
Nov 17 07:59:42 localhost kernel: [ 5607.827272] init: mysql post-start process (1935) terminated with status 1
Nov 17 07:59:42 localhost kernel: [ 5607.897534] init: mysql main process (1961) terminated with status 1
Nov 17 07:59:42 localhost kernel: [ 5607.897593] init: mysql main process ended, respawning
Nov 17 07:59:43 localhost kernel: [ 5608.887142] init: mysql post-start process (1962) terminated with status 1
Nov 17 07:59:43 localhost kernel: [ 5608.955408] init: mysql main process (1988) terminated with status 1
Nov 17 07:59:43 localhost kernel: [ 5608.955463] init: mysql respawning too fast, stopped

The solution is from here; http://askubuntu.com/questions/127264/cant-start-mysql-mysql-respawning-too-fast-stopped

So i added these line to my /etc/mysql/my.cnf ;

default-character-set = utf8
default-collation = utf8_general_ci

character_set_server = utf8
collation_server = utf8_general_ci

Revision history for this message
Burak Göksoy (rbgoksoy) wrote :

And also i restart mysq!

sudo service mysql restart

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.