You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

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:

1. Boot into Recovery Mode

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 with recovery mode.
  • In the recovery menu, pick root Drop to root shell prompt to get full root access.
  • Remount the filesystem as writable (required to make changes):
    mount -o remount,rw /
    
2. Diagnose the AppArmor Issue

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. Fix Common AppArmor Problems

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_DEFAULT and add apparmor=0 to it. For example:
    GRUB_CMDLINE_LINUX_DEFAULT="quiet splash apparmor=0"
    
  • Save the file (press Ctrl+O, then Enter) and exit nano (Ctrl+X).
  • Update GRUB to apply the change:
    update-grub
    
  • Reboot your system:
    reboot
    
4. Verify the Fix

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

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.19 08:33:02