Introduction
Welcome to this comprehensive guide to using Snap packages on Ubuntu! Snap packages are a great way to install and manage applications on Ubuntu. They are easy to use, secure, and provide a great way to keep your system up to date. In this guide, we will cover everything you need to know about Snap packages, from installation to troubleshooting. We will also provide some tips and tricks to help you get the most out of your Snap packages. So let’s get started!
A Comprehensive Guide to Using Snap Packages on Ubuntu
Snap packages are a great way to install and manage applications on Ubuntu. They are easy to install, secure, and provide a consistent experience across different versions of Ubuntu. In this guide, we will show you how to use snap packages on Ubuntu.
1. Installing Snap Packages
The easiest way to install snap packages is through the Ubuntu Software Center. Just search for the package you want to install and click the “Install” button. You can also install snap packages from the command line using the “snap” command. For example, to install the VLC media player, you would run the following command:
sudo snap install vlc
2. Updating Snap Packages
Snap packages are automatically updated when new versions are released. To manually update a snap package, use the “snap refresh” command. For example, to update VLC, you would run the following command:
sudo snap refresh vlc
3. Removing Snap Packages
To remove a snap package, use the “snap remove” command. For example, to remove VLC, you would run the following command:
sudo snap remove vlc
4. Managing Snap Packages
You can manage snap packages using the “snap” command. To list all installed snap packages, use the “list” command. To get more information about a specific package, use the “info” command. For example, to get information about VLC, you would run the following command:
snap info vlc
5. Troubleshooting Snap Packages
If you encounter any issues with snap packages, you can use the “snap troubleshoot” command to get more information. This command will provide you with detailed information about the issue and possible solutions.
We hope this guide has helped you understand how to use snap packages on Ubuntu. If you have any questions or feedback, please let us know in the comments below.
Introduction
Snaps are contained applications in the form of packaged software. The package manager for Snap apps is Snap, created by Canonical for Linux.
Snap comes preinstalled on most of the latest Linux distributions. To check if you have Snap preinstalled on your system and to see how to install Snap, read our tutorial on how to install snap on Ubuntu.
In this tutorial, you will learn how to use Snap packages on Ubuntu.
Prerequisites
- An Ubuntu system
- Access to the command line
- An account with sudo or root privileges
- Snap installed and configured
How to Use Snap Packages?
Manage Snap packages in two ways – by running snap commands in the terminal or by using the Snap Store GUI app.
The Snap Store is a snap app itself. Install it by entering the following command in the terminal:
sudo snap install snap-store
After the installation finishes, open it by entering the app name snap-store
.
Install Snap Apps
Install a snap app using the terminal, or use the store if you prefer a graphical environment.
To install a snap using the terminal you need to know the exact app name. The general syntax for installing snap packages is:
sudo snap install <package_name>
Instead of <package_name>
write the name of the snap app you want to install. For example:
- Install Using the Snap Store
To install a snap using the Snap Store app, follow these steps:
1. Open the Snap Store by entering snap-store
in the terminal.
2. Click the app you want to install.
3. Select Install and enter your password. Wait for the download to finish.
Snap Confinement
Snap confinement describes the level of isolation of a snap on your system. The levels are:
- Strict. Most snaps belong in this level. They run in complete isolation and cannot access your resources without requesting it.
- Classic. The classic confinement level gives snaps the same access to system resources as traditional packages have. Installing a classic snap requires manual approval using the
--classic
command line argument. - Devmode. Reserved for snap creators and developers. A snap with devmode confinement level runs as a strictly confined snap, but has full access to system resources, and provides a debug output. Installing a devmode snap requires the
--devmode
command line argument. Devmode snaps don’t appear in search results and cannot be released to the stable channel.
Note: Snap is similar to apt. The basic difference is that snaps remain confined in the .snap package on the system, while the apt package manager integrates the required app dependencies on the system. Read our article to learn more about the differences between snap and apt.
Run Snaps
Run snaps in two ways:
To run a snap via the terminal, enter the package name in the terminal.
For example, enter snap-store
to open the Snap Store app.
Note: If you get theme parsing errors when launching some snaps, this is due to incompatibilities between the fontconfig library in the snap and the hosts fontconfig. This is a known issue, and the app opens normally anyway.
- Run Apps from the Desktop
Another way to run a snap is to search for the app in the app menu and launch it from there.
Note that it takes some time for the app to open the first time you run it. Subsequent runs are much faster.
List Installed Snaps
See a list of installed snaps in two ways:
- List Installed Snaps in the Terminal
To list installed snaps using the terminal, use the list
command:
snap list
This shows a list of installed snaps, including the app version, revision number, snap confinement level, publisher and app notes.
- List Apps in the Snap Store
Launch the Snap Store and click the Installed tab. That lists all snap apps on your system.
Search for Snaps
- Search for an app via the Terminal
Run the snap find
command to search for an application. The search term doesn’t need to match the name of the application. For example, you can search for a media player by typing “media_player”.
snap find <search_term>
The <search_term>
syntax implies entering a keyword or search phrase. Separate words in a phrase using an underscore _
.
- Search for an App via GUI
Search for an app by entering the keyword in the search box of the Snap Store or browse the available categories.
Update Snaps
Snaps automatically update to the latest available version each day. To update snaps manually, use the terminal or the Snap Store.
Check for updates for a single app or see all available updates:
1. Update a single app.
sudo snap refresh <package_name>
2. Enter your password and the update process starts.
This updates the app or informs the user that the latest version is already installed.
To see which snap packages have available updates, use the command below:
sudo snap refresh --list
The output lets you know if there are any updates available for your installed snaps.
- Update Snaps via the Snap Store
For a visual approach to updating apps, enter the Snap Store and click the Updates tab. Available updates are displayed.
Downgrade Snaps
If you encounter issues after updating a snap to its latest version, or if you do not like the new update for any reason, revert to the previous one by entering the snap revert
command:
sudo snap revert <package_name>
Important: This is only possible if you had the app’s previous version on your system. Otherwise, you get an error saying that there is no revision to revert to. This also works when you try a beta version of an app and want to revert to the stable one.
Remove Snaps
- Remove Snap Packages via the Terminal
To remove a snap from the system, use the following command:
sudo snap remove <package_name>
The procedure also removes all previous revisions. To remove a specific version, use the same command and add the --revision=<revision-number>
argument.
Once an app is removed, a snapshot of the snap’s system, configuration and user data remains for 31 days.
To remove a snap without generating a snapshot, add the --purge
argument to the remove
command:
sudo snap remove <package_name> --purge
- Remove Snap Package in the Snap Store
To remove a snap using the Snap Store:
1. Select the Installed tab.
2. Find the app you want to remove and click the Remove button.
Enable and Disable Snaps
If you don’t need a snap, but you don’t want to remove it from your system entirely, disable it by entering:
sudo snap disable <package_name>
Enable a disabled snap with the following command:
sudo snap enable <package_name>
List All Running Services
Snap allows you to see the services initiated by snap apps.
Use the command snap services
to list all system services launched by snap packages currently installed and enabled on your system:
The output shows the service name, whether it launches on system startup, if it’s currently running and any notes available.
To list the services of a single snap, state the package name in the command:
snap services <package_name>
Start, Restart, and Stop Snap Services
After making changes to a snap app, restart snap services for the changes to take effect.
To restart all services, enter the following command:
sudo snap restart <package_name>
This restarts all services for a specified snap.
To restart a specific individual service of an app, use the same command with the service name:
sudo snap restart <service_name>
To stop all snap services, use the following command:
sudo snap stop <package_name>
To stop a snap’s single service, enter the following:
sudo snap stop <service_name>
Note: If you manually stop snap services the snap app may malfunction. To temporarily disable a snap, use the --disable
command instead.
To prevent a snap service from starting on boot, add the --disable
argument:
sudo snap stop --disable <service_name>
Use the command sudo snap start <package_name>
to start all snap services:
On the other hand, to start an individual snap service, use the following command:
sudo snap start <service_name>
The start
command includes an --enable
option to re-enable the automatic starting of a service on system boot.
For a service to start on next boot, add the --enable
argument:
sudo snap start --enable <service_name>
Download and Install Snap Apps Offline
To install snap apps on a system without Internet access, first download the necessary files on a machine with Internet connection.
To download a snap package, use the following command:
snap download <package_name>
The system downloads two files to your $HOME directory – a .assert and a .snap file.
Note: It is advisable to also download and install the “core” and “gnome-3-26-1604” snaps if they are not already present on the target system. This is because some GNOME snaps require them to function properly.
1. Copy the downloaded files to the $HOME directory of the machine on which you want to install the app.
2. Install the packages using the following commands:
sudo snap ack <package_name.assert>
sudo snap install <package_name.snap>
Modify Snap Configurations
Snaps that provide background services allow you to see and change their configuration options.
To see a snap’s configuration options, use the sudo snap get <package_name>
command.
The output shows available configuration options of the specified snap. A {...}
in the output indicates that there are further options below the current key level.
The output also indicates if the specified app does not have configuration options.
To explore additional options, add the key name to the previous command:
sudo snap get <package_name> <key_name>
- Change Configuration Options
To change a snap’s configuration option, use the command:
sudo snap set <package_name> <key_name>=<value>
To restore a value to its default state, use the following:
sudo snap unset <package_name> <key_name>
Alternatively, to restore a value to its default stage, use the set command but add !
at the end of the key name to restore the default value:
sudo snap set <package_name> <key_name>!
Combine !
with other setting options at the same time:
sudo snap set <package_name> <key_name>! <key_name2>=<key_value>
The system checks the configuration update. If you enter a wrong value, the system detects the error and cancels the change, reverting to the previous configuration.
Note: If the update takes longer than 5 minutes, it automatically aborts and rolls back the configuration options.
Display History of Changes Made to Your System
Snap allows the user to see the history of changes it has made on the system.
Use the snap changes
command to see a full list of changes in your system.
The output shows when the change took place, its status, and a summary of what happened.
Switch Channels
Snap apps are available in several channels, depending on the apps’ development status. Switch between these channels, for example, to access a beta version of the app. Switching channels is similar to switching branches in git.
There are four available channels:
- stable: The latest stable release of an app. Should not have any bug.
- candidate: The release candidate (RC) of an app, close to a stable version.
- beta: Unstable version, users still encounter bugs.
- edge: Daily/nightly builds of an app under development.
To change to a different channel, use the following command:
sudo snap refresh <package_name> --channel=<channel_name>
After switching the channel, the specified app gets updates from that channel. To switch back to the previous one, use the refresh
command and enter the channel name.
Alternatively, use the revert
command.
Conclusion
You now know how to use Snaps on Ubuntu. You also know how to use the Snap Store, modify and adjust snap services and configurations to your own preference and choose the release you like.
Feel free to download and test different apps and settings. The number of apps available is constantly increasing and snap development has picked up speed in recent years, with an audience of millions in the Snap Store. To learn more about package managers and different package formats in Linux, check out our Flatpak vs. Snap vs. AppImage comparison article.
A Comprehensive Guide to Using Snap Packages on Ubuntu
Ubuntu is one of the most popular Linux distributions, and it has a great package manager called Snap. Snap packages are a great way to install and manage software on Ubuntu. In this guide, we’ll show you how to use Snap packages on Ubuntu.
What are Snap Packages?
Snap packages are a type of software package that is designed to be installed and managed on Ubuntu. They are similar to other package formats, such as .deb and .rpm, but they are designed to be more secure and easier to manage. Snap packages are self-contained, meaning that they include all of the necessary files and dependencies for the software to run.
Installing Snap Packages
Installing Snap packages on Ubuntu is easy. All you need to do is open a terminal window and type the following command:
sudo snap install
Replace
sudo snap install vlc
Once the package is installed, you can launch it from the Ubuntu Dash or from the command line. To launch it from the command line, type:
vlc
Updating Snap Packages
Snap packages are designed to be easy to update. To update all of your installed Snap packages, open a terminal window and type the following command:
sudo snap refresh
This will update all of your installed Snap packages to the latest version. You can also update individual packages by typing the following command:
sudo snap refresh
Replace
sudo snap refresh vlc
Removing Snap Packages
Removing Snap packages is just as easy as installing and updating them. To remove a package, open a terminal window and type the following command:
sudo snap remove
Replace
sudo snap remove vlc
Conclusion
Snap packages are a great way to install and manage software on Ubuntu. They are secure, easy to install, and easy to update. In this guide, we’ve shown you how to use Snap packages on Ubuntu. If you have any questions or comments, please let us know in the comments below.