Computer freezes randomly

The problem solving: Stable Zorin Os after Hard Freezes

My Zorin OS system repeatedly experienced hard freezes, where the mouse was still moving, but clicking or input via the keyboard was no longer possible. This always required a forced restart. After an in -depth analysis of the system logs (Journalctl), we have identified and resolved a specific cause.
The problem found: Apparmor errors

The key to the problem was in the Systemd logs and specifically with the Apparmor.service. Apparmor is a security module that places applications in a sandbox, so that they are limited in what they can do and to which system sources they have access.

The following log rules were consistent:

Systemd: Failed to Start Load Apparmor Profiles.
Apparmor parser error for /etc/apparmor.d in profile /etc/apparmor.d/firefox-local at Line 3: Could Not Open 'ABI/4.0': File or folder does not exist
Error: At Least One Profile Failed to Load

These errors indicated that Apparmor could not start correctly because a specific profile for Firefox (Firefox local) contained a reference to a non-existent file or folder ('ABI/4.0'). This defective profile ensured that the entire Apparmor service could not load, which led to underlying system instability and ultimately the Freezes. Even after an earlier attempt to remove the profile, it turned out that a backup made (firefox local) contained the same mistake.
The solution: Delete the defective Apparmor Profile

The solution consisted of identifying and removing this problematic Apparmor profile. Because the Firefox-Browser used is a regular Zorin OS APT package (and not Snap or Flatpak), this relies on the standard Apparmor profiles that are supplied by the system or Firefox APT package itself. The Firefox-local profile was probably a manual adjustment or a remnant of an earlier configuration that was no longer correct.

By removing the defective local profile, the standard, correct Apparmor profiles of the system could load undisturbed again.
Step-by-step terminal assignments

Here are the commands used in the terminal:

Check Apparmor's status to confirm the error:
Bash

SUDO Systemctl Status Apparmor

This showed the Failed Status and the Parser Error for Firefox-Local or Firefox-Local.bak.

Make a backup of the problematic profile (in case, although we removed it later):
(This command was performed when the error was still in Firefox local. If this file is already gone, this command will give a mistake, which is not a problem.)
Bash

SUDO CP /ETC/Apparmor.d/firefox-local /etc/apparmor.d/firefox-local.bak

Remove the (first) problematic Apparmor profile:
(This command could give a mistake the first time if the file had already disappeared, but later the backup turned out to be the culprit.)
Bash

SUDO RM /ETC/Apparmor.d/firefox-local

Remove the backup from the problematic Apparmor profile:
(This was the crucial step, because the backup contained the same mistake and the Apparmor service was still blocking.)
Bash

SUDO RM /ETC/Apparmor.d/firefox-local.bak

Restart the Apparmor service:
(Because the service is in a failed, it had to be restarted, not only recharged.)
Bash

SUDO Systemctl Start Apparmor

Check Apparmor's status to confirm the solution:
Bash

SUDO Systemctl Status Apparmor

After this step, the output indicated: Active: Active (Exited) and there were no more errors.

Restart the system to fully apply all changes:
Bash

Sudo reboot

The result

After successful execution of these steps, the Apparmor service was started correctly. The system has since remained stable, even with several applications at the same time active on four screens (including two browsers, a word processor, media player, file manager and more). The hard freezes have no longer occurred.

This solution suggests that a defect or outdated local Apparmor profile was the cause of system instability and the freezes. By removing this profile, Apparmor can do its work with the correct, standard profiles, which has significantly improved the stability of Zorin OS.