Confusing mysqld startup failure with apparmor (Hardy)
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
apparmor (Ubuntu) |
Invalid
|
Undecided
|
Unassigned | ||
mysql-dfsg-5.0 (Ubuntu) |
Fix Released
|
Undecided
|
Jamie Strandboge | ||
Bug Description
DISTRIB_ID=Ubuntu
DISTRIB_
DISTRIB_
DISTRIB_
Binary package hint: mysql-common
Installed: 5.0.51a-3ubuntu1
Binary package hint: apparmor
Installed: 2.1+1075-0ubuntu5
Steps to reproduce:
- $ sudo cp -pr /var/lib/mysql /home/mysql
- change datadir value in /etc/mysql/my.cnf to /home/mysql
- $ sudo /etc/init.d/mysql restart
Result:
- * Starting MySQL database server mysqld [fail]
- Errors in /var/log/
What's wrong:
- There is no information for the user on why startup REALLY failed (apparmor prevented mysqld from writing to /home/mysql) -- nowhere in /var/log/ you'll find a line about apparmor.
- There is some output in /var/log/kern.log , but that doesn't say much (see [2]). All available information points to file permissions, but file permissions in fact are OK. So that is very confusing.
- The only hint I found related to apparmor when googling was in Bug #197476 which barely seems related by its title.
- The same problem can be reproduced in other ways:
$ mysqld --datadir=
and so on.
Suggested fixes:
- Include a "# WARNING: you may have to adjust apparmor settings in /etc/apparmor.
- Provide logs for apparmor in /var/log that can be grep'ed for "mysqld" and would clearly indicate that this is an apparmor issue ("audit" is not specific enough). Maybe I should file another bug for that? Because that may affect other packages.
Logs:
[1] /var/log/
Mar 13 15:07:42 emilis-laptop mysqld_safe[26177]: started
Mar 13 15:07:42 emilis-laptop mysqld[26180]: 080313 15:07:42 [Warning] Can't create test file /home/mysql/
Mar 13 15:07:42 emilis-laptop mysqld[26180]: 080313 15:07:42 [Warning] Can't create test file /home/mysql/
Mar 13 15:07:42 emilis-laptop mysqld[26180]: 080313 15:07:42 InnoDB: Operating system error number 13 in a file operation.
Mar 13 15:07:42 emilis-laptop mysqld[26180]: InnoDB: The error means mysqld does not have the access rights to
Mar 13 15:07:42 emilis-laptop mysqld[26180]: InnoDB: the directory.
Mar 13 15:07:42 emilis-laptop mysqld[26180]: InnoDB: File name ./ibdata1
Mar 13 15:07:42 emilis-laptop mysqld[26180]: InnoDB: File operation call: 'open'.
Mar 13 15:07:42 emilis-laptop mysqld[26180]: InnoDB: Cannot continue operation.
Mar 13 15:07:42 emilis-laptop mysqld_safe[26188]: ended
Mar 13 15:07:56 emilis-laptop /etc/init.
Mar 13 15:07:56 emilis-laptop /etc/init.
Mar 13 15:07:56 emilis-laptop /etc/init.
Mar 13 15:07:56 emilis-laptop /etc/init.
Mar 13 15:07:56 emilis-laptop /etc/init.
[2] /var/log/kern.log:
Mar 13 15:07:42 emilis-laptop kernel: [16748.861107] audit(120541366
Mar 13 15:07:42 emilis-laptop kernel: [16748.861333] audit(120541366
Mar 13 15:07:42 emilis-laptop kernel: [16748.884899] audit(120541366
Thank you for using Ubuntu and taking the time to report a bug. It is planned to add extra information to both the profiles, the README.Debian and the configuration files for apparmor enforcing profiles. This should happen sometime after Beta is released.