Ubuntu – Boot hangs indefinitely on a start job

18.04apparmorbootkeyboardstartup

Ubuntu 18.04.3 LTS
For the past week I've had a very strange problem where my keyboard only worked at the login screen but nowhere else in Ubuntu. Today trying to fix it I rebooted in recovery mode a couple of times and in older versions, in case it was caused by an update. It didn't make any difference.
When I tried to reboot again in normal mode (Ubuntu, with Linux 5.0.0-29-generic) boot hangs on the message:

"A start job is running for AppArmor …itialisation (Xmin Xs / no
limit)"

It stays that way until I force shutdown using the power button. This now happens whether I try to boot in recovery mode or normal mode. The only other available option is hit c for a command line from the GRUB boot menu.
I'd really appreciate any suggestions as my computer is currently a brick.
(please keep them simple, beginner level!)
Many thanks

Best Answer

This solution is aimed at enabling you to log-in to your system. You will need to investigate the cause for this later. It is, however, much better to do from a functional system rather than a system which does not boot correctly.


Please follow the steps below:

  1. Reboot your machine and hold the Shift key as soon as you pass the BIOS logo to access the GRUB boot menu. You might need to repeat this a few times until you succeed and see the boot menu. This link will help.

  2. Select advanced options and hit Enter.

  3. Select the second option with (recovery mode) in front of it and hit Enter.

  4. Wait until the machine boots and another menu appears. Choose the option with drop to root shell prompt in it and hit Enter.

  5. Press Enter when it says press Enter for maintenance.

  6. Once you are presented with a command prompt, write the following command and press Enter (this will give you read and write access to your system):

    mount -o rw,remount /

  7. You will need now to disable the apparmor service. To do this please write the following command and press Enter:

    sudo systemctl disable apparmor.service

  8. Reboot your system.


Notice:

If you are still unable to access recovery mode because of the same issue, please try the following while at step #2 above:

  • Press e to edit GRUB boot options.
  • Move the cursor after the last character in the last options line and press Enter to start a new line.
  • Add systemd.mask=apparmor.service with no spaces and then press F10 to boot the system.

If all goes well and your system boots normally again, you can later trobleshoot and fix the cause then enable the apparmor service again by running the following command in the terminal:

sudo systemctl enable apparmor.service
Related Question