AppArmor is a security module for Ubuntu and Debian that enforces access control policies on applications. In certain environments, these restrictions can interfere with specific operations or require adjustments. Disabling AppArmor may be necessary to ensure compatibility with certain applications or configurations.
In systems where flexibility is crucial, such as development environments, disabling or removing AppArmor might be required. This process involves stopping the service, disabling it from starting at boot, and optionally removing the AppArmor package and its dependencies. Understanding the security implications is important, as disabling AppArmor reduces system protection.
It is generally advisable to keep AppArmor enabled in production environments. However, if the situation demands it, disabling AppArmor should be done with caution. Be aware that certain packages, such as snapd, might reinstall AppArmor if removed.
Steps to disable and remove AppArmor in Ubuntu and Debian:
- Open a terminal on your system.
- Stop the AppArmor service.
$ sudo systemctl stop apparmor
- Disable AppArmor from starting at 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".
- If necessary, remove the AppArmor package and its dependencies.
$ 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 |

Mohd Shakir Zakaria is a cloud architect with deep roots in software development and open-source advocacy. Certified in AWS, Red Hat, VMware, ITIL, and Linux, he specializes in designing and managing robust cloud and on-premises infrastructures.
Comment anonymously. Login not required.