[Bug 201799] [NEW] Confusing mysqld startup failure with apparmor (Hardy)
Emilis Dambauskas
emilis.d at gmail.com
Thu Mar 13 14:11:11 GMT 2008
Public bug reported:
DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=8.04
DISTRIB_CODENAME=hardy
DISTRIB_DESCRIPTION="Ubuntu hardy (development branch)"
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/daemon.log. See [1].
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=/home/mysql
and so on.
Suggested fixes:
- Include a "# WARNING: you may have to adjust apparmor settings in
/etc/apparmor.d/usr.sbin.mysqld if you change default directory and file
paths." in /etc/mysql/my.cnf .
- 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/daemon.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/emilis-laptop.lower-test
Mar 13 15:07:42 emilis-laptop mysqld[26180]: 080313 15:07:42 [Warning] Can't create test file /home/mysql/emilis-laptop.lower-test
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.d/mysql[26347]: 0 processes alive and '/usr/bin/mysqladmin --defaults-file=/etc/mysql/debian.cnf ping' resulted in
Mar 13 15:07:56 emilis-laptop /etc/init.d/mysql[26347]: ^G/usr/bin/mysqladmin: connect to server at 'localhost' failed
Mar 13 15:07:56 emilis-laptop /etc/init.d/mysql[26347]: error: 'Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)'
Mar 13 15:07:56 emilis-laptop /etc/init.d/mysql[26347]: Check that mysqld is running and that the socket: '/var/run/mysqld/mysqld.sock' exists!
Mar 13 15:07:56 emilis-laptop /etc/init.d/mysql[26347]:
[2] /var/log/kern.log:
Mar 13 15:07:42 emilis-laptop kernel: [16748.861107] audit(1205413662.100:3): operation="inode_create" request_mask="w::" denied_mask="w::" name="/home/mysql/emilis-laptop.lower-test" pid=26179 profile="/usr/sbin/mysqld" namespace="default"
Mar 13 15:07:42 emilis-laptop kernel: [16748.861333] audit(1205413662.104:4): operation="inode_create" request_mask="w::" denied_mask="w::" name="/home/mysql/emilis-laptop.lower-test" pid=26179 profile="/usr/sbin/mysqld" namespace="default"
Mar 13 15:07:42 emilis-laptop kernel: [16748.884899] audit(1205413662.124:5): operation="inode_permission" request_mask="rw::" denied_mask="rw::" name="/home/mysql/ibdata1" pid=26179 profile="/usr/sbin/mysqld" namespace="default"
** Affects: apparmor (Ubuntu)
Importance: Undecided
Status: New
** Affects: mysql-dfsg-5.0 (Ubuntu)
Importance: Undecided
Status: New
** Also affects: apparmor (Ubuntu)
Importance: Undecided
Status: New
--
Confusing mysqld startup failure with apparmor (Hardy)
https://bugs.launchpad.net/bugs/201799
You received this bug notification because you are a member of Ubuntu
Server Team, which is subscribed to mysql-dfsg-5.0 in ubuntu.
More information about the Ubuntu-server-bugs
mailing list