Ubuntu

Mysql fails to start after upgrade to precise

Reported by Mario Limonciello on 2012-02-17
24
This bug affects 4 people
Affects Status Importance Assigned to Milestone
mysql-5.5 (Ubuntu)
High
Unassigned

Bug Description

I just upgraded my box from lucid to precise using #do-release-upgrade -d.

After the upgrade I find that mysqld is no longer starting on it's own.

When I try to start it myself using
# sudo start mysql

It will just hang at the console.

At the same time, I see the accompanied text in /var/log/syslog:

Feb 17 01:36:29 supermario kernel: [ 807.108959] type=1400 audit(1329464189.288:57): apparmor="STATUS" operation="profile_replace" name="/usr/sbin/mysqld" pid=5311 comm="apparmor_parser"
Feb 17 01:36:30 supermario kernel: [ 808.374330] type=1400 audit(1329464190.552:58): apparmor="DENIED" operation="mknod" parent=1 profile="/usr/sbin/mysqld" name="/run/mysqld/mysqld.sock" pid=5315 comm="mysqld" requested_mask="c" denied_mask="c" fsuid=102 ouid=102
Feb 17 01:36:30 supermario kernel: [ 808.765855] init: mysql main process (5315) terminated with status 1
Feb 17 01:36:30 supermario kernel: [ 808.765989] init: mysql main process ended, respawning

ProblemType: Bug
DistroRelease: Ubuntu 12.04
Package: mysql-server-5.5 5.5.20-0ubuntu2
ProcVersionSignature: Ubuntu 3.2.0-16.25-generic 3.2.6
Uname: Linux 3.2.0-16-generic i686
NonfreeKernelModules: nvidia
ApportVersion: 1.91-0ubuntu1
Architecture: i386
Date: Fri Feb 17 01:37:07 2012
ProcEnviron:
 LANG=en_US.UTF-8
 SHELL=/bin/bash
SourcePackage: mysql-5.5
UpgradeStatus: Upgraded to precise on 2012-02-17 (0 days ago)

Related branches

Mario Limonciello (superm1) wrote :
tags: added: lucid2precise
Mario Limonciello (superm1) wrote :

Additionally, if I tear down the apparmor profiles loaded and then comment out the apparmor line in the mysql upstart job, it's able to start.

It only hangs because of the apparmor profiles.

Mario Limonciello (superm1) wrote :

I was also able to get it to start by manually adding these lines to the apparmor profile in /etc/apparmor.d/usr.sbin.mysqld:

   /run/mysqld/mysqld.pid w,
  /run/mysqld/mysqld.sock w,

There are already lines for /var/run/mysqld, but it appears that apparmor is not following the symlink that was put there during the precise upgrade.

Mario Limonciello (superm1) wrote :

lastly this appears to not be new in that it affected mysql 5.1 as well.

bug 880339

Mario Limonciello (superm1) wrote :

Worth noting that before upgrade I had mysql server 5.1 installed. After upgrade, it's no longer installed, but it wasn't purged and it still owns the conffile that is supposed to contain the apparmor profile:

supermario@supermario:~/here$ dpkg -S /etc/apparmor.d/usr.sbin.mysqld
mysql-server-5.1: /etc/apparmor.d/usr.sbin.mysqld
supermario@supermario:~/here$ dpkg -l | grep mysql
ii libaprutil1-dbd-mysql 1.3.12+dfsg-3 Apache Portable Runtime Utility Library - MySQL Driver
ii libdbd-mysql-perl 4.020-1build2 Perl5 database interface to the MySQL database
ii libmysqlclient15off 5.1.30really5.0.83-0ubuntu3 MySQL database client library
rc libmysqlclient16 5.1.58-1ubuntu4 MySQL database client library
ii libmysqlclient18 5.5.20-0ubuntu2 MySQL database client library
ii libqt4-sql-mysql 4:4.8.0-1ubuntu5 Qt 4 MySQL database driver
ii mysql-client 5.5.20-0ubuntu2 MySQL database client (metapackage depending on the latest version)
ii mysql-client-5.5 5.5.20-0ubuntu2 MySQL database client binaries
ii mysql-client-core-5.5 5.5.20-0ubuntu2 MySQL database core client binaries
ii mysql-common 5.5.20-0ubuntu2 MySQL database common files, e.g. /etc/mysql/my.cnf
ii mysql-server 5.5.20-0ubuntu2 MySQL database server (metapackage depending on the latest version)
rc mysql-server-5.0 5.1.30really5.0.83-0ubuntu1 MySQL database server binaries
rc mysql-server-5.1 5.1.41-3ubuntu12.10 MySQL database server binaries
ii mysql-server-5.5 5.5.20-0ubuntu2 MySQL database server binaries and system database setup
ii mysql-server-core-5.5 5.5.20-0ubuntu2 MySQL database server binaries
ii php5-mysql 5.3.8.0-1ubuntu3 MySQL module for php5
ii python-mysqldb 1.2.3-1build1 Python interface to MySQL

