Unable to run MySql in a Snapcraft Snap

I need to run MySql in a Snap for integration tests but I’m encountering some errors. Namely, this:

May 21 00:22:21 travis-job-3bb86edc-4914-4066-96be-8f71aaf9ca2e systemd[1]: Started Service for snap application slurm.mysql.
16666May 21 00:22:21 travis-job-3bb86edc-4914-4066-96be-8f71aaf9ca2e slurm.mysql[16023]: /bin/bash: warning: setlocale: LC_ALL: cannot change locale (en_US.UTF-8)
16667May 21 00:22:21 travis-job-3bb86edc-4914-4066-96be-8f71aaf9ca2e slurm.mysql[16023]: 2020-05-21T00:22:21.819810Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
16668May 21 00:22:21 travis-job-3bb86edc-4914-4066-96be-8f71aaf9ca2e slurm.mysql[16023]: 2020-05-21T00:22:21.890772Z 0 [ERROR] Can't change data directory owner to mysql
16669May 21 00:22:21 travis-job-3bb86edc-4914-4066-96be-8f71aaf9ca2e slurm.mysql[16023]: 2020-05-21T00:22:21.890812Z 0 [ERROR] Aborting
16670May 21 00:22:21 travis-job-3bb86edc-4914-4066-96be-8f71aaf9ca2e slurm.mysql[16023]: NOT NEW INSTALL
16671May 21 00:22:21 travis-job-3bb86edc-4914-4066-96be-8f71aaf9ca2e slurm.mysql[16023]: Starting MySQL
16672May 21 00:22:22 travis-job-3bb86edc-4914-4066-96be-8f71aaf9ca2e slurm.mysql[16023]: . * The server quit without updating PID file (/var/snap/slurm/common/var/run/mysql/mysql.pid).
16673May 21 00:22:22 travis-job-3bb86edc-4914-4066-96be-8f71aaf9ca2e systemd[1]: snap.slurm.mysql.service: Main process exited, code=exited, status=1/FAILURE
16674May 21 00:22:23 travis-job-3bb86edc-4914-4066-96be-8f71aaf9ca2e slurm.mysql[16913]: * MySQL server PID file could not be found!
16675May 21 00:22:23 travis-job-3bb86edc-4914-4066-96be-8f71aaf9ca2e systemd[1]: snap.slurm.mysql.service: Unit entered failed state.

Is there a limitation inside the TravisCI environment that prevents running MySql standalone or MySql in a container such as a Snap?

Please link to a build when reporting probems, or there’s not enough information for diagnostics.


AFAICS, you are trying to install MySQL in your own way, from some 3rd-party package, rather than use the stock instance that Travis provides and Travis-provided support logic for it.

In this case, you are responsible for this software package and it’s your job to diagnose and fix any problems that ensue.

Judging by the error message, Can't change data directory owner to mysql, you need to find out what that “data directory” is and either change its owner yourself, or make sure the service startup script has the rights to do so.

Yes I’m aware of that - which is why I’m asking the question, specifically the last paragraph of my question, in the first place.

There are no intentional “limitations”, it’s just not guaranteed to be compatible with arbitrary 3rd-party apps. Who knows what they expect to be present/not present on the system.

This snap also failed to start for me at a local Bionic VM.