web stats
Featured image of post Thumbnails are not generating in Ubuntu 24.04 LTS

Thumbnails are not generating in Ubuntu 24.04 LTS

If images aren't showing previews in Ubuntu 24.04 and they end up in the 'fail' folder, I'll show you how to fix it permanently by configuring AppArmor without compromising system security.

One of the most annoying bugs you can encounter after a system update is that image thumbnails stop generating, showing a generic icon instead. If you take a look at your hidden folders, you’ll see that all these failed thumbnails end up stored in the ~/.cache/thumbnails/fail path.

This time, we are going to fix this problem at its root by creating a secure AppArmor profile for Nautilus, allowing the system to render your previews again without compromising your security.

Why does this happen?

The culprit behind this behavior is a new restrictive security policy in Ubuntu 24.04 related to unprivileged user namespaces.

Nautilus (the GNOME file manager) uses an isolation tool called bubblewrap under the hood. Its job is to create a secure environment (sandbox) to open and process images. This way, if a file were corrupted or contained malicious code, it wouldn’t be able to infect your system.

The problem arises because AppArmor’s strict policies block bubblewrap from functioning. Since the sandbox cannot run, Nautilus fails silently and sends all thumbnails straight to the error folder (fail).

Solution: Create the AppArmor profile for Nautilus

Although drastic methods exist, such as disabling this restriction globally across the entire kernel, it is not recommended. The ideal approach is a surgical solution: telling AppArmor to specifically trust Nautilus.

Create the configuration file

Open a terminal and run the following command to create a new AppArmor profile using the native nano text editor:

1
sudo nano /etc/apparmor.d/nautilus

Inside the empty file, paste the necessary rules to grant the required permission:

1
2
3
4
5
6
7
8
9
abi <abi/4.0>,
include <tunables/global>

profile nautilus /usr/bin/nautilus flags=(unconfined) {
  userns,

  # Site-specific additions and overrides. See local/README for details.
  include if exists <local/nautilus>
}

To save the changes in nano, press the key combination Ctrl + O, hit Enter to confirm the name, and finally exit with Ctrl + X.

Load the new profile into the system

To make Ubuntu apply the new rules immediately without needing a reboot, run the following command in the terminal:

1
sudo apparmor_parser -r /etc/apparmor.d/nautilus

Cleaning up the history and restarting

Once the security block is resolved, we need to force Nautilus to retry generating the thumbnails that were already flagged as “failed”.

Empty the error cache

Run this command to clear the history of failed images from the system:

1
rm -rf ~/.cache/thumbnails/fail/*

Restart the file manager

Finally, completely close the Nautilus instance running in the background:

1
nautilus -q

And that’s it! With all of this done, the next time you open your file manager and enter your image or video folders, you’ll see them populate again with all the thumbnails generated instantly and completely securely—just as it always should have been.


PD: Banner image generated with AI.

comments powered by Disqus
Built with Hugo-Extended & theme Stack