mysql cannot be started in Mgt Development Environ

2019-06-13 02:01发布

问题:

I found this error on a fresh install of the Docker container provided by Mgt Development Environment:

root@mgt-dev-70:~# /etc/init.d/mysql start
/usr/sbin/mysqld: error while loading shared libraries: libpthread.so.0: cannot open shared object file: Permission denied
[....] Starting MySQL (Percona Server) database server: mysqld/usr/sbin/mysqld: error while loading shared libraries: libpthread.so.0: cannot open shared object file: Permission denied
/usr/sbin/mysqld: error while loading shared libraries: libpthread.so.0: cannot open shared object file: Permission denied
 ./usr/sbin/mysqld: error while loading shared libraries: libpthread.so.0: cannot open shared object file: Permission denied
 ./usr/sbin/mysqld: error while loading shared libraries: libpthread.so.0: cannot open shared object file: Permission denied

I used this tutorial https://www.mgt-commerce.com/documentation/mgt-development-environment-run-container and I pulled mgtcommerce/mgt-development-environment-7.0

回答1:

As we see it is a problem with apparmor.

[192088.261031] audit: type=1400 audit(1516074899.710:1304): apparmor="DENIED" operation="open" info="Failed name lookup - disconnected path" error=-13 profile="/usr/sbin/mysqld" name="var/lib/docker/aufs/diff/e5182def06a6a8b8d08c0a6d0c3a439585d2e7aea90507c245d421c319431d51/lib/x86_64-linux-gnu/libpthread-2.19.so" pid=18970 comm="mysqld" requested_mask="r" denied_mask="r" fsuid=0 ouid=0
[192088.261039] audit: type=1400 audit(1516074899.710:1305): apparmor="DENIED" operation="getattr" info="Failed name lookup - disconnected path" error=-13 profile="/usr/sbin/mysqld" name="var/lib/docker/aufs/diff/e5182def06a6a8b8d08c0a6d0c3a439585d2e7aea90507c245d421c319431d51/lib/x86_64-linux-gnu" pid=18970 comm="mysqld" requested_mask="r" denied_mask="r" fsuid=0 ouid=0
[192088.261066] audit: type=1400 audit(1516074899.710:1306): apparmor="DENIED" operation="getattr" info="Failed name lookup - disconnected path" error=-13 profile="/usr/sbin/mysqld" name="var/lib/docker/aufs/diff/e5182def06a6a8b8d08c0a6d0c3a439585d2e7aea90507c245d421c319431d51/usr/lib/x86_64-linux-gnu" pid=18970 comm="mysqld" requested_mask="r" denied_mask="r" fsuid=0 ouid=0
[192088.261083] audit: type=1400 audit(1516074899.710:1307): apparmor="DENIED" operation="getattr" info="Failed name lookup - disconnected path" error=-13 profile="/usr/sbin/mysqld" name="var/lib/docker/aufs/diff/e5182def06a6a8b8d08c0a6d0c3a439585d2e7aea90507c245d421c319431d51/lib" pid=18970 comm="mysqld" requested_mask="r" denied_mask="r" fsuid=0 ouid=0
[192088.261103] audit: type=1400 audit(1516074899.710:1308): apparmor="DENIED" operation="getattr" info="Failed name lookup - disconnected path" error=-13 profile="/usr/sbin/mysqld" name="var/lib/docker/aufs/diff/e5182def06a6a8b8d08c0a6d0c3a439585d2e7aea90507c245d421c319431d51/usr/lib" pid=18970 comm="mysqld" requested_mask="r" denied_mask="r" fsuid=0 ouid=0

You can fix it by log in the container and run the commands below.

mv /usr/sbin/mysqld /usr/bin/mysqld
ln -nfs /usr/bin/mysqld /usr/sbin/mysqld


标签: mysql docker