Public bug reported:

If you purge MySQL 5.7 server, then install MariaDB 10.1, that last
won't start due to wrong AppArmor profile.

CURRENT RESULT ON mariadb-server-10.1 package installation

...
Job for mariadb.service failed because a timeout was exceeded.
See "systemctl status mariadb.service" and "journalctl -xe" for details.
...

# LANG=C systemctl status mariadb

* mariadb.service - MariaDB 10.1.34 database server
   Loaded: loaded (/lib/systemd/system/mariadb.service; enabled; vendor preset: 
enabled)
   Active: failed (Result: timeout) since Sun 2018-12-02 17:26:09 UTC; 59s ago
     Docs: man:mysqld(8)
           https://mariadb.com/kb/en/library/systemd/
 Main PID: 23245 (code=exited, status=0/SUCCESS)

Dec 02 17:24:37 bionic systemd[1]: Starting MariaDB 10.1.34 database server...
Dec 02 17:24:37 bionic mysqld[23245]: 2018-12-02 17:24:37 139820621216896 
[Note] /usr/sbin/mysqld (mysqld 10.1.34-MariaDB-0ubuntu0.18.04.1) starting as 
process 23245 ...
Dec 02 17:26:07 bionic systemd[1]: mariadb.service: Start operation timed out. 
Terminating.
Dec 02 17:26:09 bionic systemd[1]: mariadb.service: Failed with result 
'timeout'.
Dec 02 17:26:09 bionic systemd[1]: Failed to start MariaDB 10.1.34 database 
server.


EXPECTED RESULT

MariaDB 10.1 server starting as expected.

HOWTO REPRODUCE

apt-get install mysql-server-5.7 mysql-client-5.7
apt-get purge mysql-server-5.7 mysql-client-5.7
apt-get install mariadb-server-10.1 mariadb-client-10.1

DISCUSSION

The mysql-server-5.7 package install an /etc/apparmor.d/usr.sbin.mysqld
APPARMOR(7) profile:

# dpkg -S /etc/apparmor.d/usr.sbin.mysqld 
mysql-server-5.7: /etc/apparmor.d/usr.sbin.mysqld

When purging the mysql-server-5.7 server package get purged, the
/etc/apparmor.d/usr.sbin.mysqld profile is also removed but, it is still
loaded:

# aa-status | grep 'mysqld'
   /usr/sbin/mysqld

This lead to MariaDB 1.0 server not being able to start due to MySQL 5.7
APPARMOR(7) profile that is still loaded.

Furthermore, the mariadb-server-10.1 also comes with an APPARMOR(7)
profile which as per it header comments is "intensionally empty to
disable apparmor by default for newer versions of MariaDB".

This is a big mistake as such a profile is simply wrong in regard of
APPARMOR_PARSER(8) and as such, won't be unloaded:

# apparmor_parser -v -R /etc/apparmor.d/usr.sbin.mysqld
# aa-status | grep 'mysqld'
   /usr/sbin/mysqld

while:

# echo "/usr/sbin/mysqld { }" > /etc/apparmor.d/usr.sbin.mysqld
# apparmor_parser -v -R /etc/apparmor.d/usr.sbin.mysqld
Removal succeeded for "/usr/sbin/mysqld".
# aa-status | grep 'mysqld'

FIX PROPOSAL

1. When mysql-server-5.7 package is being removed/purged, the APPARMOR(7) 
profile should be unloaded and removed ranther than be simply removed.
2. The profile provided by the mariadb-server-10.1 package should have correct 
syntax in regard of APPARMOR_PARSER(8)
3. The mariadb-server-10.1 package postinst/postrm maintainer scripts should 
handle apparmor profile (load/unload)

Env Ubuntu Bionic Beaver (18.04)

** Affects: mariadb-10.1 (Ubuntu)
     Importance: Undecided
         Status: New

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

Title:
  MariaDB 10.1 server won't start when MySQL 5.7 server has been
  previously installed

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

-- 
ubuntu-bugs mailing list
ubuntu-bugs@lists.ubuntu.com
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

Reply via email to