Installing snap on Debian

I’m installing snapd on Debian 10 right now
Issuing “snap install core” as non-root gives an error:

$ snap install core
error: access denied (try with sudo)

Went fine with sudo:

$ sudo snap install core
2020-11-14T09:24:02+01:00 INFO Waiting for restart...
core 16-2.47.1 from Canonical✓ installed
Channel latest/stable for core is closed; temporarily forwarding to stable.

It seems I have to use sudo even the hello-world example.

$ snap install hello-world
error: access denied (try with sudo)

Googling a bit, it seems kind of normal, but

  • it’s not clear in https://snapcraft.io/docs/installing-snap-on-debian because sudo was explicitly mentionned for the first few commands, and isn’t anymore for “snap install”.
  • I also saw a mention of “snap login” (see "sudo snap install" or just "snap install"?) which, I guess, will allow installing software for just that one user. I’m not sure why creating an account is necessary for installing as a user, and is not necessary when using sudo, though.

Hello! Thanks for mentioning this - the docs above are actually a little wrong/misleading. You’re right that you need to use sudo when installing packages (or you should be prompted to authenticate with your password) unless you create an account on https://login.ubuntu.com and use ‘snap login’ to authenticate the user with the Snap Store. I’ll update the docs.

1 Like

Hello everyone,

I am stuck installing Snap on a Debian 9 (Stretch) server. I did it successfully on another server a few months ago, so I am at loss on why it does not work this time. Note that I am not a Debian guru, just a casual admin.

Details:

After installing snapd as indicated in the documentation, I failed installing core:

# snap install core
error: cannot perform the following tasks:
- Mount snap "core" (10958) ([start snap-core-10958.mount] failed with exit status 1: Job for snap-core-10958.mount failed.
See "systemctl status snap-core-10958.mount" and "journalctl -xe" for details.
)

The systemctl and journalctl commands are not that helpful:

# systemctl status snap-core-10958.mount
● snap-core-10958.mount - Mount unit for core
   Loaded: loaded (/etc/systemd/system/snap-core-10958.mount; enabled; vendor preset: enabled)
   Active: failed (Result: exit-code) since Sat 2021-05-08 09:51:47 CEST; 59s ago
    Where: /snap/core/10958
     What: /var/lib/snapd/snaps/core_10958.snap
  Process: 24452 ExecMount=/bin/mount /var/lib/snapd/snaps/core_10958.snap /snap/core/10958 -t squashfs (code=exited, status=32)

May 08 09:51:47 xxxxxx.ip-176-31-100.eu systemd[1]: Mounting Mount unit for core...
May 08 09:51:47 xxxxxx.ip-176-31-100.eu systemd[1]: snap-core-10958.mount: Mount process exited, code=exited status=32
May 08 09:51:47 xxxxxx.ip-176-31-100.eu systemd[1]: Failed to mount Mount unit for core.
May 08 09:51:47 xxxxxx.ip-176-31-100.eu systemd[1]: snap-core-10958.mount: Unit entered failed state.

May 08 09:51:35 xxxxxx.ip-176-31-100.eu /usr/lib/snapd/snapd[632]: api.go:879: Installing snap "core" revision unset
May 08 09:51:35 xxxxxx.ip-176-31-100.eu snapd[632]: 2021/05/08 09:51:35.619587 api.go:879: Installing snap "core" revision unset
May 08 09:51:35 xxxxxx.ip-176-31-100.eu /usr/lib/snapd/snapd[632]: daemon.go:176: DEBUG: uid=0;@ POST /v2/snaps/core 275.754893ms 202
May 08 09:51:35 xxxxxx.ip-176-31-100.eu /usr/lib/snapd/snapd[632]: taskrunner.go:353: DEBUG: Running task 91 on Do: Download snap "core" (10958) from channel "stable"
May 08 09:51:46 xxxxxx.ip-176-31-100.eu /usr/lib/snapd/snapd[632]: taskrunner.go:353: DEBUG: Running task 92 on Do: Fetch and check assertions for snap "core" (10958)
May 08 09:51:46 xxxxxx.ip-176-31-100.eu /usr/lib/snapd/snapd[632]: taskrunner.go:353: DEBUG: Running task 93 on Do: Mount snap "core" (10958)
May 08 09:51:47 xxxxxx.ip-176-31-100.eu systemd[1]: snapd.refresh.timer: Adding 15min 20.225145s random time.
May 08 09:51:47 xxxxxx.ip-176-31-100.eu systemd[1]: snapd.refresh.timer: Adding 2h 54min 15.574454s random time.
May 08 09:51:47 xxxxxx.ip-176-31-100.eu /usr/lib/snapd/snapd[632]: task.go:303: DEBUG: 2021-05-08T09:51:47+02:00 ERROR [start snap-core-10958.mount] failed with exit status 1: Job for snap-core-10958.mount failed.
May 08 09:51:47 xxxxxx.ip-176-31-100.eu /usr/lib/snapd/snapd[632]: taskrunner.go:353: DEBUG: Running task 91 on Undo: Download snap "core" (10958) from channel "stable"

Information about my system:

# uname -a
Linux xxxxxx.ip-176-31-100.eu 4.19.62-mod-std-ipv6-64-rescue #828825 SMP Tue Jul 30 13:54:49 UTC 2019 x86_64 GNU/Linux

Information about my snapd installation:

# snap version
snap    2.21-2+deb9u1
snapd   2.21-2+deb9u1
series  16
debian  9

FWIW, I have the squashfs-tools Debian package installed.

