Installing snap on Debian

On Debian 10 (Buster) and Debian 9 (Stretch), snap can be installed directly from the command line:

sudo apt update
sudo apt install snapd

If the sudo command isn’t installed (usually because a root password was provided at install time), you can install snap by first switching to the root account:

$ su root
# apt update
# apt install snapd

Either log out and back in again, or restart your system, to ensure snap’s paths are updated correctly.

After this, install the core snap in order to get the latest snapd.

$ sudo snap install core
core 16-2.45.2 from Canonical✓ installed

:information_source: Note: some snaps require new snapd features and will show an error such as snap "lxd" assumes unsupported features" during install. You can solve this issue by making sure the core snap is installed (snap install core) and it’s the latest version (snap refresh core).

To test your system, install the hello-world snap and make sure it runs correctly:

$ sudo snap install hello-world
hello-world 6.3 from Canonical✓ installed
$ hello-world
Hello World!

Snap is now installed and ready to go! If you’re using a desktop, a great next step is to install the Snap Store app.

Snap is currently unavailable on versions of Debian prior to 9.

Debian 10 chmod errors:

There is a known issue affecting some Debian 10 users with snaps that depend on browser-sandbox, such as Microsoft Teams. The issues can be bypassed with the following command:
sudo sysctl kernel.unprivileged_userns_clone=1

2 Likes

Really - - - this is incomplete!
With installation instructions should come instructions for removing snap(d).
This is going to be complicated by the ‘special’ snaps which are not possible to be removed in any kind of ‘regular’ fashion.

could you expand on what you mean by this?

This is going to be complicated by the ‘special’ snaps which are not possible to be removed in any kind of ‘regular’ fashion.

could you expand on what you mean by this?

The LXD dev team has indicated that the ‘snap’ is a special model (prepared upon their request). So to remove this snap first LXD must be removed (its a complicated process) otherwise it is not possible to remove the lxd/snapd environment. This means that doing snap remove and then apt remove followed by purge snapd just doesn’t remove all of the included and created bits.

Probably also worth mentioning (as discussed elsewhere on this forum) that snapd only works on Debian 9 and higher, and not on Debian 8.

1 Like

That’s funny, as I’ve installed and removed lxd lots of times without having to go through the hoops you’re describing.

In any case, do you seriously think that all that minutia around removing a particular snap is appropriate for a tutorial on how to install snapd?

1 Like

Of course its not important to mention any possibility of problems. It might detract from the financial viability of the project.

Sorry I disturbed you with the facts from my experience.

PS
In my experience business users want to know if there might be any particular problems in both the installation AND the removal of any particular feature of anything.

I’m sorry you felt that @chipaca’s last post was curt, aggressive, or attacking. I’m sure that wasn’t the intention. Can we step back a moment to recollect ourselves? :slight_smile:

I propose that uninstallation of snapd could be added as a separate document to satisfy those that require more up-front information before jumping in.

With regard to the LXD issue you had with removing the LXD snap, this is probably a bug and should be discussed in a new topic in the snap category so that we can understand what failed to be removed and queue-up fixes to either snapd or the LXD snap to mitigate the problem in the future.

2 Likes

Hello. This states that snap is available on debian 9 and higher, but I’ve tried to install it on buster and I’ve encountered a broken packages error:

snapd : Depends: apparmor (>= 2.10.95-0ubuntu2.2) but it is not going to be installed
         Depends: snap-confine (= 2.21-2+b1) but it is not going to be installed
         Depends: ubuntu-core-launcher (= 2.21-2+b1) but it is not going to be installed

Obviously the “ubuntu-core-launcher” seems like a weird package to be needed on Debian.

edit: I’ve tried apt clean, apt update and apt upgrade, the error stayed the same.

How were you trying to install the snapd package? This does not look like
the output of ‘apt install snapd’ on a buster system. The snapd 2.37.4-1
package in buster does not depend on snap-confine or ubuntu-core-launcher,
these are dependencies of the version of the package in stretch.

I am attempting to install hello-world and it fails everytime, I’ve also attempted many other snaps with only failure, I am runninng Debian GNU/Linux 9.9 (stretch) any suggestions?

