Starting MariaDB fails on my Ubuntu 19 installation after this:
nov 02 16:40:51 farnsworth systemd[1]: Starting MariaDB 10.3.17 database server...
nov 02 16:40:51 farnsworth mysqld[5328]: 2019-11-02 16:40:51 0 [Note] /usr/sbin/mysqld (mysqld 10.3.17-MariaDB-1) starting as process 5328 ...
nov 02 16:40:52 farnsworth audit[5328]: AVC apparmor="ALLOWED" operation="sendmsg" info="Failed name lookup - disconnected path" error=-13 profile="/usr/sbin/mysqld" name="run/systemd/notify" pid=5328 comm="mysqld" requested_mask="w" denied_mask="w" fsuid=123 ouid=0
nov 02 16:40:52 farnsworth audit[5328]: AVC apparmor="ALLOWED" operation="sendmsg" info="Failed name lookup - disconnected path" error=-13 profile="/usr/sbin/mysqld" name="run/systemd/notify" pid=5328 comm="mysqld" requested_mask="w" denied_mask="w" fsuid=123 ouid=0
nov 02 16:40:52 farnsworth systemd[1]: mariadb.service: Main process exited, code=exited, status=1/FAILURE
I have created an apparmor profile where I'm trying to make it allow /usr/sbin/mysqld
writing rights on run/systemd/notify
:
# Last Modified: Fri Nov 1 22:57:29 2019
#include <tunables/global>
# vim:syntax=apparmor
# AppArmor policy for mysqld
# ###AUTHOR###
# Redacted
# ###COPYRIGHT###
# 2019
# ###COMMENT###
# Ubuntu 19/MariaDB
# No template variables specified
/usr/sbin/mysqld flags=(complain) {
#include <abstractions/base>
#include <abstractions/evince>
#include <abstractions/nameservice>
/etc/mysql/conf.d/ r,
/etc/mysql/conf.d/mysql.cnf r,
/etc/mysql/conf.d/mysqldump.cnf r,
/etc/mysql/mariadb.cnf r,
/etc/mysql/mariadb.conf.d/ r,
/etc/mysql/mariadb.conf.d/50-client.cnf r,
/etc/mysql/mariadb.conf.d/50-mysql-clients.cnf r,
/etc/mysql/mariadb.conf.d/50-mysqld_safe.cnf r,
/etc/mysql/mariadb.conf.d/50-server.cnf r,
/run/systemd/notify w,
/usr/sbin/mysqld rk,
/var/lib/mysql/** rw,
/var/log/mysql/** r,
owner /var/lib/mysql/ r,
owner /var/lib/mysql/** rwk,
owner /var/log/mysql/** rw,
}
The funny thing is, the file MariaDB needs is /run/systemd/notify
(absolute path) while it requests writing rights to run/systemd/notify
(no starting slash, so relative path). But removing the slash makes the profile fail:
$ sudo apparmor_parser -r /etc/apparmor.d/usr.sbin.mysqld
AppArmor parser error for /etc/apparmor.d/usr.sbin.mysqld in /etc/apparmor.d/usr.sbin.mysqld at line 29: syntax error, unexpected TOK_ID, expecting TOK_MODE
However, when I put the profile in complain mode and then let apparmor find out if any changes are needed, it doesn't find any problems:
$ sudo aa-complain mysqld
Setting /usr/sbin/mysqld to complain mode.
$ sudo aa-logprof
Reading log entries from /var/log/audit/audit.log.
Updating AppArmor profiles in /etc/apparmor.d.
Complain-mode changes:
Does anyone know where the path to this this file is set?