# cat /proc/filesystems
nodev	sysfs
nodev	rootfs
nodev	ramfs
nodev	bdev
nodev	proc
nodev	cpuset
nodev	cgroup
nodev	cgroup2
nodev	tmpfs
nodev	devtmpfs
nodev	binfmt_misc
nodev	configfs
nodev	securityfs
nodev	sockfs
nodev	dax
nodev	bpf
nodev	pipefs
nodev	hugetlbfs
nodev	rpc_pipefs
nodev	devpts
	reiserfs
	ext3
	ext4
	ext2
	cramfs
	vfat
	msdos
	iso9660
nodev	ecryptfs
nodev	nfs
nodev	nfs4
nodev	nfsd
nodev	cifs
nodev	smb3
	ntfs
	ufs
	romfs
nodev	autofs
	fuseblk
nodev	fuse
nodev	fusectl
	udf
	xfs
nodev	ceph
nodev	aufs
nodev	mqueue
	btrfs
nodev	pstore

I did not find anything meaningful on the 'Net, so I must conclude that my case is pretty rare :cry: Any help would be greatly appreciated because I cannot install Cerbot on my server because of this. Thanks in advance! -Yann

I was a bit confused by the documentation - installation went well, but running the hello-world program is possible on my Debian 10 installation (bare server) only with “snap run hello-world”, not with “hello-world” directly.

It might be good to mention this second option.

snapd adds /snap/bin to your PATH when you install it … but changes to the PATH variable are only applied at login time and require you to log out and back in to take effect…

this should be added to the doc …

I was just in the process of checking Debian 10 to see if anything had changed, but we do mention the path requirement:

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

I’ll make this is bolder/easier to notice. (edit: I’ll also add a link to Troubleshooting as this mentions similar things and might provide some broader help too)

1 Like

oops, yeah that will help, i definitely glanced over the text before i wrote the above and did not catch it with a quick look …

Any ideas about my Debian 9 failure of mounting core? See details above.
Thanks in advance

you seem to use some home-brewed kernel that has no squashfs support enabled (seeing its version signature i wonder if just switching to a non -rescue variant might help here) … snap packages are squashfs filesystem images, so you need this bit of kernel support, ask whoever maintains your kernel to enable it.

Thanks for your reply Ogra! Unfortunately, this is a Kimsufi server provided by OVH, they won’t change their kernel. I guess I’ll have to forget about snapd and find another solution to install Cerbot. Cheers

Question: is there a reason core is specified, as opposed to core18 or core20? Are those not built with snapd included?

yes, with core18 snapd got moved into its own snap … you would likely also be able to snap install core18 snapd to get a working system with latest snapd … but chances are good that you will eventually install an app snap that uses core as a base anyway and pulls it in…

1 Like

Ah, I see. And do modern versions of snapd as packaged by distros include a hook to install the snapd snap? And thus is Debian’s current snapd too old to include this hook?

Hey, I think this error should go to the Debian installation documentation under Troubleshooting heading. It is the same error @YannZeRookie was having:

# snap install core
error: cannot perform the following tasks:
- Mount snap "core" (11606) ([start snap-core-11606.mount] failed with exit status 1: Job for 
snap-core-11606.mount failed.
See "systemctl status snap-core-11606.mount" and "journalctl -xe" for details.
)

It means FUSE is not enabled in the kernel OR squashfuse and fuse packages are not installed.

Next error in line is that the squashfuse package is not available in my Debian 9 sources…

root @ kub1x ~ # apt update
(...)
Reading package lists... Done 
Building dependency tree       
Reading state information... Done
All packages are up to date.

root @ kub1x ~ # apt install squashfuse fuse
Reading package lists... Done
Building dependency tree       
Reading state information... Done
E: Unable to locate package squashfuse

I’ll update this once I find, where to get the thing. So far no luck.

EDIT:
Something in my sources was too restrictive. Adding this line to /etc/apt/sources.list and running apt update added the squashfuse package and snap install core now finally works.

deb http://ftp.debian.org/debian stable main contrib non-free

It took me few hours to figure out FUSE is missing, first in kernel, then installed, then as package, then as repo in sources.list. Would be nice to have this documented in troubleshooting section of the Debian installation manual of snap.

I think many people install snap just to install certbot with it, just like me now, and all this extra trouble feels just like a unnecessary burden.

the official debian kernels do all come with fuse support by default, is that an actual debian install ? what is the full output of snap version ?

It is my VPS server with Debian 9. Some kernel features (FUSE, KVM, NFS, …) are optional (controlled by web control panel of the VPS) and all of it is off by default. The only way to figure out FUSE is the missing bit is to google the error of broken mount.

Newbie with simple problem - the test doesn’t work?

~$ sudo apt update ... ~$ sudo apt install snapd ~$ sudo snap install core 2022-10-28T12:28:37Z INFO Waiting for restart... core 16-2.57.2 from Canonical✓ installed Channel latest/stable for core is closed; temporarily forwarding to stable. ~$ sudo snap install hello-world hello-world 6.4 from Canonical✓ installed ~$ hello-world -bash: hello-world: command not found

I just tried running:

but ‘hello-world’ still doesn’t run from the command line. From this documentation it seems like it should? What to do if it doesn’t? Please advise.

Oh this system needs double new lines? In that case:

~$ sudo apt update

...

~$ sudo apt install snapd

~$ sudo snap install core

2022-10-28T12:28:37Z INFO Waiting for restart...

core 16-2.57.2 from Canonical✓ installed

Channel latest/stable for core is closed; temporarily forwarding to stable.

~$ sudo snap install hello-world

hello-world 6.4 from Canonical✓ installed

~$ hello-world

-bash: hello-world: command not found

since you have not rebooted, the new /etc/environment (or environment.d/) has not been picked up so the addition of /snap/bin to your PATH has not happened …

i.e. see the bold printed:

in the instructions …

to run hello-world anyway you can use snap run hello-world though