snap try doesn't work: "cannot find installed snap"

Bug #1800004 reported by Kyle Fazzari
14
This bug affects 3 people
Affects Status Importance Assigned to Milestone
snapd
Fix Released
Medium
Zygmunt Krynicki

Bug Description

It seems I can no longer use `snap try`. Or rather, running `snap try` succeeds, but then running any app looks like this:

$ my-snap-name.hello
cannot snap-exec: cannot read info for "my-snap-name": cannot find installed snap "my-snap-name" at revision x1: missing file /var/lib/snapd/snaps/my-snap-name_x1.snap

This snap is just a test I created in /tmp/foo:

$ ls -l /var/lib/snapd/snaps/my-snap-name_x1.snap
lrwxrwxrwx 1 root root 14 Oct 25 10:30 /var/lib/snapd/snaps/my-snap-name_x1.snap -> /tmp/foo/prime

$ mount | grep my-snap-name
/dev/mapper/ubuntu--vg-root on /snap/my-snap-name/x1 type ext4 (ro,relatime,errors=remount-ro,data=ordered,x-gdu.hide)
nsfs on /run/snapd/ns/my-snap-name.mnt type nsfs (rw)

$ snap --version
snap 2.35.4
snapd 2.35.4
series 16
ubuntu 18.04
kernel 4.15.0-36-generic

Zygmunt Krynicki (zyga)
Changed in snapd:
assignee: nobody → Zygmunt Krynicki (zyga)
Kyle Fazzari (kyrofa)
description: updated
Kyle Fazzari (kyrofa)
description: updated
Revision history for this message
Zygmunt Krynicki (zyga) wrote :

I can reproduce this problem with any trivial snap that is placed in /tmp. Outside of /tmp things work great. Looking at why.

Changed in snapd:
status: New → In Progress
importance: Undecided → Medium
Revision history for this message
Zygmunt Krynicki (zyga) wrote :

I was surprised to see this fail since the snap from /tmp/test-snapd-sh is bind-mounted to /snap/test-snapd-sh/x1. Yet at runtime this happens:

zyga@fyke:~$ SNAPD_DEBUG=1 test-snapd-sh
[snip, unrelated stuff]
DEBUG: execv(/usr/lib/snapd/snap-exec, /usr/lib/snapd/snap-exec...)
DEBUG: argv[1] = test-snapd-sh
cannot snap-exec: cannot read info for "test-snapd-sh": cannot find installed snap "test-snapd-sh" at revision x1: missing file /var/lib/snapd/snaps/test-snapd-sh_x1.snap
zyga@fyke:~$ ls -ld /var/lib/snapd/snaps/test-snapd-sh_x1.snap
lrwxrwxrwx 1 root root 18 Oct 25 20:49 /var/lib/snapd/snaps/test-snapd-sh_x1.snap -> /tmp/test-snapd-sh

So the snap "file" in /var/lib/snapd/snaps is a symbolic link. Why is it being looked at by snap-exec? No idea yet, checking.

Revision history for this message
Zygmunt Krynicki (zyga) wrote :

This happens because snap.ReadInfo tries to compute the size of the snap by stat-ing the broken symlink in /var/lib/snapd/snaps/. I have fixed this in https://github.com/snapcore/snapd/pull/6048

Zygmunt Krynicki (zyga)
Changed in snapd:
status: In Progress → Fix Committed
Zygmunt Krynicki (zyga)
Changed in snapd:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Duplicates of this bug

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.