[systemd-devel] nspawn and mariadb /run/mysql
Lennart Poettering
lennart at poettering.net
Tue Jun 16 07:33:18 UTC 2020
On Di, 21.04.20 10:40, Damian Ivanov (damianatorrpm at gmail.com) wrote:
> 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?
This sounds like an OS packaging bug of mariadb. Usually they should
ship tmpfiles.d snippets so that all necessary files in /run/ are
created. Similar, they either should create all users or provide a
sysusers.d snippet to have it created automatically on first boot.
Ether way, this smells as if you should report it to your OS vendor.
Lennart
--
Lennart Poettering, Berlin
More information about the systemd-devel
mailing list