Snapcraft unable to install core snap

Building a snap and suddenly snapcraft has broken and I can’t build anything.

Setting up squashfuse (0.1.100-0ubuntu1~ubuntu16.04.1) ...
Looking up assertion ['account-key', 'public-key-sha3-384=BWDEoaqyr25nF5SNCvEv2v7QnM9QsfCc0PBMYD_i2NGSQ32EF2d4D0hqUel3m8ul']
Looking up assertion ['snap-declaration', 'snap-name=core']
Looking up assertion ['snap-revision', 'snap-revision=3291', 'snap-id=99T7MUlRhtI3U0QFgl5mXXESAiSwt776']
Adding assertion core_3291.assert
Installing /run/core_3291.snap
error: cannot find signatures with metadata for snap "/run/core_3291.snap"
Stopping local:snapcraft-moronically-proequality-larraine

$ snap version
snap    2.29~rc1
snapd   2.29~rc1
series  16
ubuntu  16.04
kernel  4.10.0-38-generic
$ snap list snapcraft
Name       Version  Rev  Developer  Notes
snapcraft  2.34     501  canonical  classic

Is this running a cleanbuild from the snapcraft snap?

Yes, I’m on 16.04, running snapcraft cleanbuild.

(while I’m here, it would be nice if I didn’t have to scroll past this lot to find that error)

Traceback (most recent call last):
  File "/snap/snapcraft/501/bin/snapcraft", line 11, in <module>
    load_entry_point('snapcraft==2.34', 'console_scripts', 'snapcraft')()
  File "/snap/snapcraft/501/usr/lib/python3.6/site-packages/pkg_resources/__init__.py", line 565, in load_entry_point
    return get_distribution(dist).load_entry_point(group, name)
  File "/snap/snapcraft/501/usr/lib/python3.6/site-packages/pkg_resources/__init__.py", line 2631, in load_entry_point
    return ep.load()
  File "/snap/snapcraft/501/usr/lib/python3.6/site-packages/pkg_resources/__init__.py", line 2291, in load
    return self.resolve()
  File "/snap/snapcraft/501/usr/lib/python3.6/site-packages/pkg_resources/__init__.py", line 2297, in resolve
    module = __import__(self.module_name, fromlist=['__name__'], level=0)
  File "/snap/snapcraft/501/lib/python3.6/site-packages/snapcraft/cli/__main__.py", line 19, in <module>
    run(prog_name='snapcraft')
  File "/snap/snapcraft/501/lib/python3.6/site-packages/click/core.py", line 722, in __call__
    return self.main(*args, **kwargs)
  File "/snap/snapcraft/501/lib/python3.6/site-packages/click/core.py", line 697, in main
    rv = self.invoke(ctx)
  File "/snap/snapcraft/501/lib/python3.6/site-packages/click/core.py", line 1066, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/snap/snapcraft/501/lib/python3.6/site-packages/click/core.py", line 895, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/snap/snapcraft/501/lib/python3.6/site-packages/click/core.py", line 535, in invoke
    return callback(*args, **kwargs)
  File "/snap/snapcraft/501/lib/python3.6/site-packages/snapcraft/cli/lifecycle.py", line 188, in cleanbuild
    lifecycle.cleanbuild(project_options, remote)
  File "/snap/snapcraft/501/lib/python3.6/site-packages/snapcraft/internal/lifecycle.py", line 326, in cleanbuild
    metadata=config.get_metadata(), remote=remote).execute()
  File "/snap/snapcraft/501/lib/python3.6/site-packages/snapcraft/internal/lxd.py", line 149, in execute
    self._inject_snapcraft()
  File "/snap/snapcraft/501/lib/python3.6/site-packages/snapcraft/internal/lxd.py", line 187, in _inject_snapcraft
    self._inject_snap('core')
  File "/snap/snapcraft/501/lib/python3.6/site-packages/snapcraft/internal/lxd.py", line 243, in _inject_snap
    self._container_run(cmd)
  File "/snap/snapcraft/501/lib/python3.6/site-packages/snapcraft/internal/lxd.py", line 113, in _container_run
    check_call(['lxc', 'exec', self._container_name, '--'] + cmd)
  File "/snap/snapcraft/501/usr/lib/python3.6/subprocess.py", line 291, in check_call
    raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['lxc', 'exec', 'local:snapcraft-garishly-dizzying-lauralee', '--', 'snap', 'install', '/run/core_3291.snap']' returned non-zero exit status 1.
