mysql socket disappears when restarting related jail with nullfs mount point

MJ mafsys1234 at
Sat Oct 12 23:42:16 UTC 2019

On 11/10/2019 1:42 am, Luis P. Mendes wrote:
> I'm running FreeBSD 11.3-RELEASE-p3 on a VPS.
> The jail manager is qjail, version 5.4.
> The server has two jails: a database `mariadb` and a web `webjail`.
> Access to the database is done only through a unix socket to be null
> mounted at the latter jail.
> When started, 'service mysql-server start' on the `mariadb` jail
> places the socket at /var/run/mysql/mysql.sock
> When started, the `webjail` should mount that socket in its own
> /var/run/mysql directory.
> This is the line of the corresponding
> /usr/local/etc/qjail.fstab/webjail file:
> /usr/jails/mariadb/var/run/mysql  /usr/jails/webjail/var/run/mysql
> nullfs  rw  0  0
> What happens is that everytime that the `webjail` is started (the
> first time or when restarted), the socket at `mariadb`'s
> /var/run/mysql/mysql.sock
> is deleted somehow.
> Although this happens, the mysqld_safe and mysqld daemons keep
> running.

If you observe the mysql.sock after starting mariadb, then start and stop webjail, is the mysql.sock(et) still there?

The reason I ask is I would expect mysql to complain bitterly about the socket having gone away but as you state it continues to run. Odd.

Is there anything in the mysql error log? ('normally' located in the mysql data directory)

> If the `mariadb` jail is started after `webjail`, the socket is
> correctly mounted at the latter /var/run/mysql directory.

It's almost like the scenario of "create a file in a directory, then mount that directory, file has 'gone'". This is counter-intuitive to nullfs.




More information about the freebsd-questions mailing list