Comment 5 for bug 986892

Revision history for this message
Malcolm Scott (malcscott) wrote : Re: Error in AppArmor rule for mysqld

As per bug #978995 this happens when an older mysql-server-* package, e.g. mysql-server-5.1, is purged post-upgrade.

The problem seems to be in dh_apparmor, which added the following to mysql-server-5.1.postrm:

# Automatically added by dh_apparmor
if [ "$1" = "purge" ]; then
    rm -f "/etc/apparmor.d/disable/usr.sbin.mysqld" || true
    rm -f "/etc/apparmor.d/force-complain/usr.sbin.mysqld" || true
    rm -f "/etc/apparmor.d/local/usr.sbin.mysqld" || true
    rmdir /etc/apparmor.d/local 2>/dev/null || true
fi
# End automatically added section

...which will remove config files which should not be removed as they continue to be used by mysql-server-5.5.

I'm not sure why dh_apparmor does not install /etc/apparmor.d/local/[profile] as a dpkg conffile; I suspect if it did this problem would not occur. Alternatively, the postrm script already works around this problem for dh_installinit, and this approach could also work for dh_apparmor.