Apparmor initialization failed in ubuntu 17.10
After installing ubuntu 17.10 I started getting this error on startup. Here is the output of
$ sudo service apparmor status
pparmor.service - AppArmor initialization
Loaded: loaded (/lib/systemd/system/apparmor.service; enabled; vendor preset: enabled)
Active: failed (Result: exit-code) since Tue 2017-11-07 08:48:16 EET; 10min ago
Docs: man:apparmor(7)
http://wiki.apparmor.net/
Main PID: 621 (code=exited, status=123)
Nov 07 08:48:16 logician-724 apparmor[621]: Skipping profile in /etc/apparmor.d/disable: usr.sbin.rsyslogd
Nov 07 08:48:16 logician-724 apparmor[621]: Skipping profile in /etc/apparmor.d/disable: usr.bin.firefox
Nov 07 08:48:16 logician-724 apparmor[621]: AppArmor parser error for /etc/apparmor.d/usr.bin.webbrowser-app in /etc/apparmor.d/usr.bin.webbrowser-app at line 26: Could not open '/usr/share/
Nov 07 08:48:16 logician-724 apparmor[621]: AppArmor parser error for /etc/apparmor.d/usr.lib.mediascanner-2.0.mediascanner-extractor in /etc/apparmor.d/usr.lib.mediascanner-2.0.mediascanner
Nov 07 08:48:16 logician-724 apparmor[621]: Skipping profile in /etc/apparmor.d/disable: usr.sbin.rsyslogd
Nov 07 08:48:16 logician-724 apparmor[621]: ...fail!
Nov 07 08:48:16 logician-724 systemd[1]: apparmor.service: Main process exited, code=exited, status=123/n/a
Nov 07 08:48:16 logician-724 systemd[1]: Failed to start AppArmor initialization.
Nov 07 08:48:16 logician-724 systemd[1]: apparmor.service: Unit entered failed state.
Nov 07 08:48:16 logician-724 systemd[1]: apparmor.service: Failed with result 'exit-code'.
Solution 1:
I got the exact same error on my three Ubuntu 17.10 systems. What seems to happen is that the apparmor startup script returns an error because of an error in policy files from the two packages "webbrowser-app" and "mediascanner2.0". Policy files from these two packages tries to include files from non existing directories. This is an error in the packaging of these two packages. As can be seen from the output of "sudo aa-status" the error only affects the policies provided by these two packages.
A workaround is to install the package "apparmor-easyprof-ubuntu" which provides the missing directories. After installing this package the error disappeared on my systems.
sudo apt install apparmor-easyprof # Ubuntu >= 18.04)
or:
sudo apt install apparmor-easyprof-ubuntu # Ubuntu < 18.04
Reference: https://bugs.launchpad.net/ubuntu/+source/apparmor/+bug/1554803
Solution 2:
Reinstalling mediascanner2.0
and removing webbrowser-app
worked for me.
sudo apt install --reinstall mediascanner2.0
sudo apt purge webbrowser-app
sudo apt autoremove --purge