sudo snap install hello-world
error: cannot perform the following tasks:

I downloaded it without the : at the end though I have no idea how to install that file into snap

99T7MUlRhtI3U0QFgl5mXXESAiSwt776_7396.snap 88.7MB type SNAP File

Hello - sorry to hear you’re having problems. I just ran through this on a fresh Debian GNU/Linux 9.9 installation (admittedly on a VM) and didn’t experience any issues - hello-world installed and ran as expected. I did need to update the path/reboot - which we should add to the instructions - but that wouldn’t cause the issue you’re seeing.

Maybe try removing the snap and installing again, in case of some weird network error?

Installing on PixelBook
Platform
12105.100.0 (Official Build) stable-channel eve

Reinstall linux
$ sudo apt update && sudo apt upgrade
Success
Restart
$ sudo apt install snapd
Success
$ sudo snap install hello-world
error: cannot perform the following tasks:

  • Mount snap “core” (7396) ([start snap-core-7396.mount] failed with exit status 1:
    Job for snap-core-7396.mount failed.
    See “systemctl status snap-core-7396.mount” and “journalctl -xe” for details.
    )

$ systemctl status snap-core-7396.mount
● snap-core-7396.mount - Mount unit for core
Loaded: loaded (/etc/systemd/system/snap-core-7396.mount; enabled; vendor preset
Active: failed (Result: exit-code) since Thu 2019-08-15 14:51:07 +07; 3min 8s ag
Where: /snap/core/7396
What: /var/lib/snapd/snaps/core_7396.snap
Process: 3273 ExecMount=/bin/mount /var/lib/snapd/snaps/core_7396.snap /snap/core
…skipping…
snap-core-7396.mount - Mount unit for core
snap-core-7396.mount - Mount unit for core
Loaded: loaded (/etc/systemd/system/snap-core-7396.mount; enabled; vendor preset
…skipping…
snap-core-7396.mount - Mount unit for core
Loaded: loaded (/etc/systemd/system/snap-core-7396.mount; enabled; vendor preset
Active: failed (Result: exit-code) since Thu 2019-08-15 14:51:07 +07; 28s ago
Where: /snap/core/7396
What: /var/lib/snapd/snaps/core_7396.snap
Process: 3273 ExecMount=/bin/mount /var/lib/snapd/snaps/core_7396.snap /snap/core
…skipping…
…skipping…

What does snap version say ? also … do you see squashfs in cat /proc/filesystems ?

I assume this is not a debian kernel you are using ?

see:

snap Version
snap 2.21-2+b1
snapd 2.21-2+b1
series 16
debian 9

Linux penguin 4.19.34-04457-g5b63d4390e96 #1 SMP PREEMPT Mon May 13 14:30:19 PDT 2019 x86_64 GNU/Linux

I just powerwashed my Pixel and attempted again to install hello-world and again with a failure with this message
sudo snap install hello-world
error: cannot perform the following tasks:

  • Mount snap “core” (7396) ([start snap-core-7396.mount] failed with exit status 1: Job for snap-core-7396.mount failed.
    See “systemctl status snap-core-7396.mount” and “journalctl -xe” for details.
    )

have you read the other thread ? and have you checked if your kernel supports squashfs ? it is very likely that the chromebook kernel misses ubuntu security features and squashfs support to make snap packages work at all on this device.

1 Like

I’m running Debian 9

sudo apt install squashfuse
Reading package lists… Done
Building dependency tree
Reading state information… Done
E: Unable to locate package squashfuse

so today I reinstalled Linux on my google pixelbook and installed snapd and installed hello world and
$ sudo snap install hello-world
error: cannot perform the following tasks:

@degville

It’s a bit counter-intuitive that both the regular user and the root prompt are $. Normally, the prompt becomes # when you’re running as root. Should the docs be updated to use # for the commands you run as root?

Good idea. I’ve updated this doc, and I’ll look for other examples (I don’t think there are too many). The only slight downside is the bash syntax highlighting interprets them as comments, but it should be fine in the few cases where we might use su.

1 Like