tags: added: dist-upgrade
Changed in mysql-5.5 (Ubuntu):
importance: Undecided → High
Clint Byrum (clint-fewbar) wrote :

Hi Mario, thanks for testing this!

It looks like the apparmor profile was accidentally dropped somewhere in the 5.1 -> 5.5 transition.

The next upload should fix it.

Changed in mysql-5.5 (Ubuntu):
status: New → Triaged
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package mysql-5.5 - 5.5.20-0ubuntu3

---------------
mysql-5.5 (5.5.20-0ubuntu3) precise; urgency=low

  * d/rules,d/mysql-server-5.5.files: Restoring apport hook and
    apparmor profile (LP: #934013)
  * d/mysql-server-5.5.postrm: restoring postrm debhelper token
    to get proper behaviors from dh_installinit and dh_apparmor.
 -- Clint Byrum <email address hidden> Fri, 17 Feb 2012 13:06:24 -0800

Changed in mysql-5.5 (Ubuntu):
status: Triaged → Fix Released
Ivan Ivanov (ivan-lz) wrote :

I am using mysql server package 5.5.22-0ubuntu1

the fix above says it fixed this bug which is named "Mysql fails to start after upgrade to precise"

I dont think so:

Bug symtoms:

- my mysqld still does not want to start (even when I use a more recent mysql-server version than the one with the fix)
- I saw that it has to do with apparmor and mysql

so.. I searched aptitude with

sudo aptitude search apparmor

I purged apparmor

sudo aptitude purge apparmor apparmor-utils

and I installed it back

sudo aptitude install apparmor apparmor-utils

and :

....

AppArmor parser error for /etc/apparmor.d/usr.sbin.mysqld in /etc/apparmor.d/usr.sbin.mysqld at line 44: Could not open 'local/usr.sbin.mysqld'

....

after I saw on which line of which file the problem is - I just saw there is this on the line:

#include <local/usr.sbin.mysqld>
--

then I saw local means - /etc/apparmor.d/local

then I got in there and just created an empty file named

touch usr.sbin.mysqld

and purged apparmor and installed it again...

now my mysql started ok...

Ivan Ivanov (ivan-lz) wrote :

short version of the above fix:
( my OS is Ubuntu 12.04 precise with mysql-server-5.5.22-0ubuntu1 )
--
sudo touch /etc/apparmor.d/local/usr.sbin.mysqld
sudo service apparmor restart
--

if that does not work:
--
sudo touch /etc/apparmor.d/local/usr.sbin.mysqld
sudo aptitude purge apparmor apparmor-utils
sudo aptitude install apparmor apparmor-utils
--

Josef Prause (josef-prause) wrote :

After upgrade to 12.04 I hit the same problem.
I used Ivan's solution, see #9, an the problem has been fixed.
Thanks, Ivan

Ivan Ivanov (ivan-lz) wrote :

so the question is - is it an apparmor bug or mysql's ?

The fix is quite easy - this should be fixed asap!

Alex Ross (rossey-d) wrote :

I had to add the /run/mysql/ directory to apparmor after upgrading to Ubuntu 12.04.3 LTS with 5.5.34-0ubuntu0.12.04.1

--
  /run/mysqld/ r,
  /run/mysqld/** rw,
--

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

Other bug subscribers