Snap packages isolate applications and their dependencies, sidestepping the compatibility headaches that often come with traditional Linux package managers. By bundling everything an app needs to run, Snaps prevent version conflicts and system instability, making them a practical choice for both desktop and server environments. Optimizing Snap management not only minimizes downtime but also keeps your system secure and up to date with minimal manual intervention.

Install and Set Up Snapd

Step 1: Verify if snapd is already installed by running:

snap version

If the output displays version information, you’re ready to use Snap. If not, install Snapd on Ubuntu with:

sudo apt update
sudo apt install snapd

Older Ubuntu versions may require a symbolic link for the Snap command:

sudo ln -s /var/lib/snapd/snap /usr/bin/snap

Install Snap Packages

Using the Terminal

Step 1: Find the desired package. To search for available Snaps, use:

snap find [search_term]

Replace [search_term] with a keyword or application name. This command lists matching packages with summaries and publishers, helping you identify trusted software.

Step 2: Install the package with:

sudo snap install [package_name]

For packages requiring broader system access, add the --classic flag:

sudo snap install [package_name] --classic

This is common for development tools and IDEs.


Using the Snap Store GUI

Step 1: If the Snap Store app isn’t installed, add it with:

sudo snap install snap-store

Step 2: Open the Snap Store from your applications menu or by running:

snap-store

Step 3: Use the search bar to locate your desired app, click its entry, then select Install and authenticate if prompted. The app will download and install automatically.


Update Snap Packages

Using the Terminal

Step 1: To update all installed Snaps to their latest versions, run:

sudo snap refresh

Step 2: To update a specific package, use:

sudo snap refresh [package_name]

Step 3: Check for available updates with:

sudo snap refresh --list

Using the Snap Store GUI

Step 1: Open the Snap Store and navigate to the Manage or Installed tab.

Step 2: Click Check for updates. Available updates will be listed; follow prompts to apply them.


Remove or Disable Snap Packages

Remove a Snap via Terminal

Step 1: Uninstall a Snap with:

sudo snap remove [package_name]

To permanently delete all user data and configuration, add the --purge flag:

sudo snap remove [package_name] --purge

Note: On Ubuntu 24.04 and newer, sudo snap remove [package_name] fully removes the app.


Disable or Enable a Snap

Step 1: Temporarily deactivate a Snap without uninstalling:

sudo snap disable [package_name]

This frees up system resources while keeping the app installed for future use.

Step 2: To reactivate the Snap, run:

sudo snap enable [package_name]

List and Inspect Installed Snaps

Step 1: View all installed Snaps and their details:

snap list

This displays package names, versions, publishers, and confinement modes.

Step 2: For more information on a specific Snap, use:

snap info [package_name]

This reveals version history, available channels, publisher, and confinement details.


Manage Snap Services

Some Snaps run background services essential for their operation. Managing these services helps control resource usage and troubleshoot issues.

Step 1: List all running Snap services:

snap services

To view services for a specific Snap:

snap services [package_name]

Step 2: Start a Snap service:

sudo snap start [service_name]

Step 3: Stop a Snap service:

sudo snap stop [service_name]

Step 4: Restart a Snap service after configuration changes:

sudo snap restart [service_name]

Offline Snap Installation

For systems without internet access, download Snaps and their assertion files on a connected machine.

Step 1: Download the package and assertion file:

snap download [package_name]

Transfer both .snap and .assert files to the offline system.

Step 2: On the offline machine, acknowledge the assertion:

sudo snap ack [package_name].assert

Step 3: Install the Snap package:

sudo snap install [package_name].snap

Modify Snap Configuration

Some Snaps support custom configuration for advanced use cases.

Step 1: View current configuration options:

snap get [package_name]

Step 2: Change a configuration value:

sudo snap set [package_name] [key]=[value]

For example, to set a refresh timer for automatic updates:

sudo snap set core refresh.timer=00:00-04:00

Step 3: Remove a configuration setting to revert to default:

sudo snap unset [package_name] [key]

Switch Snap Channels and Roll Back Updates

Snaps offer multiple release channels—stable, candidate, beta, and edge—allowing you to choose between stability and cutting-edge features.

Step 1: Switch a Snap to a different channel:

sudo snap refresh [package_name] --channel=[channel]

For example, to move to the beta channel:

sudo snap refresh [package_name] --channel=beta

Step 2: If a new version causes problems, revert to the previous one:

sudo snap revert [package_name]

Understand Snap Confinement Levels

  • Strict: The default. Snap runs in full isolation, accessing only permitted system resources. Ideal for most desktop and server apps.
  • Classic: Grants the Snap access to the entire system, similar to traditional packages. Use only when required by the application (e.g., development tools).
  • Devmode: For development and debugging. Not for production or general use.

Check a Snap's confinement with:

snap info [package_name]

Mastering Snap package management in Ubuntu cuts down on software conflicts, automates updates, and keeps your environment consistent across systems. Regularly review installed Snaps and update or remove what you no longer need to keep your system running smoothly.