Skip to content

Add AppArmor notice for Debian/Ubuntu users during server startup#5003

Open
ottok wants to merge 1 commit intoMariaDB:mainfrom
ottok:feature/apparmor-notice
Open

Add AppArmor notice for Debian/Ubuntu users during server startup#5003
ottok wants to merge 1 commit intoMariaDB:mainfrom
ottok:feature/apparmor-notice

Conversation

@ottok
Copy link
Copy Markdown
Contributor

@ottok ottok commented Apr 28, 2026

When MariaDB fails to start due to permission errors, users on Debian/Ubuntu might not be able to guess that AppArmor might be the cause, and they should check for AppArmor denials in the kernel audit log.

Add an informational message during startup that:

  • Only prints when the 'mariadbd' profile is actually loaded
  • Includes exact commands from the Debian packaging NEWS
  • Provides actionable paths for local overrides
  • Mentions both complain and enforce modes for troubleshooting

The message is printed once during normal server startup (not in help or bootstrap modes) through the existing logging infrastructure, ensuring it appears in both syslog and the error log where users will see it when troubleshooting startup failures.

This has been in Debian since MariaDB 1:11.8.6-6 via https://salsa.debian.org/mariadb-team/mariadb-server/-/commit/0a896117012567f2325675442be199180eb20a95 and no regressions have been reported. Having this upstream will pave the way to also have the actual new AppArmor profile upstream, as this notice helps users understand what might be breaking their MariaDB instance.

When MariaDB fails to start due to permission errors, users on
Debian/Ubuntu might not be able to guess that AppArmor might be the
cause, and they should check for AppArmor denials in the kernel audit
log.

Add an informational message during startup that:
- Only prints when the 'mariadbd' profile is actually loaded
- Includes exact commands from the Debian packaging NEWS
- Provides actionable paths for local overrides
- Mentions both complain and enforce modes for troubleshooting

The message is printed once during normal server startup (not in help or
bootstrap modes) through the existing logging infrastructure, ensuring
it appears in both syslog and the error log where users will see it when
troubleshooting startup failures.
Comment thread sql/mysqld.cc
*/
if (!opt_help && !opt_bootstrap)
{
MY_STAT stat_info;
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no point stat testing before an open. Just open and handle the ENOENT case, which we're just ignoring anyway.

Comment thread sql/mysqld.cc
if (mariadb_profile_active)
{
sql_print_information(
"AppArmor profile 'mariadbd' is active. "
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is rather verbose for an unconditional start case.

Could be be reduced with a link https://mariadb.com/docs/server/server-management/starting-and-stopping-mariadb/what-to-do-if-mariadb-doesnt-start#apparmor and an extended FAQ o that URL (like what selinux has)?

While it will miss a few cases does putting this as part of a fatal shutdown it useful enough?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Development

Successfully merging this pull request may close these issues.

3 participants