Image credit: Unsplash

Installing and Running AppImages

From download to install and run, everything you need.

Table of Contents

What are AppImages

AppImages are self contained executable applications, similar to PortableApps on Windows.

They contain everything needed to execute an application without any external depencies.

Obtaining an AppImage

To get an AppImage, you need to download it, some developers will host the AppImages on their own website for download, others will publish them to places like GitHub or AppImageHub.

Start by locating the AppImage you want to run and downloading it to your local machine.

Prepare the AppImage

Now you have the AppImage safely downloaded into your Downloads directory, open a terminal and issue the following:

cd ~/Downloads
chmod +x App.AppImage

Replace the App.AppImage with the real AppImage name.

Now you are ready to run it.

Run the AppImage

From the terminal issue the following command:

./App.AppImage
If you are running a later version of Ubuntu, and why wouldn’t you be, then you will reveive an error from the AppArmor service which tells you that you are trying to run an AppImage outside of a sandboxed environment.

Error:

[40690:0705/114049.486819:FATAL:setuid_sandbox_host.cc(163)] The SUID sandbox helper binary was found, but is not configured correctly. Rather than run without sandboxing I am aborting now. You need to make sure that /tmp/.mount_AppXRlBKv/chrome-sandbox is owned by root and has mode 4755. 
bash: Job 1, './App.AppImage' terminated by signal SIGTRAP (Trace or breakpoint trap)

To get around this we have some options:

  1. Add the --no-sandbox parameter to the command.
  2. Disable / Remove AppArmor. ( Not advisable )
  3. Remove Sandboxing for all AppImages. ( Not advisable )
  4. Create an exception for our AppImage.

To get around this for now, let’s re-run the command using option 1.

Issue the command:

./App.AppImage --no-sandnbox

And there we have it, you have now downloaded and run an AppImage.

Although the only downside to this is that everytime you want to run the AppImage, you need to open a terminal and issue the following commands.

cd ~/Downloads
./App.AppImage --no-sandbox

Which is about 43 characters too many for me to type, so next I’ll show you how to install it into the Gnome dock.

Move the application

We need to move the application to a more permanent home, `~/Downloads’ is not a suitable place for an application.

I’ll be moving mine to /usr/share/AppName. You should use replace AppName with the real name of your applicaiton.

sudo mkdir /usr/share/AppName & mv ~/Downloads/App.ApImage $_

This will create a new folder and move the AppImage to it’s new home of /usr/share/AppName.

Removing the need to sandbox

Let’s first remove the need to execute the AppImage using the --no-sandbox option and still maintain security.

We need to create a new file using sudo, so issue the following command replacing {APP_NAME} with the real name of your AppImage.

sudo vim /etc/apparmour.d/{APP_NAME}-appimage
You can replace VIM with any editor of your choice.

Add the following lines to the file:

# This profile allows everything and only exists to give the
# application a name instead of having the label "unconfined"

abi <abi/4.0>,
include <tunables/global>

profile cursor /{APP_LOCATION}/{APP_NAME}*.AppImage flags=(unconfined) {
  userns,

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

Replacing {APP_LOCATION} with the full path to the appimage. Replacing {APP_NAME} with the application name (leave the *.appimage in case you add more revisions of it.

So for me this will read

# This profile allows everything and only exists to give the
# application a name instead of having the label "unconfined"

abi <abi/4.0>,
include <tunables/global>

profile cursor /usr/share/AppName/*.AppImage flags=(unconfined) {
  userns,

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

Now let’s restart AppArmor.

sudo apparmor_parser -r /etc/apparmor.d/{APP_NAME}-appimage

Again replacing {APP_NAME} with the file name.

Creating a Dock entry

Next we want to create a menu entry for the app

Create a .desktop file in one of:

  • ~/.local/share/applications/ for the local user
  • /usr/share/applications/ for all users

I will be creating it for all users.

Issue the command:

sudo vim /usr/share/applications/AppName.desktop

replacing AppName with the name of the application.

Add the following to the file:

[Desktop Entry]
Encoding=UTF-8
Version=1.0
Type=Application
Terminal=false
Exec=/usr/share/applications/AppName.AppImage
Name=AppName
Icon=/path/to/icon

Ensure you change the last 3 lines to match the path and and AppImage name, the name of the application you want to show in the dock and the location of the Icon to be displayed in the dock.

.desktop files are detailed in the Free Desktop File Specification.

Now when you hit the super key and type the name of the app, it will be in the list of applications.

File Locations - AppImages

  • /usr/share/[AppName]/ - for all users
  • /home/[User]/.local/bin/ - for the local user.

File Locations - Desktop files

  • /usr/share/applications/ - for all users.
  • ~/.local/share/applications/ - for the local user.

File Locations - Icon images

  • /usr/share/pixmaps/ for all users.
  • /home/rod/.local/share/icons/.../apps/ for the local user.
Rod Laycock
Principle Engineer

Related