Flatpak on the Raspberry Pi

Leverage the power of installing modern packages in a standardised and secure fashion by using flatpak on Raspberry Pi OS.

Flatpak on the Raspberry Pi

So in a previous article I showed you how to easily install apps on Raspberry Pi OS using pi-apps.io. However, there are other ways to install apps and one of those ways, which is becoming a bit of a standard across many Linux distributions (except Ubuntu which has gone its own way), is called flatpak. Lots of software developers are using this method as it means they can just focus on maintaining one package that runs universally on all distros rather than jumping through distro specific hoops to create a .deb or .rpm file. Its sandboxed environment also enhances security by isolating applications from the host system, reducing the risk of malicious software affecting critical components. Plus, because the software developers maintain the package, you are likely to be able to run the latest version quickly and easily without having to wait for your distro to package it in the main repositories.

Now, it is possible to run flatpak on Raspberry Pi OS and for the most part it works well, but there are a couple of caveats, so I’ll warn you upfront:

  • there’s no GUI for installing packages like on other distros, so you’ll need to run the program from the command line
  • I have a found a couple of applications that just didn’t work once installed, such as “geary” - a really good email client, but on the whole things worked fine.

So, if you’re happy with the above, let’s take a look at what you need to get up and running.

Install flatpak

A flatpak package is available in Raspberry Pi OS (previously called Raspbian) Stretch and newer. To install it, run the following:

sudo apt install flatpak

This will go ahead and install what you need to start installing apps, but we’ll want to add a repository to it so it can get lots of packages. The biggest of these is called flathub.

Add the flathub repository

Flathub is the best place to get flatpak apps. To enable it, run:

flatpak remote-add --if-not-exists flathub https://dl.flathub.org/repo/flathub.flatpakrepo

Now I recommend having a browse of the https://flathub.org website to find the packages you want to install as there is no native GUI on Raspberry Pi OS to search with. You’ll find a nice clean landing page and the usual search options, but apps are also split into nice categories to make them easier to browse and find apps in a catalogue fashion.

Install apps

Flatpak commands can be run either system-wide or per-user. Applications and runtimes that are installed system-wide are available to all users on the system. Applications and runtimes that are installed per-user are only available to the users that installed them. To just install for the user you add the “—user” flag to the command line arguments.

Let’s say we want to install the GIMP application. First, we’d run a search for the app with the following command:

flatpak search gimp

Once you have received a response, you can select the package you want to pick and install like this:

flatpak install flathub org.gimp.GIMP

# or since version 1.2 its easier as the install function can search

flatpak install gimp

Flatpak will now work its magic and install the application for you, once complete you can launch the application from the normal menus (click the raspberry pi logo).

⚠️
I did once have an application install fine but it didn’t appear under the menu until I had logged out and back in again.

Uninstalling applications

If you decide you’d like to remove an application, its super simple:

flatpak uninstall gimp

Updating apps

Yep, flatpak even has you covered for installing updates. I can simply run:

flatpak update

This will give you a list of packages to update which you can agree to and then all the packages will get updated.

Conclusion

As you can see it’s really simple to manage apps using flatpak and you are more likely to get the up to date versions of these packages as well. By adding flathub you get a huge array of software some of which isn’t available on the normal repositories. I personally prefer this application for user apps; I still use the .deb/apt approach for system level things like the GUI or services to run the actual system, but if it’s a software package, I’ll now turn to flatpak first.

Pro’s

  • A huge software catalogue
  • Pretty easy to use on the command line (install and update etc)
  • Removes the frustration of old packages in your distro

Con’s

  • No GUI installer like in other distros
  • I experienced some apps that refused to run

PiSource Score

Easy of Setup Features Ease of Use Extendability Total
7 9 8 8 32/40