1. This exposes a logging failure as well. The mysql error log gives no clue that the problem binding the socket stems from apparmor. The mysql error output and associated documentation should offer enough information to distinguish the cause of the permission denial.
2. In the course of trying to fix this, I ran into another bug-- the stop script for the mysql service does not work properly. It was especially problematic when I attempted to reinstall mysql at one point using Synaptic, and it hung trying to stop mysqld. My workaround was to temporarily rename /usr/sbin/mysqld, which allowed /usr/bin/mysqld_safe to fail cleanly, and Synaptic was able to complete the reinstall. I expect that the problem was at the dpkg level, not specific to a GUI front end package manger. See (2) below for detail. --- Detail --- 1) Error log in mysql not informative enough I had mysql fail from this cause after upgrading an ubuntu machine to oneiric. After checking the mysql log and confirming that no other mysql instance was running, I began with a google search for the error and a look at the mysql documentation. These led me to check for mysql user and directory permissioning issues. When this did not resolve the problem, I lost considerable time rechecking permissions, tracing configuration files and startup scripts, reinstalling/repermissioning the mysql user and directories, etc. to no avail. I grant in hindsight that after checking mysql's error.log, I should have checked dmesg for syslogd output (see below). This would at least have pointed me towards apparmor as a potential root cause. However, I think many users will not know to do this, as demonstrated by threads in other forums where users appear to still be stuck (I will be referring them to this bug). # dmesg . . . [ 671.841551] type=1400 audit(1321280685.638:63): apparmor="STATUS" operation="profile_replace" name="/usr/sbin/mysqld" pid=5696 comm="apparmor_parser" [ 671.912172] type=1400 audit(1321280685.710:64): apparmor="DENIED" operation="mknod" parent=1 profile="/usr/sbin/mysqld" name="/run/mysqld/mysqld.sock" pid=5700 comm="mysqld" requested_mask="c" denied_mask="c" fsuid=115 ouid=115 [ 677.140067] init: mysql main process (5700) terminated with status 1 . . . 2) The ubuntu startup process eventually launches /usr/bin/mysqld_safe, which attempts to restart /usr/sbin/mysqld each time it fails. Hence, when mysqld cannot bind the socket due to the problem in /etc/apparmor.d/usr.sbin.mysqld and exits, mysqld_safe restarts it. It looks like the control scripts do not work as expected because they do not stop mysqld_safe. Neither "stop mysql" nor "/etc/init.d/mysql stop" (as root) work properly. -- You received this bug notification because you are a member of Ubuntu Server Team, which is subscribed to mysql-5.1 in Ubuntu. https://bugs.launchpad.net/bugs/876268 Title: Mysqld does not start: Bind on unix socket: Permission denied To manage notifications about this bug go to: https://bugs.launchpad.net/ubuntu/+source/mysql-5.1/+bug/876268/+subscriptions -- Ubuntu-server-bugs mailing list Ubuntu-server-bugs@lists.ubuntu.com Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/ubuntu-server-bugs