How Many Available Snap Packages?

by mmyoji

4 min read

tl;dr

  • snap(snappy) on Linux is a package manager like apt or apt-get.
  • (FOR ME,) there are few available snap packages yet.

My Story

Sometimes I met the following messages in my Ubuntu terminal:

$ foo

Command 'foo' not found, did you mean:

  command 'roo' from snap roo (2.0.3)
  command 'fgo' from deb fgo
  command 'fox' from deb objcryst-fox
  command 'woo' from deb python-woo
  command 'fio' from deb fio
  command 'goo' from deb goo
  command 'fop' from deb fop
  command 'fog' from deb ruby-fog

See 'snap info <snapname>' for additional versions.

What is the snap?

I'd ignored this type of messages and I hadn't known about snap command.

Today I googled it and found what it is.

Snap is a package manager for Linux

Snappy (package manager) - Wikipedia

I couldn't find the official page of this package manager.

The Wikipedia says:

Snappy is a software deployment and package management system originally designed and built by Canonical for the Ubuntu phone operating system.

And this comment on StackExchange is really understandable about snap:

apt - Why is Ubuntu moving to Snappy packages? - Ask Ubuntu

If I create a deb package for Ubuntu 16.04 then that package won't work on any version of Ubuntu. I also have to make a 14.04, 15.04, 15.10, and so on. These are JUST Ubuntu debs.

This means if I want to release a new version of an application and not wait on distro maintainers to include it in a repository (which usually takes an absurd amount of time) then I have to provide over 20 packages to cover the majority of Linux distros and still that's not going to be covering everything. Ubuntu's Snaps provide a way to create one Snap that runs on every version of Ubuntu that supports Snaps. No longer distro version specific.

The following site explains very well about the usage of snap command:

Complete Guide for Using Snap Packages In Ubuntu and Other Linux Distributions | It's FOSS

I like the rollback(revert) feature very much :)

How many apt packages can be replaced by snap?

snap is not replacement of apt nor apt-get, but I like its features and want to use this as much as possible.

I'm now using Ubuntu 18.04 for my usual development environment and I tried to do that.

First, I listed up the apt packages which is installed on my laptop.

$ apt list --installed > myaptpacakges.txt

Do not forget --installed option, or you will get ALL the packages available on apt world.

apt - How to list all installed packages

Next, I try to check with snap find <query>, whether the apt package is available on snap or not.

I found there are some packages on snap:

  • aws-cli
  • chromium
  • docker
  • firefox
  • spotify
  • tmux

I omit packages whose publisher is apparently unofficial (like neovim).

aws-cli

I'd installed awscli before through the official instruction using pip and uninstalled it first.

Then I installed and got an error:

$ sudo snap install aws-cli
error: This revision of snap "aws-cli" was published using classic confinement and thus may perform
       arbitrary system changes outside of the security sandbox that snaps are usually confined to,
       which may put your system at risk.

       If you understand and want to proceed repeat the command including --classic.

This message sounds like unpreferrable, and I quit to install packages which requires --classic option now. (tmux is the same.)

Chromium

I am a Firefox user and I sometimes use Chrome just for debug.

Through the apt system, I'd installed google-chrome-stable then uninstalled it and install chromium but this crashed on the application boot phase.

This is my fisrt time to use chromium and I don't want to take time to survey the bug or something, and soon back to the google-chrome-stable of apt.

docker

The pubclsher seems official but has no offcial mark, and I avoid installing it at this time.

$ snap find docker
Name             Version     Publisher              Notes    Summary
docker           17.06.2-ce  docker-inc             -        The docker app deployment mechanism
img              0.4.6       bashfulrobot           -        Unprivileged Dockerfile & OCI compatible container img builder.
dry              0.9-beta.5  monch0                 -        A Docker manager for the terminal
kata-containers  1.2.0       katacontainers✓        classic  Lightweight virtual machines that seamlessly plug into the containers ecosystem
kube-proxy       1.11.3      canonical✓             classic  Kubernetes network proxy runs on each node.

Firefox

This works well, finally!

# uninstall
$ sudo apt remove -y firefox
4 sudo apt autoremove -y
# It depends on your environment.
$ sudo apt remove -y firefox-locale-en firefox-locale-ja

# install snap's one
$ sudo snap install firefox

Don't forget to change the default browser settings to Firefox.

Spotify

The apt version was spotify-client and I uninstalled it.

$ sudo snap install spotify works fine and the app also works with no problem!

Conclusion

Just for me, firefox and spotify-client can be replaced by snap now.

I don't know there would be more packages available on snap platform in future, but I wish it will.

I will try to use snap command first when I need a new package on my machine from now on.