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 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.
The Solution
The solution provided in this message is to install libfuse2
using the following command.
sudo add-apt-repository universe
sudo apt install libfuse2
However, if you're on an Ubuntu version on or above 22.04 DO NOT ATTEMPT TO DO THIS as it WILL BREAK YOUR SYSTEM. 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.
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.
Now first open another terminal in this folder and enter the following command to execute the program.
./AppRun
If this results in the file opening in a text editor, enter the following command first to change the file to executable.
sudo chown +x ./AppRun
You will see that the app runs without an issue.
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 > .local > share > 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.
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.
#!/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 > Y > Enter. Then if you check your launcher, you will see the application icon. Clicking on it will run the program.