# Fixing the Issue with Some AppImages not Running on Modern Linux

# A Bit of Context

Nowadays, Linux has several packaging methods that allow cross-compatibility among different Linux distros. All of them come with their ups and downs and choosing the one that chooses you is important. But sometimes, we don't have any other option but to use an application that comes in a specific packaging format.

# AppImages - A Powerful Packaging Format... But with a Flaw

AppImages are one such format for distributing software on Linux that doesn't require installation. They're essentially self-contained applications that run on most Linux distributions without needing superuser privileges. This makes them a great option for users who want to try out new software without having to worry about messing up their system, or for developers who want to distribute their software more easily.

AppImages are a powerful packaging format but a major issue exists with its use of the `libfuse2` library. `libfuse2` is a library that allows user-space programs to interact with the Linux kernel's filesystem. Some AppImages rely on it for features like virtual filesystems or encrypted storage. However, starting with Ubuntu 22.04 and other distributions `libfuse2` is no longer included by default. This is due to security concerns and technical limitations of the older library version.

Developers are encouraged to upgrade to the latest libfuse3 but some programs have still not upgraded their programs to the `libfuse3` library. This makes these AppImages unusable in modern Linux versions.

# The Problem

If you try to double-click these AppImages, you might notice that they do not result in anything. In this article, I will use the [**nRF Connect for Desktop**](https://www.nordicsemi.com/Products/Development-tools/nrf-connect-for-desktop) as an example since as of writing this article, it still doesn't work for modern distributions such as mine: Ubuntu 23.10. We can see the actual problem by running it in the terminal.

To do this, navigate to the folder with the downloaded AppImage from Nautilus and right-click on it to select *Open in Terminal*. On the terminal, typing the name of the package and pressing enter will attempt to run the program from the terminal which will throw the following error.

![libfuse2 Error](https://cdn.hashnode.com/res/hashnode/image/upload/v1703482256835/4cc9c1fd-5fbf-4816-8190-c426ad1b4369.png align="center")

# The Solution

The solution provided in this message is to install `libfuse2` using the following command.

```bash
sudo add-apt-repository universe
sudo apt install libfuse2
```

However, if you're on an Ubuntu version on or above 22.04 **<mark>DO NOT ATTEMPT TO DO THIS</mark>** as it **<mark>WILL BREAK YOUR SYSTEM</mark>**. If done, you will have to reinstall the whole desktop environment as well as all the installed applications. At this point, reinstalling the system is the best option.

But there is a simple and elegant workaround for this issue. This is to unpack the AppImage and run it by executing the script. This has the added advantage of bypassing the need for the operating system to mount a separate filesystem to extract and run the AppImage every time it's executed.

The way you can do this is to enter the following command after opening the terminal in the folder with the AppImage.

```bash
chmod +x ./nrfconnect-4.3.0-x86_64.appimage
./nrfconnect-4.3.0-x86_64.appimage --appimage-extract
```

I'd recommend creating a new folder in your home directory like '*AppImages'* and copying the AppImage there before extracting the AppImage in this folder using the above command. Now within this extracted folder, you will find the contents of the app.

![Extracted folder of the AppImage](https://cdn.hashnode.com/res/hashnode/image/upload/v1703427102357/3c426b06-3935-4586-853d-32bb730e7a6b.png align="center")

Now first open another terminal in this folder and enter the following command to execute the program.

```bash
./AppRun
```

If this results in the file opening in a text editor, enter the following command first to change the file to executable.

```bash
sudo chown +x ./AppRun
```

You will see that the app runs without an issue.

![App Running after the Extraction](https://cdn.hashnode.com/res/hashnode/image/upload/v1703427497022/968badec-234d-49af-913f-5fda86850c41.png align="center")

# Make an Elegant way to Launch the Application

We can also make the application appear in the App Launcher menu as an entry. To do this, we will rename the folder in which the *AppRun* file exists to something convenient. In this case, I have already renamed it to *nRF*.

Now navigate to User Home &gt; *.local* &gt; *share* &gt; *applications*. If *.local* is not visible, press CTRL + H to reveal hidden files and folders. In this, open a terminal window and use the following command to create a new desktop entry.

```bash
sudo nano 'nRF Connect.desktop'
```

You can use any name for the application name. Make sure to use only letters and numbers along with spaces to reduce conflicts and end the name with *.desktop* as given. This will open the nano text editor. In it, paste the following. Make sure that the paths in `Exec` and `Icon` point to the correct locations.

```bash
#!/usr/bin/env xdg-open
[Desktop Entry]
Version=1.0
Type=Application
Terminal=false
Exec=/home/asanka/AppImages/nRF/AppRun
Name=nRF Connect Desktop
Comment=nRF Connect Desktop
Icon=/home/asanka/AppImages/nRF/nrfconnect.png
```

Here, you can include the path to the AppRun file of your specific application under `Exec`. The `Name` and `Comment` should be the app name that should appear in the launcher. The Icon should point to a PNG of the application. The AppImages usually come with an icon, however, if you do not have one, simply download the logo of the application as a PNG image and copy it into that application directory.

Now save the file by pressing CTRL + X &gt; *Y* &gt; Enter. Then if you check your launcher, you will see the application icon. Clicking on it will run the program.

![nRF Connect Desktop on the App Launcher](https://cdn.hashnode.com/res/hashnode/image/upload/v1703429291241/0165acba-7692-4cc3-970f-55ae039bae21.png align="center")

# Reference

* [nRF Connect Desktop Download](https://www.nordicsemi.com/Products/Development-tools/nRF-Connect-for-Desktop/Download#infotabs)
    
* [AppImage FUSE Requirement Details](https://github.com/AppImage/AppImageKit/wiki/FUSE)
    
* [Wikipedia Article on FUSE](https://en.wikipedia.org/wiki/Filesystem_in_Userspace)
    
* [libfuse GitHub Repository](https://github.com/libfuse/libfuse)
    
* [Ubuntu 22.04: Appimage doesn't start : libfuse.so.2: cannot open shared object file: No such file or directory - Issue on openshot-qt Github Repository](https://github.com/OpenShot/openshot-qt/issues/4789)
    
* [How to create desktop shortcut launcher on Ubuntu 22.04 Jammy Jellyfish Linux - LinuxConfig.org](https://linuxconfig.org/how-to-create-desktop-shortcut-launcher-on-ubuntu-22-04-jammy-jellyfish-linux)
    
* [Official AppImages Site](https://appimage.org/)
