Ubuntu 24.04 Snap Startup Failure: libX11.so.6 Error Troubleshooting Guide

Ubuntu 24.04 Snap Startup Failure: libX11.so.6 Error Troubleshooting Guide

Problem Description

After booting up, it was found that Firefox could not start, and after attempting to reinstall, it was discovered that the Application Center (Snap Store) could not open either. Upon further investigation, it was found that all Snap applications could not run and the following error appeared:

snap: error while loading shared libraries: libX11.so.6: cannot open shared object file: No such file or directory

This indicates that Snap cannot load libX11.so.6, and the shared library might be missing or cannot be found by the system.

Troubleshooting and Resolution Process

Step 1: Try Updating the System

First, ensure the system and installed packages are up to date.

sudo apt update && sudo apt upgrade -y

After updating, try to start Firefox again, but the problem still persists.

Step 2: Reinstall Snap

Suspecting that Snap itself might be corrupted, attempt to reinstall it:

sudo apt install --reinstall snapd

The following error appears:

snap: error while loading shared libraries: libX11.so.6: cannot open shared object file: No such file or directory
Could not execute systemctl: at /usr/bin/deb-systemd-invoke line 148.
snapd.failure.service is a disabled or a static unit not running, not starting it.
snapd.snap-repair.service is a disabled or a static unit not running, not starting it.
Could not execute systemctl: at /usr/bin/deb-systemd-invoke line 148.

Then, try removing and reinstalling it:

sudo apt remove snapd 

sudo apt install snapd

But the same error still appears, indicating that libX11.so.6 is missing.

Confirm that snapd is correctly installed, and that the system can find the path:

which /usr/lib/snapd/snapd

which snap

Step 3: Check if libX11.so.6 is Installed

Since the error always indicates that libX11.so.6 cannot be found, the idea is to reinstall libX11.so.6 to fix it.

Use the following command to check if libX11.so.6 is installed on the system:

dpkg -l | grep libx11-6
find /usr -name libX11.so.6

If libX11.so.6 is not installed or may be corrupted, attempt to reinstall the library:

sudo apt install --reinstall libx11-6

After installation, verify that libX11.so.6 is in the correct system directory.

dpkg -l libx11-6


find /usr -name libX11.so.6

Then, reinstall snap again, but still get the same error message.

Step 4: Try Restarting Snap Service

sudo systemctl restart snapd 
or
sudo systemctl start snapd.service

Try to enable the socket:

sudo systemctl enable --now snapd.socket

Restart the service, but the error still appears.

If the service cannot start, check the status of the Snap service:

sudo systemctl status snapd.service

The error still appears, indicating that Snap cannot start.

Check system logs

Check system logs for any other errors related to snapd:

journalctl --no-pager -u snapd

Still, many errors appear.

After completing Steps 1-4, the problem was mostly resolved.

Step 5: Completely Reinstall Snap

It seemed like there was an issue with system links, which was causing the system to fail to find libX11.so.6. Eventually, a complete removal of Snap and a fresh installation was necessary. After this, all programs installed via Snap would need to be reinstalled.

The difference between remove and –purge, see this article on Ubuntu Install & Remove Packages or Programs

sudo apt remove --purge snapd

Reinstall snapd:

sudo apt install snapd

Carefully observe that during the installation process, no system links related to libX11.so.6 were created, which may be included in a system link somewhere else, but at least system links were recreated.

Then, I immediately tried to install Darktable:

snap install darktable

Still the same error: snap: error while loading shared libraries: libX11.so.6: cannot open shared object file: No such file or directory

Having tried all available methods online, I was about to give up and reinstall Ubuntu from scratch.

Step 5: Check for Software Conflicts

After further searching, I discovered that many users reported that Citrix (icaclient) might conflict with Snap. I recalled that I had installed Citrix for work, so I tried removing it:

https://www.computerbase.de/forum/threads/snap-error-while-loading-shared-libraries-libx11-so-6.2230918/

sudo apt remove --purge icaclient

After removal, I tried installing a new Snap application to verify:

snap install darktable

Finally, a different error message appeared:

error: cannot communicate with server: Post "http://localhost/v2/snaps/darktable": dial unix /run/snapd.socket: connect: connection refused

Then, restart the Snap service:

sudo systemctl start snapd.service

Reinstall Darktable again, and this time it installed successfully! Later, I installed the Snap Store from the application center, as the user interface is more convenient.

snap install snap-store

Final Solution Summary

Root Cause

  • Citrix (icaclient) interfered with the system link of libX11.so.6, causing Snap to fail to load the library.

Complete Solution Steps

    1. Update the system
      sudo apt update && sudo apt upgrade -y
    2. Reinstall Snap
      sudo apt install --reinstall snapd
    3. Check and reinstall libX11.so.6
      sudo apt install --reinstall libx11-6
    4. Check and remove any conflicting software (such as Citrix)
      sudo apt remove --purge icaclient
    5. Restart Snap service
      sudo systemctl restart snapd

Other Commands Found But Not Used

Unmask the snapd.service:

sudo systemctl unmask snapd.service

Enable snapd.service:

sudo systemctl enable snapd.service

Remove Configuration Files:

If the issue persists, check for any configuration files that might be blocking Snap installations. Specifically, look for a file named nosnap.pref in /etc/apt/preferences.d/ and remove or comment it out:

sudo rm /etc/apt/preferences.d/nosnap.pref

Conclusion

Although the troubleshooting process took several hours, the root cause of the problem was found to be Citrix interfering with libX11.so.6. If your Snap experiences similar errors, try these methods, and hopefully, it will help you resolve the issue quickly!

1 thought on “Ubuntu 24.04 Snap Startup Failure: libX11.so.6 Error Troubleshooting Guide”

Leave a Comment

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Scroll to Top