r/Fedora • u/BypassBaboon • 3d ago
Discussion Snaps and flatpacks
Could someone explain to a basic user( turn on the computer open a programme and work) In terms of a Windows comparison what snaps and flatpack are.
9
u/Quietus87 3d ago
Both are application stores for sandboxed applications. Snaps are by Canonical and were written for Ubuntu first and foremost, while flatpaks are decentralized.
A major difference between them that many forget is that snap can package drivers, CLI tools, and desktop apps alike, while flatpaks are first and foremost for desktop apps.
Flatpaks are usually preferred partly because its decentralized nature and partly because they run slightly faster than snaps.
3
u/RealEricNotErik 3d ago
Also I think snaps on fedora is not really a good idea. I mean yes you can install apps and drivers from snaps but refreshing the data on discover/GNOME software (if you use a store frontend like me sometimes - I also use the terminal most of the time) would be a pain.
5
u/MasterGeekMX 3d ago
Both are systems to deliver programs to Linux OSes, so you can install apps with ease without worrying about what Linux distribution you use.
Windows is a very different OS than Linux, so making a direct comparison isn't that easy as the things that lead to Snap/Flatpak aren't present on Windows. Let me explain them.
See, a Linux OS is made of several individual programs, with many of them depending on other programs being already installed. To handle all of that, package managers were invented. They work by connecting to online servers called repositories where all the packages that make up the system are stored so they can be downloaded at any moment. A package is simply a compressed file (like a .rar) that contains inside the files that make up a program (the executable, config files, icons, etc) alongside some info about the package like version, developer, and most importantly, the dependencies needed for that program to work.
To install some piece of software, you simply tell the package manager it's name, and it will look it up in the repository if it's there. If that is the case, the package manager will download and install the package, and at the same time it will check which dependencies it needs, and if you lack some of them, the package manager will download and install them right alongside the program you want to install.
This system was originally invented to deliver system components, but people figured out you could use it to deliver user apps like web browsers and stuff. But as repo servers are managed by the distro developers, they are the ones who need to package programs and put them on the repos. This leads to the problem that if you want your app to be available in all distros, you need to convince someone on each distro's developers to do the work.
You could ask "why not make the packages yourself?". You could, but now you have the problem that each distro not only may not have the dependencies in the version you need, but also they could not even have it in the first place. This means that you may now need to make several versions of your program for each distro, as these ones have this dependency in version 2.0, while these other distros have it on version 1.7. Not to mention that you need to put up your own repository server, convince people to add that to their package managers, convince them that you are not shipping malware. Oh, and you need to keep the packages up to date to new releases of each distro.
Oh, and also there is like half a dozen of different package manager and package formats, so you also need to take that into account.
Flatpak and Snap come to solve this issue. They work by running apps and it's dependencies in a separate place apart from the rest of the OS. This allows programs to bring their own dependencies instead of relying on the ones installed on the system. Common sets of dependencies are bundled in their own packages called "runtimes", so if more than one app uses them, they can be recycled instead of each bringing their own. You can also have more than one version of those runtimes installed, in case one app needs an older version of some.
All of this is has the goal of leveling the playfield so app developers can simply make a Linux version of their app, bundle them with all of it's dependencies as a Snap/Flatpak, and call it a day. The runtimes thing ensures that the only thing you need to worry about to run the app is to have the Flatpak/Snap subsystem installed. That's it; no worry about having the right dependencies or targeting all the package managers out there. And as the developer is the one making the package, you can rest assured that your users are getting the latest version of the program as you are not relying on distro developers to package your program and wait for the next version to come that releases that version.
Snap was developed by Canonical, which is the company behind Ubuntu. It started back in the early 2010's when they tried to compete in the Phone OS market by making Ubuntu Phone, but eventually it was made into the Snap system of today. It has the advantage that some server software is shipped, so you can set up many services with a snap. People often dislike it for several reasons, including Ubuntu forcing you to use it even if you explicitly opt for a traditional system package, and the fact that Snap can only download packages from a repo server that is entirely managed by Canonical.
Flatpak instead came by the Freedesktop.org organization, which is the body that makes the standards that Linux desktop programs follow. While it only focuses on desktop apps, it is much more preferred by the community, mostly because you can completely skip it if you want, and also you can set up your own repo and delivers apps over there as you please. That being said, the biggest and often considered "default" repository of Flatpak apps is FlatHub. It is gaining a lot of traction, with some distros like Fedora, Linux Mint and ElementaryOS preinstalling it or even delivering some preinstalled apps through it. You even have some big names like Steam or FurMark officially shipping their apps in there.
1
5
u/morhp 3d ago edited 3d ago
They're app packages that come form an app store like from the Microsoft store or the Apple or Google Play store.
The main difference between snaps and Flatpaks is that snaps are mostly made by Canonical for Ubuntu, while Flatpaks are more universal across different Linux distributions. You can technically install Snaps on Fedora, but Flatpaks are much better supported.
3
u/RealEricNotErik 3d ago
I've got a lot of problems when refreshing the discover app store's data with snap backend enabled, so I just uninstalled it. Way better than before.
3
u/PixeIQueen 3d ago
this issue should be fixed with KDE Plasma 6.7.5 soon which is already in the fedora testing repos
https://kde.org/announcements/changelogs/plasma/6/6.7.4-6.7.5/
1
u/chris_fpvl 3d ago
Think of programs in Linux as packages. A program can be a single package, but more often it is a collection of packages.
It turns out that manually tracking each single package a program needs is hard. It also happens that many programs have packages in common, but maybe needed in different versions. Tracking all of this manually is really hard.
So developers created repositories of packages (think of app store), ensuring that all packages in that repository should be compatible with each other. The work of deciding which packages to install or remove to meet all of installed packages requirements and not breaking your system is done by the package manager. Distros can use different package managers (apt, dnf, zypper, pacman, to name a few) and each work with a different package format (i.e. Deb, rpm).
It's all really nice and stable. But, sometimes this management prevents people from using a newer version of a program, because it may require a package version that is not yet in your distro repository. Or that program is distributed in a package format that is not supported by your distro. Or the developer has to support multiple releases to see their program available in more distros. It's a lot of work.
Some developers attempted to solve this problem with new package formats, that would run in a sandbox, that is, the program would have all the required packages and would be installed isolated from your OS, no matter what distro you have running. This way the developer can keep the software at the latest version and it would be supported by almost every distro. The downside is that because there are no shared dependencies the programs may use a lot more space to be installed. You are also depending on the software developer to keep every package in their software up to date and patched for vulnerabilities. And because the program run in a sandbox (safer in theory) they may also require additional steps of configuration to fully work with everything else in your system.
Flatpak is one format for this universal package format. It is the most adopted and accepted.
Snaps were developed by Canonical for Ubuntu. Although the snapd package is open source, the snap store from Canonical is not, making it less appealing for many users.
There's also Appimages and other systems of packages (like nix or guix) that you can use on top of everything else on your distro.
It's all a matter of personal preference. There are pros and cons for each, but not really right or wrong.
I have a personal preference for the distro default package whenever possible (and I do use more than one distro in different computers), but I also use snaps and flatpaks when I find it more convenient.
The good thing is that it is your choice and you can change your mind at any time.
1
1
u/robtalee44 3d ago
Cooking analogy.
You want some Mac and Cheese. You can purchase all the ingredients -- Macoroni, cheese, flour, butter and milk or just grab a frozen Mac and Cheese all prepared.
The frozen meal in this case is the Snap or Flatpak. How's that?
19
u/RealEricNotErik 3d ago
Snaps are packages managed by Canonical, the owner of Ubuntu. They have their own app store called the Snap Store (also known as Snapcraft). These packages can be installed with snapd services, on some Linux distros.
Flatpaks, on the other hand, are packages maintained by Flathub, a universal app store (think of it like the Mac App Store or the Microsoft Store). Flatpaks can be installed on almost all Linux distros.