Can't re-install existing snap

It appears snap gets confused when installing a snap that’s already installed:

$ sudo cp /var/lib/snapd/snaps/snapcraft_417.snap /run/
[sudo] password for cris: 
$ snap install /run/snapcraft_417.snap --classic
error: cannot perform the following tasks:
- Copy snap "snapcraft" data (cannot copy "/home/cris/snap/snapcraft/417" to "/home/cris/snap/snapcraft/417": failed to copy all: "cp: cannot stat '/home/cris/snap/snapcraft/417': No such file or directory" (1))
$ snap remove snapcraft
snapcraft removed
$ snap install /run/snapcraft_417.snap 
error: cannot perform the following tasks:
- Mount snap "snapcraft" (417) (snap "snapcraft" requires classic confinement)
$ snap install /run/snapcraft_417.snap --classic
snapcraft 2.33+git34.5887a82 from 'canonical' installed

This is a problem for snapcraft which pushes snaps from the host into containers to ensure they’re updated.

$ snap version
snap    2.26.14
snapd   2.26.14
series  16
ubuntu  16.04
kernel  4.4.0-87-generic

I can reproduce both in a clean LXD instance as well as my native host machine used for development (same “version” output).

Thanks for the report. We’ll get that fixed.

Yeap! This was fixed recently (in #3611, merged about a month ago so 2.27 should have it I think)

~$ snap install test-snapd-tools
test-snapd-tools 1.0 from 'canonical' installed
~$ cp /var/lib/snapd/snaps/test-snapd-tools_6.snap .
~$ snap install ./test-snapd-tools_6.snap 
test-snapd-tools 1.0 from 'canonical' installed
2 Likes

Even with core 16-2.27.4 from the beta channel the problem persists - as far as I understand the snapd from the core snap should be used then via the re-exec feature?

“snap version” will tell you, it always reports the actual running version

Indeed snap version seems to agree with my assumption, I’m just wondering because it still doesn’t work.

$ snap refresh core --beta
core (beta) 16-2.27.4 from 'canonical' refreshed
$ snap install /run/snapcraft_417.snap --classic
error: cannot perform the following tasks:
- Copy snap "snapcraft" data (cannot copy "/var/snap/snapcraft/417" to "/var/snap/snapcraft/417": failed to copy all: "cp: cannot stat '/var/snap/snapcraft/417': No such file or directory" (1))
$ snap version
snap    2.27.4
snapd   2.27.4
series  16
ubuntu  16.04
kernel  4.4.0-87-generic

could you try core from edge?

$ snap refresh core --edge
core (edge) 16-2.27.3+git330.59ff0b1 from 'canonical' refreshed
$ snap install /run/snapcraft_417.snap --classic

That one appears to work. Thanks! From the version shown by snap info I thought it was an older one, but it seems to have the fix.

I’m not sure what’s going on with the version, indeed, but that’s a separate issue. Could you mark the topic “solved”?

the version is the master git commit on top of the last release … so 2.27.3-gitF003AR is correct … once .4 is in stable it should move on

1 Like