One of the things that most confuses new users is the number of program formats available. Each family of distributions has its own and a package created for one of them cannot be used in another, even if it supports the same format. To solve this, work began on a universal format for self-contained applications, this is that they did not require operating system dependencies.
In this way, the program can be installed on any distribution and can be updated, even if the host operating system does not. Let's talk about Snap and Flatpak.
Of course, as is often the case in the open source world, we couldn't agree on a standard format so we have three so far. Personally I do not rule out the appearance of any more in the future.
Table of Contents
Let's start by saying that in the context of this article, package and program are not synonyms. A package format is a type of file that contains additional software and metadata necessary for package managers to install it.. The programs can be in the form of source code or executable files and among the metadata are indications about the installation directory as well as the name, version number, license and the files that are part of the program.
All mobile phone and tablet users are familiar with the concept of an app store. It is a program that allows us to search for, install or uninstall other programs on our devices. Application stores are a revamped version of Linux distributions' package managers.
Package managers look for the programs we want to install in so-called repositories. Repositories are web addresses that redirect to a specific location within a server from which a specific program can be downloaded.. In the absence of an Internet connection, the installation medium can act as a repository, but the offer will not be as extensive or up-to-date.
Repositories usually group programs by origin (added by distribution developers, volunteer third parties, or organizations) or by license (free or proprietary).
Just as a manufacturer of any product does not develop all the components from scratch, developers do not do the same with the code. Libraries provided by the creators of the programming language are used (for example, for video editing), frameworks to compose the user interface, and requests to the operating system for tasks such as printing. When installing traditional package formats, managers check whether those third-party tools necessary for the chosen application to work are installed or can be obtained from the repositories. If the answer to the second question is yes, these dependencies will be installed first. Otherwise it will not be possible to continue with the task.
The novelty with the two formats that we are analyzing is that they don't need any pre-installed dependencies since everything they need comes in one package with the application.
Comparing Snap and Flatpak
If you read any other article on this subject, you will have come across two statements that are as repeated as they are false:
- Flatpak is better than Snap because it was developed by the community while Snap is only supported by one company.
- If you use Snap you are forced to use the official store, while anyone can manage a Flatpak repository.
The advantage of reading Linux Addicts is that we writers do research on what we write instead of copy/paste. Flatpak has Red Hat fingerprints all over it. We will see the involvement of the company in the specific section of Flatpak.
As for the second statement, it is false because any web server running a Linux distro can be a Snaps store. for test this tutorial 2016 year.
Snap is a cross-platform packaging and distribution system developed by Canonical, the creators of Ubuntu, for the Linux platform. It is compatible with most major distributions.
It consists of three components:
- Snap: These are the packages that Snap creates and distributes. These are compressed files in >SquashFS format and stored under the .snap extension. Each file contains the complete package module, including the application, its dependent libraries, and required metadata.
- snapd: It is the tool that in the background creates the sandbox in which the snaps are executed.
- snap shop: It is the tool that allows developers to publish and users to download snaps. In some Linux distributions, the traditional package manager acts as a graphical interface for browsing and downloading. The app store is divided into channels that allow you to choose the version of the app and the frequency of updates.
- Snapcraft: It is the tool that allows the creation of snaps.
Advantages and disadvantages
From a developer point of view, Snap provides the advantage of being able to directly distribute your software without having to adapt it to the particularities of each distribution Linux or wait for the developers to include it in the repositories.
The user has the advantage of quicker access to versions most up-to-date versions of your favorite programs without waiting for updates to each distribution or experiencing compatibility issues.
snap packets have a complete system of permissions so it is possible to configure them to interact with each otherwith the operating system and applications installed in the usual way.
Snap's forte are proprietary apps, or those that include paid features. There are also games and programs for Windows that work thanks to Wine, the compatibility layer that acts as a bridge between them and the Linux kernel.
In the disadvantages section is the boot time. Although it has been reduced since the first versions, applications in snap format take considerably longer to start than those installed normally. In addition, by including all the necessary dependencies, the size it occupies is greater.
Snap can be used for desktop applications, servers, and the Internet of Things.
The Flatpak name refers to the flat packaging of IKEA furniture. Alexander Larsson, who developed the project after working at Red Hat on container technology, is Swedish, so the name not only refers to the nationality of its creator but to the will that this "packaging" of Linux applications be as revolutionary as that of IKEA was for furniture.
The original name was xdg-app. As flimsy as the reasons for the new name may sound, let's agree that it's much better.
Regarding the relationship with Red Hat, in the FAQ itself they take care to clarify that the technology is not limited to Fedora (community distribution supported by Red Hat) nor to GNOME, indicating in the latter case that many GNOME developers participated in the development of Flatpak. Guess who many GNOME developers work for?
Granted, I have nothing against Red Hat, they have great technologies some of which I use, including Flatpak. I simply indicate that this packet format is not so independent as some want to believe.
But what is Flatpack?
Flatpak is a system for creating, distributing, and running desktop applications for Linux distributions andn a Linux system sandbox
- Flatpack Application: these are the applications that the user installs through the flatpak command or through a different user interface like the package managers of Linux distributions.
- Run-time: Integrated platform to provide the basic utilities needed for a Flatpak application to work.
- BaseApp: Integrated platforms for application building frameworks.
- Flat pack: The format in which the application is exported and its necessary basic utilities.
Advantages and disadvantages
Flatpak shares some of the advantages of Snap, such as the be able to be installed independently of the distribution, include all the necessary dependencies for its operation and work independently of the operating system so it's not tied to its bugs and update cycles.
Two distinctive advantages is thate does not require administrator privileges for installation and what they call "Delta update" where only mods are updated. This results in higher speed.
Anyone can manage your Flatpak download service; so far the most complete for end users is Flatub. The Linux Fedora distribution also has their own where they basically convert the classic distribution packages to the new format. The GNOME desktop lets try the most current versions of your applications by downloading them from yours and the same ago KDE.
Regarding the integration with the desktop, format promises native integration for major Linux desktops so users can easily navigate, install, run, and use Flatpak applications through their existing desktop environment and tools. It is worth mentioning that the Ubuntu Software Center does not support installing packages in this format.
Flatpak makes better use of disk space since allows sharing libraries between applications of the same format. The strength of the Flatpak format is the assortment of open source applications developed by the community that we can test in their latest version long before they enter the repositories.
From the developers point of view, the framework for the development of applications Gnome Builder allows to create the FlatPak in a graphical way In addition to having a series of predefined runtimes, saving time in the creation of applications.
Among the disadvantages (in addition to occupying more disk space than traditional applications) are that sthey can only be used on the desktop and that unlike Snaps, privileges cannot be modified to interact with the rest of the operating system at installation time. If it can be done by the developer at the time of creating the package, and by users afterwards using a third party application.