The original error I had was this (on first "start") :
```
[ERROR] Could not open mysql.plugin table: "Table 'mysql.plugin' doesn't 
exist". Some plugins may be not loaded
[ERROR] Can't open and lock privilege tables: Table 'mysql.servers' doesn't 
exist
[Note] Server socket created on IP: '0.0.0.0', port: '3306'.
[ERROR] Fatal error: Can't open and lock privilege tables: Table 'mysql.db' 
doesn't exist
[ERROR] Aborting
```

`ls -al` in `/var/lib.mysql` returned this: (so the "mysql" database was
not created)

```
total 75812
drwxr-xr-x  2 mysql mysql     4096 May 20 18:47 .
drwxr-xr-x 56 root  root      4096 May 20 18:46 ..
-rw-rw----  1 mysql mysql    16384 May 20 18:47 aria_log.00000001
-rw-rw----  1 mysql mysql       52 May 20 18:47 aria_log_control
-rw-rw----  1 mysql mysql      706 May 20 18:47 ib_buffer_pool
-rw-rw----  1 mysql mysql 33554432 May 20 18:47 ib_logfile0
-rw-rw----  1 mysql mysql 12582912 May 20 18:47 ibdata1
-rw-rw----  1 mysql mysql 10485760 May 20 18:47 undo001
-rw-rw----  1 mysql mysql 10485760 May 20 18:47 undo002
-rw-rw----  1 mysql mysql 10485760 May 20 18:47 undo003
```

Trying to manually initialize the database produced this error:
```
# mariadb-install-db --user=mysql --datadir=/var/lib/mysql
Installing MariaDB/MySQL system tables in '/var/lib/mysql' ...
2026-05-20 18:52:37 0 [Warning] Can't create test file 
'/var/lib/mysql/myserver.lower-test' (Errcode: 13 "Permission denied")
/usr/sbin/mariadbd: Cannot change uid/gid (errno: 1)
2026-05-20 18:52:37 0 [ERROR] Aborting
```

It started working after this (I did not check to see if all lines are 
mandatory):
```
cat > /etc/apparmor.d/local/mariadbd << 'EOF'
# Local overrides for mariadbd
capability dac_override,
capability dac_read_search,
capability setgid,
capability setuid,

/var/log/mysql.err rw,
/var/log/mysql/ rw,
/var/log/mysql/** rw,

/var/lib/mysql/ r,
/var/lib/mysql/** rwk,
EOF
```

-- 
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/2153455

Title:
  Apparmor blocks mariadb-server initialization when /var/lib/mysql is
  mounted using an LVM volume

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/mariadb/+bug/2153455/+subscriptions


-- 
ubuntu-bugs mailing list
[email protected]
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

Reply via email to