Article from Issue 202/2017

A distro-agnostic software repository set to take the Linux world by storm.

Q Let me guess, Flathub's the center of Terry Pratchett's Discworld?

A Nope. For starters, at the center of Discworld lies a great set of mountains. Hardly the sort of thing to be called flat. Flathub (Figure 1) is a repository for applications packaged in Flatpak.

Figure 1: The Flathub website [1] is still a little sparse due to the software being new, but eventually it will become the place to find out what's going on with the project.

Q Ok, let's go down a level. What's Flatpak? I assume Ikea hasn't branched out into software distribution.

A No, they haven't. At a very basic level, Flatpak is a way of sandboxing applications so that they're more independent from the rest of the system.

Q What do you mean, independent?

A Ok, let's look at it this way. Currently, most Linux systems install software in packages. Any package can require that many other packages be installed, and those packages can require further packages, etc.?

Q Yeah, I've always wondered why we need to do this in Linux, but it's not done in Mac OS or Windows.

A Almost all software is built on libraries that provide common functionality. For example, the Gnome libraries provide tools for building windows and user interfaces. A bit of Gnome software uses these libraries. There are basically two ways of doing this. One is to have a single version of the library on the system that every bit of software that needs the library uses, whereas the alternative is to have each bit of software come bundled together with everything it needs.

Q That second way seems really wasteful – why have many copies of something when you only need one?

A Yep. For years, Linux has traditionally used the first approach, and it does have advantages. It uses less space, and if there's a bug fix, you only have to fix the library once. However, it does also have a problem. Bits of software often depend on a specific version of a library (or at least have minimum and maximum version numbers they can work with). These libraries themselves can also require specific versions of other libraries, and these other libraries…well it goes on and on. Essentially, the software in a Linux distribution is a complex web of interdependent version numbers. Normally, this isn't something you have to worry about because the distro maintainers deal with the problem for you. If you grab something from your package manager, it'll make sure that everything is in appropriate versions. However, if you install something from outside the package manager, you're on perilous footing. Not only do you have to make sure that it was built for your particular distro, it can also break if you upgrade other parts of your system.

Q So why not just install everything from your package manager?

A If you can get everything you want from your package manager, then great; stick with that. However there are a few occasions where this doesn't work out. One example is if you want the latest version of a bit of software and it's not yet in your repository (in other words, if you don't use Arch). Another example is when the software simply isn't available for your distro; maybe it's obscure, or maybe it's brand-spanking-new. The final reason is for software that the distro maintainers can't recompile or ship (yes, we're talking about proprietary software here).

Flatpak makes it possible to ship software without getting tangled in the web of interdependent software in a Linux system.

Q Hang on, is all this Flatpak stuff just a way to get non-free software onto my system?

A No. It can be used for that, but really it's just a method to make it easier for developers to ship Linux versions of software. Let's flip our viewpoint for a minute. Rather than being a Linux user, suppose you're a software developer writing code that can be compiled on Windows, Mac OS, and Linux.

Q Ok, I'm picturing me at a standing desk in Shoreditch, London with a carefully groomed moustache tapping away on my MacBook air.

A That's a wildly unrepresentative image of software development, but never mind, we can go with it.

You know that Windows will make up the majority of your user base, so you're also happy to spend a bit of time supporting them even though (as you decided), you're developing on a Mac. However, there are only a few versions of Windows you really need to worry about (five if you go all the way back to XP, which even Microsoft only supports if it's giving them really bad publicity). That's five different versions you need to compile and test that make up the majority of your user base. A further version or two for Mac OS.

Then it comes to Linux. Obviously you'll support Ubuntu because that's the most popular Linux distro (there are five current versions of Ubuntu), but if you only support Ubuntu, you'll get complaints from people using other distros. There are two current Fedora releases, two of openSuse, and countless others. Not only are there all these, but they change, and you have to keep making sure your software is updated to work with newer versions of libraries on all this software. And this is without considering the issues associated with supporting rolling releases such as Arch or openSuse Tumbleweed.

The end result is that, unless you really care about Linux, you just won't bother because it's a lot of hassle and you're not going to get many users out of it.

Q Garh, that sounds like a hassle. I'd much rather be sipping a flat white in a coffee shop with exposed brick walls than dealing with all that software packaging.

A I don't know where you've got your impression of a software developer from, but it's quite alien to the programmers I've met. But still, packaging software isn't fun, and packaging it for lots of different Linux distros to get a small number of users is not a useful way of spending time.

Wouldn't it be so much easier to just have one way to package it and one way of distributing it that went to all Linux distros?

Q Yes. I would want that so much.

A That's what Flatpak and Flathub are: a way of packaging (Flatpak) and distributing (Flathub) software to all Linux distributions in one go.

Q Ok then, how does it work?

A The simple answer is that it bundles everything into a single package – all the libraries and everything else – and this is run in a standalone way. There are some quite advanced things going on behind the scenes (Figure 2), but the basic concept is really straight forward.

Figure 2: Software in Flathub is managed through GitLab repositories. Want to add a new piece of software? Submit a pull request.

Q Are there any advantages besides making it easier to package stuff?

A Yep. With everything decoupled, you can install whatever version of whatever you want – including multiple versions of software that depend on different versions of libraries.

Also, the way it works has some security advantages because each application can be far more isolated from the rest of the system in terms of what it can access.

However, while both of these benefits are useful, we think that by far the biggest advantage is that it'll bring more software to more distros and make it easier to keep up with the latest versions of software.

Q Awesome! How do I get started?

A Well, the starting point is Flatpak, which you'll need to install through your package manager (there are more instructions at the project website [2]). Once you've got Flatpak up and running, you can install software, but it's far easier to get it via the central repository, Flathub. Try this single-line command:

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

Once that's run, you can grab software with the Flatpak install <package> command.


  1. Flathub: http://flathub.org/
  2. Getting started with Flatpak: http://flatpak.org/getting.html

Buy this article as PDF

Express-Checkout as PDF
Price $2.95
(incl. VAT)

Buy Linux Magazine

Get it on Google Play

US / Canada

Get it on Google Play

UK / Australia

Related content

  • Ubuntu Flatpak Remix Adds Flatpak Support Preinstalled

    If you're looking for a version of Ubuntu that includes Flatpak support out of the box, there's one clear option.

  • Parcel Service

    The traditional package management systems on Linux are now somewhat outdated, but AppImage, Flatpak, and Snap see some interesting new management systems enter the fray.

  • Flathub Vying to Become the Standard Linux App Store

    If the Flathub team has any say in the matter, their product will become the default tool for installing Linux apps in 2023.

  • unsnap

    If you want to move away from Ubuntu's Snap package format, the unsnap script removes snaps from your computer and replaces them with Flatpaks where possible.

  • Tangram

    Tangram lets you track social media portals like Facebook and Twitter, as well as web-based messengers like Whatsapp and Telegram, in a single application window.

comments powered by Disqus
Subscribe to our Linux Newsletters
Find Linux and Open Source Jobs
Subscribe to our ADMIN Newsletters

Support Our Work

Linux Magazine content is made possible with support from readers like you. Please consider contributing when you’ve found an article to be beneficial.

Learn More