2 Likes

I’ve raised that before about the huge snapcraft dump when it errors: Stack traces of snapcraft executable

1 Like

Yeah we’re working on revamping such things :slightly_smiling_face: .

1 Like

@popey can I please see the output of the following command?

snap known snap-revision snap-revision=3291 snap-id=99T7MUlRhtI3U0QFgl5mXXESAiSwt776
$ snap known snap-revision snap-revision=3291 snap-id=99T7MUlRhtI3U0QFgl5mXXESAiSwt776
type: snap-revision
authority-id: canonical
snap-sha3-384: ErgE1H1xkfTdWHtguHfHmItnaPYlIpkQxpF23zwQBD9J3Mu0LYk-2hFnn5un8jUj
developer-id: canonical
snap-id: 99T7MUlRhtI3U0QFgl5mXXESAiSwt776
snap-revision: 3291
snap-size: 87810048
timestamp: 2017-10-23T07:37:52.283921Z
sign-key-sha3-384: BWDEoaqyr25nF5SNCvEv2v7QnM9QsfCc0PBMYD_i2NGSQ32EF2d4D0hqUel3m8ul

AcLBUgQAAQoABgUCWe2cUAAAJ3sQAGG54Th1CNmzsUi4zwAAayoF1ndn71ll4rgKT0Aw8hVyK9mH
jHf27uLcX1LXlqqMMBHBAZvTG5DzN1RG77yjvmXdkAdWodu7uNqUF8ppdWseYVJZnJHiO6mtY78T
EQhCGYkGOPLCTGM3FOVVX7+92d9HQftVCkDg6eqdD6saT0CnRdzqTT2Wo/+vZ/OKkI9H0etJeVL0
Mq0Vd4w8po6xQrA2hw7tBzLAVG+kzH/go8oaBp+V6lbEiewqzb7i2/gYD1y/vwxedHTBWselJEMv
1tgiqrQLO/+1zu9IxLar41vIm9mt7VrRXpzUfAupnOv57YfUAoGat3IXPuY1apIUW50A8PLazBIM
4dzgSdBOcqr1zAG6qT6FNJD01vbObGxi/afUlPdfZi9jyYYt0j2covfPyCmzuJyJcD/2o5MQvX+Y
gXmUoy/pyS0zIsrDEj4AQ7TZ8pJz61Hba0YLQn7aOnOqfNnMjIS6cO40/oGIFtakhGt4F/sDKxjr
igB4chpMvlGItzdi5Za8D51Zk+fBLR9dUiesiHrdM0P1jb7PDRPY5En3pZV9SdVZ03eBejF9s+By
DnR8PTwcY2SwdUUzc4v2C4nOWk54Zd0IBEhA7apES0TV4WZLxnsEDadONrNpN6rjAlkBcJ/dMi3B
+Rl43QkbpvTsPkcJ8pvbfZpCCoXU

Okay here we go, this is what snapcraft is doing:

snap known account-key public-key-sha3-384=BWDEoaqyr25nF5SNCvEv2v7QnM9QsfCc0PBMYD_i2NGSQ32EF2d4D0hqUel3m8ul > core.assert
echo "" >> core.assert
snap known snap-declaration snap-name=core >> core.assert
echo "" >> core.assert
snap known snap-revision snap-revision=3291 snap-id=99T7MUlRhtI3U0QFgl5mXXESAiSwt776 >> core.assert

Then it’s transferring that file over to the container and running snap ack core.assert before running snap install <core snap from host>.

That actually works fine for me locally, and I have the same core snap revision. Can you try it locally and see if you can reproduce the issue by hand?

Sorry, by “try it locally” can you spell out what “it” is? Not sure what I’m reproducing.

I cannot reproduce this issue, so to continue troubleshooting, create a clean xenial lxc container. Make sure it’s completely up-to-date, and install squashfuse. Then, on your host, run these steps:

snap known account-key public-key-sha3-384=BWDEoaqyr25nF5SNCvEv2v7QnM9QsfCc0PBMYD_i2NGSQ32EF2d4D0hqUel3m8ul > core.assert
echo "" >> core.assert
snap known snap-declaration snap-name=core >> core.assert
echo "" >> core.assert
snap known snap-revision snap-revision=3291 snap-id=99T7MUlRhtI3U0QFgl5mXXESAiSwt776 >> core.assert

Transfer the resulting core.assert file over to the container. Also transfer /var/lib/snapd/snaps/core_3291.snap over. Then, in the container, run sudo snap ack core.assert followed by sudo snap install core_3291.snap (note the lack of --dangerous). That should work fine, but since it’s failing for Snapcraft, I expect it’ll fail in this situation as well. But then perhaps it’ll say something helpful, or the syslog will contain helpful entries.

Yup, failed.

root@unified-snapper:~# snap ack core.assert   
root@unified-snapper:~# snap install core_3291.snap 
error: cannot find signatures with metadata for snap "core_3291.snap"

Syslog

This all worked earlier today. I made a couple of snaps fine. I rebooted my laptop after doing a dist-upgrade this evening, and haven’t built a snap since.

Whoa… I had that exact container name earlier today.

I’m afraid I must admit I have no idea what’s going on. The fact that snap ack/snap install isn’t working the way we expect is definitely the problem, but I don’t know why it’s happening. @pedronis, could you take a look at this? I’m not sure how to troubleshoot further.

Worth trying a different version of core or snapcraft?

alan@hal:~$ snap info core
name:      core
summary:   snapd runtime environment
publisher: canonical
contact:   snappy-canonical-storeaccount@canonical.com
description: |
  The core runtime environment for snapd
type:        core
snap-id:     99T7MUlRhtI3U0QFgl5mXXESAiSwt776
tracking:    beta
installed:   16-2.29~rc1 (3291) 87MB core
refreshed:   2017-10-23 08:35:26 +0100 BST
channels:                                    
  stable:    16-2.28.5                (3247) 87MB -
  candidate: 16-2.28.5                (3247) 87MB -
  beta:      16-2.29~rc1              (3291) 87MB -
  edge:      16-2.28.5+git445.496e635 (3314) 87MB -
alan@hal:~$ snap info snapcraft
name:      snapcraft
summary:   easily create snaps
publisher: canonical
contact:   snappy-canonical-storeaccount@canonical.com
description: |
  Snapcraft aims to make upstream developers' lives easier and as such is not a
  single toolset, but instead is a collection of tools that enable the natural
  workflow of an upstream to be extended with a simple release step into Snappy
  enabled system.
snap-id: vMTKRaLjnOJQetI78HjntT37VuoyssFE
commands:
  - snapcraft
tracking:    candidate
installed:   2.34 (501) 53MB classic
refreshed:   2017-09-10 18:54:17 +0100 BST
channels:                             
  stable:    –                             
  candidate: 2.34               (501) 53MB classic
  beta:      ↑                             
  edge:      2.34+git79.d211885 (672) 53MB classic

are we sure that run/core is not truncated or wrong in some way, you can try snap info --verbose /run/core_3291.snap to see if the signature matches

I don’t understand. /run/core_3291.snap - no such file exists.

sorry, that was the path in the original snapcraft error ?

error: cannot find signatures with metadata for snap "/run/core_3291.snap"

snap info --verbose can be used against any snap file that is known to have failed snap install

Ah okay. Well here’s what it says for the one in the clean lxc I made.

root@unified-snapper:~# snap info --verbose core_3291.snap
path:          "core_3291.snap"
name:          core
summary:       "snapd runtime environment"
notes:         
  confinement: strict
  broken:      false
version:       16-2.29~rc1 
type:          core
sha3-384:      bOvT90q93V4uLdCvZKx8krFF5y66BSltpaG9qjX0PYAJJ4L97P-KVRjaE_rcj9aX

ok, notice that snap-revision for 3291 says:

type: snap-revision
authority-id: canonical
snap-sha3-384: ErgE1H1xkfTdWHtguHfHmItnaPYlIpkQxpF23zwQBD9J3Mu0LYk-2hFnn5un8jUj
developer-id: canonical
snap-id: 99T7MUlRhtI3U0QFgl5mXXESAiSwt776
snap-revision: 3291
...

but here:

sha3-384: bOvT90q93V4uLdCvZKx8krFF5y66BSltpaG9qjX0PYAJJ4L97P-KVRjaE_rcj9aX

that snap got broken/corrupted somehow along the way? does it have the right size? should be snap-size: 87810048

wrt those tracebacks, @kalikiana please capture the error code returned from the actual build calls, they shouldn’t be tracebacks at all as a normal error flow causes this.

1 Like