Skip to content
This repository has been archived by the owner on Jun 10, 2019. It is now read-only.

MySQL unusable after installation due to permissions on /tmp #322

Open
brett-smith opened this issue May 11, 2016 · 3 comments
Open

MySQL unusable after installation due to permissions on /tmp #322

brett-smith opened this issue May 11, 2016 · 3 comments

Comments

@brett-smith
Copy link

Any image produced by bootstrap-vz that includes MySQL, while the package itself is actually installed, it does not correctly configure the default database.

The initial symptoms of this were that it was impossible to connect to the database using the root user. Normally, non-interactive installations of MySQL result in an empty string for the root password. However, this appeared to not be the case for here, no matter what password I tried nothing would work. The only way I found to correct this was to purge the mysql-server package and re-install it.

This was tracked down to this error in the boostrap log during the mysql-server postinst script..

/usr/sbin/mysqld: Can't create/write to file '/tmp/some_name'

That led me here - http://dev.mysql.com/doc/refman/5.7/en/cannot-create.html - and it seemed that permissions were most likely the issue. So, I wrote a little plugin ..

from bootstrapvz.base import Task
from bootstrapvz.common import phases
from bootstrapvz.common.tasks import packages

class FixTmp(Task):
    description = 'Fixing /tmp'
    phase = phases.package_installation
    successors = [packages.InstallPackages]

    @classmethod
    def run(cls, info):
        from bootstrapvz.common.tools import log_check_call
        if not info.manifest.plugins['fixtmp']['enabled']: 
            log_check_call(['chroot', info.root, 'chmod', 'a+rwx', '/tmp']

This did indeed fix the issue, and I now have a working MySQL installation. It sounds like this is probably best off something done by the core of bootstrap-vz though.

@liori
Copy link
Contributor

liori commented Apr 23, 2017

Are you using the minimize_size plugin too? I found a similar problem and it turned out that without having this plugin bind-mount /tmp its permissions were correct.

@andsens
Copy link
Owner

andsens commented Apr 23, 2017

@liori, oh that is interesting! I am however puzzled as to why this would change the permissions on /tmp, since we explicitly mount bind /tmp after bootstrapping, where all the necessary rights have been set:

predecessors = [bootstrap.Bootstrap]

@liori
Copy link
Contributor

liori commented Apr 23, 2017

Indeed, and the bind-mounted directory created in the line 21 of the same file for some reason or another created a directory with permissions 0755. I am not sure why this happens yet—it even made apt-get update few tasks later fail for me…

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants