Snap vs APT: What’s the Difference?

Introduction

Compared to other mainstream operating systems, Linux takes a different approach to software management. The software in Linux is traditionally organized in repositories. Repositories contain applications and all the dependencies necessary to run them.

While using repositories is convenient for many reasons, it often presents an obstacle for users who are not tech-savvy. Several alternative packaging systems have been created over the past couple of years to make the Linux experience more user-friendly.

In this comparison article, you will learn about the differences between the Snap packaging system and the APT package manager.

Snap Vs. Apt - What's the Difference?

What is Snap?

Snap is a software package and deployment system that uses self-contained packages called snaps to deliver software to users. Snaps pack all the dependencies a program requires in a single package. In this way, the app is system-agnostic, meaning that it can natively run on any Linux distribution that supports Snap.

While APT mostly obtains packages from a distribution’s official repositories, Snap enables developers to deliver their apps directly to users via the Snap Store. Developers can also publish snaps directly on their web sites.

The tool for snap management is called snapd. It is a daemon that enables a system to run snap packages. Users interact with snapd by using the snap client.

Below is an example of a Thunderbird installation using the snap command:

Installing Thunderbird on Ubuntu using Snap

What is APT?

APT (Advanced Package Tool) is a software package manager for installing and removing packages on Debian-based systems. APT automates the process of retrieving, configuring, upgrading, installing, and removing packages. APT is a front-end of Debian’s base package management system dpkg.

One of the main benefits of APT is the way it handles software dependencies. After a user issues a command to install a package, APT searches the repositories for the package’s dependencies and installs those that have not already been installed on the system.

The tool that APT mainly uses to interface with users is apt. The utility offers the most popular apt-get and apt-cache commands, which are considered less user-friendly.

The screenshot demonstrates installing Thunderbird using apt:

Installing Thunderbird on Ubuntu using APT

Note: For more information about APT, refer to How to Use APT Package Manager on Ubuntu Linux and APT Vs APT-GET.


Snap Vs. APT: Differences

Before getting into details regarding the differences between Snap and APT, it is necessary to understand the levels at which we can compare them.

The table below explains the terminology and provides the main comparison points:

  Snap APT
Package type .snap .deb
Tool name snapd APT
CLI tool snap apt
Format SquashFS archive ar archive
Available in Snap Store Debian repositories
Installation Size Larger Smaller
Dependencies Contained in the package Shared
Updates Automatic Manual
Security confinement Confined Limited confinement
Multiple installations Possible Not possible
Multiple version installations Possible Not possible

Package Format

Snap uses .snap files, available for download in the Snap Store or on their developer’s website. The .snap file contains an application, its dependencies, and the metadata in a SquashFS compressed file system.

Snap applications are containerized, similar to the way Docker packs its containers. However, unlike Docker containers, snap apps have limited access to the host system, mainly for storing configuration files and using the system’s I/O.

APT uses .deb files from online software repositories for each Linux distribution that supports them. A .deb file is a Unix archive, which includes two tar archives. One archive contains the control information, while the other features the files used for package installation.

Package Size

Snaps are self-contained, which results in a relatively sizeable .snap file. When a user installs a snap, the file is decompressed and mounted as a read-only loopback device in the home directory.

An application installed via APT is smaller in size than its snap counterpart because it doesn’t need to bundle package dependencies.

Dependencies

Snap bundles package dependencies inside the package. While this approach negatively affects the package size, the main benefit is that users always have the supported and tested version of the package.

APT utilizes a shared-dependencies approach. When a user issues an apt install command, APT reads the list of dependencies, checks if the system already has some of the packages installed, and installs the missing ones. This technique maintains a small memory footprint.

Ease of Use

The difference in the ease of use for end-users is not significant. Snap apps are universal and more practical for developers to maintain, and releasing an update is a straight-forward process of changing a single package.

On the other hand, APT checks repositories to find updates. When an update is ready, the repository system requires a separate version for each distribution (Ubuntu, Linux Mint, Pop! OS, etc.) and each distribution version (Ubuntu 18.04, Ubuntu 20.04, etc.). This method is time-consuming and sometimes leads to delays for certain distributions.

Speed

Snap has longer start-up times than APT since the OS decompresses snaps on the first use to save disk space. However, snaps are slower only on the first run – the difference diminishes or completely disappears on the second start-up.

Updates

The Snap update process is automatic. Users cannot prevent a snap app from updating, only delay the process. Snap developers are not limited in terms of when they can release an update.

APT grants complete control to the user over the update process. However, when a distribution cuts a release, it usually freezes debs and does not update them for the length of the release. Therefore, Snap is the better solution for users who prefer the newest app versions.

GUI Integration

Snaps are designed to be universal. As such, they do not integrate perfectly with GUIs of various distributions.

There has recently been some development in the Snap community concerning theme integration. It includes introducing a background service that watches for theme changes and offers users to adjust their app to conform to the OS theme. However, this is a work in progress, and snaps still do not fully integrate into the host OS.

On the other side, .deb files used by APT are distribution and version-specific, which results in providing the default Linux experience in terms of theme integration.

Security

Snaps support signature validation and, given their confined nature, are considered a secure solution for app deployment. However, since the publisher provides the app directly to the user, the user needs to trust the publisher. No external reviews are performed.

On the other side, every Linux distribution reviews debs included in its repository. So, APT users can be sure that the app comes from a trusted source. This does not apply to 3rd party repositories or debs available on publisher websites.

Snap Vs. APT: Which One to Choose?

Choose Snap if:

  • You do not want unnecessary packages to be integrated into your system. With Snaps, the packages remain confined in the .snap package.
  • You want to make sure you have the most up-to-date version of the app. Snap updates automatically and continuously, without feature freezes for specific distributions.
  • You want to isolate an app.

Choose APT if:

  • You prefer apps to be reviewed by the distribution you are using.
  • You are concerned about conserving your storage space. Apps installed by APT share their dependencies.
  • You want apps to integrate into the GUI environment properly.

Note: If you are interested in working with Snap, check out our guide on How to Install Snap on Ubuntu.


Conclusion

This comparison article summarized the differences between using the Snap packaging system and the APT package manager. Learning how Snap and APT compare should help you decide which installation method you prefer.

原创文章,作者:carmelaweatherly,如若转载,请注明出处:https://blog.ytso.com/224278.html

(0)
上一篇 2022年1月7日
下一篇 2022年1月7日

相关推荐

发表回复

登录后才能评论