AppArmor is a security module for Ubuntu and Debian that enhances system security through mandatory access control. However, in certain situations, AppArmor’s restrictions may cause complications, making it necessary to disable or remove it. This is especially relevant in environments requiring high flexibility or specific application permissions.

System administrators can use systemd to manage AppArmor, including stopping and disabling the service. Disabling AppArmor involves stopping its service, preventing it from starting at boot, and potentially removing the AppArmor package and its dependencies. It is crucial to understand the security implications of disabling AppArmor, as it reduces system protection.

Disabling or removing AppArmor is generally not recommended for production systems due to the security risks. This process is more suitable for development environments or desktop systems where flexibility is prioritized. Ensure you understand the potential impacts, including the reinstallation of AppArmor by packages like snapd if removed.

Steps to disable and remove AppArmor in Ubuntu and Debian:

  1. Open your preferred terminal application.
  2. Stop apparmor service using systemd.
    $ sudo systemctl stop apparmor
  3. Disable apparmor from starting on system boot.
    $ sudo systemctl disable apparmor
    Synchronizing state of apparmor.service with SysV service script with /usr/lib/systemd/systemd-sysv-install.
    Executing: /usr/lib/systemd/systemd-sysv-install disable apparmor
    Removed "/etc/systemd/system/sysinit.target.wants/apparmor.service".
  4. Remove apparmor package and its dependencies using apt (optional).
    $ sudo apt remove --assume-yes --purge apparmor
    Reading package lists... Done
    Building dependency tree       
    Reading state information... Done
    The following packages will be REMOVED:
      apparmor* snapd*
    0 upgraded, 0 newly installed, 2 to remove and 0 not upgraded.
    After this operation, 122 MB disk space will be freed.
    ##### snipped

    This will also remove snapd. Only proceed if you don't use snapd to manage your packages. Reinstalling snapd will also install AppArmor as dependency.

This guide is tested on Ubuntu:

Version Code Name
22.04 LTS Jammy Jellyfish
23.10 Mantic Minotaur
24.04 LTS Noble Numbat
Discuss the article:

Comment anonymously. Login not required.