5

I want to install php5-imap php5-ldap php5-curl

sudo apt-get install php5-imap php5-ldap php5-curl

I get this error:

AppArmor parser error for /etc/apparmor.d/usr.sbin.mysqld in /etc/apparmor.d/usr.sbin.mysqld at line 9: Could not open 'abstractions/mysql'

How can this problem be resolved?

4 Answers4

4

You are missing the file abstractions/mysql. This happened to me when I tried to completely remove MySQL before reinstalling it. I fixed this issue by replacing the file with a copy from another server. The contents of my file looks something like this:

# ------------------------------------------------------------------
#
#    Copyright (C) 2002-2006 Novell/SUSE
#    Copyright (C) 2013 Christian Boltz
#
#    This program is free software; you can redistribute it and/or
#    modify it under the terms of version 2 of the GNU General Public
#    License published by the Free Software Foundation.
#
# ------------------------------------------------------------------

   /var/lib/mysql{,d}/mysql{,d}.sock rw,
   /{var/,}run/mysql{,d}/mysql{,d}.sock rw,
   /usr/share/{mysql,mysql-community-server,mariadb}/charsets/ r,
   /usr/share/{mysql,mysql-community-server,mariadb}/charsets/*.xml r,

Try creating the file and adding the above contents with:

sudo nano /etc/apparmor.d/abstractions/mysql
user2395126
  • 280
  • 2
  • 8
1

This worked for me: (source: https://forum.snapcraft.io/t/unable-to-install-snap-from-store-or-locally/4629/15)

First remove apparmor and snapd (in my case the error was related to snapd, I don't think you have to remove it in your case)

sudo apt-get purge apparmor
sudo apt-get purge apparmor-profiles
sudo apt-get purge apparmor-utils
sudo apt-get remove snapd snapd-confine

Now Install back them all (again, you may not need to install snapd):

sudo apt-get install apparmor-utils
sudo apt install apparmor-profiles apparmor-profiles-extra vim-addon-manager
sudo apt install snapd snapd-login-service snap-confine 
Andrew F.
  • 111
1

See if the Ubuntu wiki helps : https://wiki.ubuntu.com/DebuggingApparmor

Specifically,

When debugging, it may also be useful to put apparmor into 'complain' mode. This will allow your application to function normally while apparmor reports accesses that are not in the profile. To enable 'complain' mode, use:

sudo aa-complain /path/to/bin

where '/path/to/bin' is the absolute path to the binary, as reported in the 'profile=...' portion of the 'audit' entry. Eg:

sudo aa-complain /usr/sbin/slapd

To re-enable enforcing mode, use 'aa-enforce' instead:

sudo aa-enforce /path/to/bin

To disable a profile:

sudo touch /etc/apparmor.d/disable/path.to.bin
sudo apparmor_parser -R /etc/apparmor.d/path.to.bin

To disable a profile in Ubuntu 10.10 and earlier:

sudo touch /etc/apparmor.d/disable/path.to.bin sudo apparmor_parser -R /etc/apparmor.d/path.to.bin

in 11.04 and later:

sudo aa-disable /etc/apparmor.d/path.to.bin

To disable all of AppArmor for testing purposes, boot with apparmor=0 on the kernel command line.

belacqua
  • 23,120
0

It is an old question, but maybe someone will find it useful.

Sometimes pieces of application are split in separate packages. Same goes for apparmor profiles. They are split in packages apparmor-profiles and apparmor-profiles-extra. So, if you have some profiles missing, install apparmor-profiles-extra.

Sergey
  • 251