Categories Tags

Mysql Needs Swapfile

Today I was working on fixing up my continuous integration server (running GitLab’s CI multi-runner).  I was making my own custom image based off of the core Ubuntu 16.04 image and all was working perfectly except for the fact that the mysql service would not start up.

This bothered me.  I knew that I had the image working before I rebuilt the server, so why weren’t my images working now?  Reading through the error logs didn’t really tell me much, but it did end up pointing me in the right direction.

Turns out my host (the machine which was running the docker instance) didn’t have any swap space setup and because of that, the mysql service was not able to run.  So, to fix that I ran the following:

  1. Run dd if=/dev/zero of=/swapfile bs=1M count=1024
  2. Run mkswap /swapfile
  3. Run swapon /swapfile
  4. Add this line /swapfile swap swap defaults 0 0 to /etc/fstab

I can’t take the credit for the solution, but hopefully it saves you time!

Referencehttp://www.prowebdev.us/2012/05/amazon-ec2-linux-micro-swap-space.html

Posted in tools

Tags: