File Permissions: No such file or directory

Hello,

I could use some assistance with a snap that I am attempting to build. I have the snap building successfully, but the process that I am trying to run needs access to a specific directory, and I cannot seem to get the configuration right.

git clone git@github.com:jardon/mysql-server-snap.git
git checkout 48a244b0dd4b71fc96d813dfccda5b222bf40435
snapcraft pack
snap install ./*.snap --devmode
snap start mysql-server.mysqld
snap logs mysql-server.mysqld

This results in the following:

Nov 07 15:28:39 lagann mysql-server.mysqld[1066207]: mysqld: Error on realpath() on '/var/lib/mysql-files' (Error 2 - No such file or directory)
Nov 07 15:28:39 lagann mysql-server.mysqld[1066207]: 2022-11-07T20:28:39.278096Z 0 [ERROR] [MY-010095] [Server] Failed to access directory for --s>
Nov 07 15:28:39 lagann mysql-server.mysqld[1066207]: 2022-11-07T20:28:39.278121Z 0 [ERROR] [MY-010119] [Server] Aborting
Nov 07 15:28:39 lagann systemd[1]: snap.mysql-server.mysqld.service: Main process exited, code=exited, status=1/FAILURE

Based on what I am seeing, the folder, /snap/mysql-server/current/var/lib/mysql-files is owned by root in the snap, but the original permissions are given to the mysql user

total 0
drwxr-xr-x 6 root root   89 Nov  7 15:27 .
drwxr-xr-x 3 root root   26 Nov  7 15:27 ..
drwx------ 7 root root 1520 Nov  7 15:27 mysql
drwx------ 2 root root    3 Nov  7 15:15 mysql-files
drwx------ 2 root root    3 Nov  7 15:15 mysql-keyring
drwxr-xr-x 2 root root    3 Oct 19 07:35 mysql-upgrade

I tried changing the mysql-server configuration to use the root user instead, but I haven’t had any luck getting the behavior to change. Does anyone have any ideas?

try re-mapping the directory using a layout …