Ubuntu启动黑屏且提示Failed to start apparmor initialization问题求助
Hey there, let's fix that Ubuntu boot black screen caused by the "Failed to start apparmor initialization" error. I've troubleshooted this issue plenty of times, so here's a step-by-step guide to get your system back up and running:
Since normal boot leads to a black screen, we need to access the system via recovery mode first:
- Restart your computer. Right after the BIOS/UEFI screen (before Ubuntu begins loading), hold down the Shift key (for UEFI systems, you might need to press Esc instead) to bring up the GRUB menu.
- Select
Advanced options for Ubuntu, then choose the kernel version labeled withrecovery mode. - In the recovery menu, pick
root Drop to root shell promptto get full root access. - Remount the filesystem as writable (required to make changes):
mount -o remount,rw /
Let's dig into what's causing the initialization failure:
- Check the current status of the AppArmor service:
systemctl status apparmor - Pull up detailed logs from the last failed boot to spot specific errors:
journalctl -u apparmor --boot=-1 - You can also search the system log for AppArmor-related issues:
grep -i apparmor /var/log/syslog
3.1 Reinstall AppArmor Core Files
Corrupted AppArmor binaries or configuration files are a common culprit. Reinstall the package to fix this:
apt update apt install --reinstall apparmor apparmor-utils
After reinstalling, reload all AppArmor profiles:
apparmor_parser -r /etc/apparmor.d/*
3.2 Fix Broken AppArmor Profiles
Sometimes custom or malformed profiles crash the initialization. Here's how to handle this:
- List all currently loaded profiles to identify potential troublemakers:
aa-status - If you spot a suspicious profile, temporarily disable it:
aa-disable /etc/apparmor.d/path/to/broken/profile - To reset all AppArmor configurations (this clears custom rules, so use carefully):
systemctl stop apparmor rm -rf /etc/apparmor.d/cache/* apparmor_parser -r /etc/apparmor.d/* systemctl start apparmor
3.3 Temporarily Disable AppArmor (Last Resort)
If the above steps don't work, you can disable AppArmor temporarily to boot into the system, then troubleshoot further later (note: AppArmor is a security component, so re-enable it once fixed):
- Edit the GRUB configuration file:
nano /etc/default/grub - Find the line starting with
GRUB_CMDLINE_LINUX_DEFAULTand addapparmor=0to it. For example:GRUB_CMDLINE_LINUX_DEFAULT="quiet splash apparmor=0" - Save the file (press
Ctrl+O, thenEnter) and exit nano (Ctrl+X). - Update GRUB to apply the change:
update-grub - Reboot your system:
reboot
Once your system boots successfully, check that AppArmor is running correctly (if you didn't disable it permanently):
systemctl status apparmor
You should see it marked as active (exited) or active (loaded) — this means it's working as expected.
内容的提问来源于stack exchange,提问作者Felipe Lima

