What is enabling mariadb on first boot

A bit of background on what I'm trying to do: We are building an Ubuntu image that we deploy to thousands of workstations. We need to have MariaDB available on the workstations, but we only want it started when needed, to not negatively affect the boot time on machines that it is not needed.

So my plan was to do a systemctl disable mariadb.service when we build the image, and then start it via an agent that knows when it is needed. I've checked that systemctl disable mariadb.service removes the .wants symlink:

Removed /etc/systemd/system/multi-user.target.wants/mariadb.service.
Removed /etc/systemd/system/mysqld.service.
Removed /etc/systemd/system/mysql.service.

And I have confirmed that /etc/systemd/system/multi-user.target.wants/mariadb.service does not exist in the image.

However when we boot the image, the mariadb.service is enabled, as per the output of systemctl status mariadb and /etc/systemd/system/multi-user.target.wants/mariadb.service exist. There seems to something that enables it on first boot. I would like to know what does this, so I can disable it from happening.

I've had a look though the files listed in dpkg -L mariadb-server-10.3 mariadb-server-core-10.3 but have not found anything.


It was being enabled by systemd-preset

I was able prevent this from happening by adding this file:

# /etc/systemd/system-preset/10-mariadb.preset

disable mariadb.service