[systemd-devel] nspawn and mariadb /run/mysql

Damian Ivanov damianatorrpm at gmail.com
Tue Apr 21 07:40:21 UTC 2020


Hi,

After bootstrapping os and mariadb into $DIR
I booted the machine with:
systemd-nspawn -D  $DIR -b --resolv-conf=bind-host --capability=all
I had to remove  $DIR/etc/resolv.conf first as bind-host seems to fail
if $DIR/etc/resolv.conf already exists.

mariadb.service was failing, after looking into mysql.log
I found that /run/mysql/mysql.sock (No such file or directory)

/run is a temporary dir inside nspawn and not the actual $DIR/run
So I went ahead and created /run/mysql (which of course is gone when
the container is stopped)
For mariadb to work it is also required to chown -R mysql:mysql /run/mysql
which results in chown complaing no such group mysql

The group is in /etc/groups and another attempt to add groupadd mysql
would faill saying that the group exists. Using chmod -R 777 /run/mysql worked.

Is there some permanent solution to have mariadb work,
without recreating /run/mysql at container boot and even better with
groups working?

I tried various combinations of --private-users=pick --private-users-chown
They result in machinectl --machine $DIR shell to fail
(org.freedesktop.machine1 not provided by anything) and the root
password never being accepted if on the container bootscreen.

#systemctl --version
systemd 245 (+suse.83.gc5aa158173

Ideas appreciated.

Br,
Damian


More information about the systemd-devel mailing list