Ubuntu has Snap packages. Red Hat is pushing Flatpak. Both come with promises of better security and easier deployment across many distros. But what are they, and which should you use?
Linux distros support apps in several strict formats. For years, the two most popular have been .debs and .rpms. This may be starting to change.
Snaps and Flatpaks: Background
We’ve explained Ubuntu snap packages in-depth before. They began as click packages, which Canonical developed to distribute apps for Ubuntu Touch. These packages contain application binaries and dependencies, everything they need to run.
Despite being announced only last month, Flatpaks aren’t quite so new. They began under a different name, xdg-app. Flatpak comes from GNOME developers, namely Alexander Larsson, Principal Software Engineer at Red Hat.
Flatpak isn’t a company-sponsored project. No matter. Now Red Hat and Fedora are pushing its adoption.
Similarities Between Snap and Flatpak
The idea behind both Snap and Flatpak is to provide Linux with a universal package format. If you have the Snap framework installed, you can run any Snap package. The same concept is true for Flatpak.
Snap and Flatpak packages come with security benefits. They are sandboxed. Apps can only see themselves and parts of the computer they have permission to see. This isolation prevents software from easily damaging other parts of the system.
The situation isn’t foolproof. The X11 window system used by most Linux distros limits the security of both formats. This should change once the Wayland and Mir display servers are ready for primetime.
Differences in Packages
Snap packages will work on mobile devices, PCs, and servers. Flatpak is geared specifically for desktops. The latter runs inside a desktop session. It depends on certain services that are not necessary components of a server.
While snaps contain most of what they need to run, Flatpaks depend on “runtimes.” An app may require GNOME 3.20, for example. But installing the GNOME 3.20 runtime should be easier than chasing down every single file dependency like we do today.
Canonical is creating a dedicated store for distributing snaps. The company encourages developers to submit their apps. This is akin to the experience on mobile devices. People who don’t want to rely on Canonical can opt to start a store of their own.
Flatpak packages come via repositories like existing Linux software. Anyone familiar with an Ubuntu PPA has an idea what to expect here.
While both packages isolate apps, Flatpak is designed to work with SELinux. If you use that program to block out unwanted behavior, Flatpak may be the better format for you. Plus it’s standards compliant, supporting the Open Container Initiative.
You don’t have to choose between Snap and Flatpak at the moment. Neither is ready for prime time. You can install either one right now, but the process isn’t all that straightforward. Canonical and GNOME are working to make their respective formats easy to install without the command line, but that time has not yet come.
Then there’s the issue of adoption. The format doesn’t matter all that much if the application you want isn’t available. The popular LibreOffice suite already supports both (you can download the Flatpak directly from the website), but only time will tell what other projects choose to do.
Some would say that a downside to both is choosing to make yet another universal package format, when alternatives already exist.
Are There Any Other Alternatives?
Snaps and Flatpaks aren’t the only options out there. They’re not even the first. The AppImage format is available today, and it supports all of the most popular distros. It’s a continuation of klik, which originated in 2006. Though it’s worth noting that AppImage doesn’t have the same security as Snap and Flatpak.
OrbitalApps are another form of universal apps for Linux, though these are designed to launch from a flash drive. View them as the Linux alternative to PortableApps, which was also based on Klik. Using the ORB Launcher, you can run OrbitalApps on any Linux computer, the idea goes.
Does the Future Look Bright?
You don’t need to choose between Snap and Flatpak right now. Those who have taken the time to install either one find that right now, there isn’t much to see. You can install both to your machine today, but unless you’re a developer or tester, there isn’t much point.
For now, this is largely a choice between approaches, ideas, and communities. Do you prefer software backed by Canonical or GNOME? Which do you trust to play along better with the broader open source ecosystem? Which do you picture other distros being more willing to adopt? Should everyone have just adopted AppImage instead? Share your perspective in the comments!