How to Completely Disable ‘AppArmor’ Security Service in Ubuntu for Troubleshooting

AppArmor is a Mandatory Access Control (MAC) system deeply integrated into the Linux kernel and heavily utilised by Ubuntu. It acts as a strict security guard, binding programs to a specific set of rules (profiles) that dictate exactly which files they can read, write, or execute. If a program attempts to access a file outside of its assigned AppArmor profile, the kernel will instantly block the action, even if the user running the program is the root administrator.

While AppArmor is absolutely critical for server security, it is often the primary suspect when complex third-party software, custom database installations (like MySQL or MariaDB), or advanced virtualization tools (like Docker or KVM) mysteriously fail with “Permission Denied” errors despite having correct standard file permissions. To determine if AppArmor is the cause of your issue, you can completely disable the entire security module. Warning: This should only be done temporarily for troubleshooting purposes; running a production machine without AppArmor significantly reduces its security posture.

Disabling AppArmor via Systemd and Kernel Parameters

Because AppArmor is a kernel module, you cannot just uninstall it. You must disable its system service and instruct the GRUB bootloader to stop loading it into the kernel at startup.

  1. Open a Terminal window (Ctrl + Alt + T).
  2. First, stop the running service and disable it from launching on boot by typing the following commands (press Enter after each and provide your password):
    sudo systemctl stop apparmor
    sudo systemctl disable apparmor
  3. Next, you must remove the AppArmor parameters from the boot configuration. Open the GRUB file in a text editor:
    sudo nano /etc/default/grub
  4. Look for the line that begins with GRUB_CMDLINE_LINUX_DEFAULT=. It will likely contain the words apparmor=1 security=apparmor inside the quotation marks.
  5. Carefully delete apparmor=1 security=apparmor from that line. Ensure you leave other parameters like quiet splash intact.
  6. Add a new parameter to explicitly disable it. Add apparmor=0 inside the quotation marks. The final line should look something like:
    GRUB_CMDLINE_LINUX_DEFAULT="quiet splash apparmor=0"
  7. Save the file (Ctrl + O, then Enter) and exit the editor (Ctrl + X).

Updating GRUB and Rebooting

You have edited the text file, but you must compile those changes into the actual bootloader before they take effect.

  1. In the terminal, run the following command to update GRUB:
    sudo update-grub
  2. Once the update is complete, restart your computer:
    sudo reboot

Upon reboot, your Ubuntu system will start completely devoid of AppArmor protections. You can now test your failing software. If the software now works perfectly, you know you need to generate or modify a specific AppArmor profile for that application rather than leaving the entire system unprotected forever.

Get the best tech tips delivered straight to your inbox.

Join thousands of readers mastering Apple, Google, Microsoft, and Linux.