Stack traces of snapcraft executable


#1

While it is helpful for developers working on snapcraft itself, stack traces are evil when trying to work out what went wrong with snapcraft when you’re building a snap package. For example, a network timeout which should be a simple one line error message I was greeted with this wall of text. How am I supposed to know where the error is in this without reading ALL of it?! And if I don’t know anything about the internals of snapcraft why do I care about the stack trace at all? Can we please put this debug output behind a flag so that we just present a simple error message to users of snapcraft that they are able to utilise??

Pulling desktop-gnome-platform 
Cloning into '/root/build_liferea/parts/desktop-gnome-platform/src'...
fatal: unable to access 'https://github.com/ubuntu/snapcraft-desktop-helpers.git/': Failed to connect to github.com port 443: Connection timed out
Error in sys.excepthook:
Traceback (most recent call last):
  File "/snap/snapcraft/409/bin/snapcraft", line 11, in <module>
    load_entry_point('snapcraft==2.33', 'console_scripts', 'snapcraft')()
  File "/snap/snapcraft/409/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/409/usr/lib/python3.6/site-packages/pkg_resources/__init__.py", line 2631, in load_entry_point
    return ep.load()
  File "/snap/snapcraft/409/usr/lib/python3.6/site-packages/pkg_resources/__init__.py", line 2291, in load
    return self.resolve()
  File "/snap/snapcraft/409/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/409/lib/python3.6/site-packages/snapcraft/cli/__main__.py", line 19, in <module>
    run(prog_name='snapcraft')
  File "/snap/snapcraft/409/lib/python3.6/site-packages/click/core.py", line 722, in __call__
    return self.main(*args, **kwargs)
  File "/snap/snapcraft/409/lib/python3.6/site-packages/click/core.py", line 697, in main
    rv = self.invoke(ctx)
  File "/snap/snapcraft/409/lib/python3.6/site-packages/click/core.py", line 1066, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/snap/snapcraft/409/lib/python3.6/site-packages/click/core.py", line 895, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/snap/snapcraft/409/lib/python3.6/site-packages/click/core.py", line 535, in invoke
    return callback(*args, **kwargs)
  File "/snap/snapcraft/409/lib/python3.6/site-packages/snapcraft/cli/lifecycle.py", line 132, in snap
    project_options, directory=directory, output=output)
  File "/snap/snapcraft/409/lib/python3.6/site-packages/snapcraft/internal/lifecycle.py", line 380, in snap
    execute('prime', project_options)
  File "/snap/snapcraft/409/lib/python3.6/site-packages/snapcraft/internal/lifecycle.py", line 127, in execute
    _Executor(config, project_options).run(step, part_names)
  File "/snap/snapcraft/409/lib/python3.6/site-packages/snapcraft/internal/lifecycle.py", line 222, in run
    self._run_step(step, part, part_names)
  File "/snap/snapcraft/409/lib/python3.6/site-packages/snapcraft/internal/lifecycle.py", line 259, in _run_step
    getattr(part, step)()
  File "/snap/snapcraft/409/lib/python3.6/site-packages/snapcraft/internal/pluginhandler/__init__.py", line 323, in pull
    self.source_handler.pull()
  File "/snap/snapcraft/409/lib/python3.6/site-packages/snapcraft/internal/sources/_git.py", line 145, in pull
    self._clone_new()
  File "/snap/snapcraft/409/lib/python3.6/site-packages/snapcraft/internal/sources/_git.py", line 134, in _clone_new
    **self._call_kwargs)
  File "/snap/snapcraft/409/usr/lib/python3.6/subprocess.py", line 291, in check_call
    raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['git', 'clone', '--recursive', 'https://github.com/ubuntu/snapcraft-desktop-helpers.git', '/root/build_liferea/parts/desktop-gnome-platform/src']' returned non-zero exit status 128.

Original exception was:
Traceback (most recent call last):
  File "/snap/snapcraft/409/bin/snapcraft", line 11, in <module>
    load_entry_point('snapcraft==2.33', 'console_scripts', 'snapcraft')()
  File "/snap/snapcraft/409/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/409/usr/lib/python3.6/site-packages/pkg_resources/__init__.py", line 2631, in load_entry_point
    return ep.load()
  File "/snap/snapcraft/409/usr/lib/python3.6/site-packages/pkg_resources/__init__.py", line 2291, in load
    return self.resolve()
  File "/snap/snapcraft/409/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/409/lib/python3.6/site-packages/snapcraft/cli/__main__.py", line 19, in <module>
    run(prog_name='snapcraft')
  File "/snap/snapcraft/409/lib/python3.6/site-packages/click/core.py", line 722, in __call__
    return self.main(*args, **kwargs)
  File "/snap/snapcraft/409/lib/python3.6/site-packages/click/core.py", line 697, in main
    rv = self.invoke(ctx)
  File "/snap/snapcraft/409/lib/python3.6/site-packages/click/core.py", line 1066, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/snap/snapcraft/409/lib/python3.6/site-packages/click/core.py", line 895, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/snap/snapcraft/409/lib/python3.6/site-packages/click/core.py", line 535, in invoke
    return callback(*args, **kwargs)
  File "/snap/snapcraft/409/lib/python3.6/site-packages/snapcraft/cli/lifecycle.py", line 132, in snap
    project_options, directory=directory, output=output)
  File "/snap/snapcraft/409/lib/python3.6/site-packages/snapcraft/internal/lifecycle.py", line 380, in snap
    execute('prime', project_options)
  File "/snap/snapcraft/409/lib/python3.6/site-packages/snapcraft/internal/lifecycle.py", line 127, in execute
    _Executor(config, project_options).run(step, part_names)
  File "/snap/snapcraft/409/lib/python3.6/site-packages/snapcraft/internal/lifecycle.py", line 222, in run
    self._run_step(step, part, part_names)
  File "/snap/snapcraft/409/lib/python3.6/site-packages/snapcraft/internal/lifecycle.py", line 259, in _run_step
    getattr(part, step)()
  File "/snap/snapcraft/409/lib/python3.6/site-packages/snapcraft/internal/pluginhandler/__init__.py", line 323, in pull
    self.source_handler.pull()
  File "/snap/snapcraft/409/lib/python3.6/site-packages/snapcraft/internal/sources/_git.py", line 145, in pull
    self._clone_new()
  File "/snap/snapcraft/409/lib/python3.6/site-packages/snapcraft/internal/sources/_git.py", line 134, in _clone_new
    **self._call_kwargs)
  File "/snap/snapcraft/409/usr/lib/python3.6/subprocess.py", line 291, in check_call
    raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['git', 'clone', '--recursive', 'https://github.com/ubuntu/snapcraft-desktop-helpers.git', '/root/build_liferea/parts/desktop-gnome-platform/src']' returned non-zero exit status 128.
Stopping local:snapcraft-unobesely-multichanneled-tyson
Error in sys.excepthook:
Traceback (most recent call last):
  File "/snap/snapcraft/409/bin/snapcraft", line 11, in <module>
    load_entry_point('snapcraft==2.33', 'console_scripts', 'snapcraft')()
  File "/snap/snapcraft/409/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/409/usr/lib/python3.6/site-packages/pkg_resources/__init__.py", line 2631, in load_entry_point
    return ep.load()
  File "/snap/snapcraft/409/usr/lib/python3.6/site-packages/pkg_resources/__init__.py", line 2291, in load
    return self.resolve()
  File "/snap/snapcraft/409/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/409/lib/python3.6/site-packages/snapcraft/cli/__main__.py", line 19, in <module>
    run(prog_name='snapcraft')
  File "/snap/snapcraft/409/lib/python3.6/site-packages/click/core.py", line 722, in __call__
    return self.main(*args, **kwargs)
  File "/snap/snapcraft/409/lib/python3.6/site-packages/click/core.py", line 697, in main
    rv = self.invoke(ctx)
  File "/snap/snapcraft/409/lib/python3.6/site-packages/click/core.py", line 1066, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/snap/snapcraft/409/lib/python3.6/site-packages/click/core.py", line 895, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/snap/snapcraft/409/lib/python3.6/site-packages/click/core.py", line 535, in invoke
    return callback(*args, **kwargs)
  File "/snap/snapcraft/409/lib/python3.6/site-packages/snapcraft/cli/lifecycle.py", line 188, in cleanbuild
    lifecycle.cleanbuild(project_options, remote)
  File "/snap/snapcraft/409/lib/python3.6/site-packages/snapcraft/internal/lifecycle.py", line 357, in cleanbuild
    metadata=config.get_metadata(), remote=remote).execute()
  File "/snap/snapcraft/409/lib/python3.6/site-packages/snapcraft/internal/lxd.py", line 155, in execute
    raise e
  File "/snap/snapcraft/409/lib/python3.6/site-packages/snapcraft/internal/lxd.py", line 149, in execute
    self._container_run(command, cwd=self._project_folder)
  File "/snap/snapcraft/409/lib/python3.6/site-packages/snapcraft/internal/lxd.py", line 104, in _container_run
    check_call(['lxc', 'exec', self._container_name, '--'] + cmd)
  File "/snap/snapcraft/409/usr/lib/python3.6/subprocess.py", line 291, in check_call
    raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['lxc', 'exec', 'local:snapcraft-unobesely-multichanneled-tyson', '--', 'sh', '-c', 'cd /root/build_liferea; snapcraft snap --output liferea_0.1_amd64.snap']' returned non-zero exit status 1.

Original exception was:
Traceback (most recent call last):
  File "/snap/snapcraft/409/bin/snapcraft", line 11, in <module>
    load_entry_point('snapcraft==2.33', 'console_scripts', 'snapcraft')()
  File "/snap/snapcraft/409/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/409/usr/lib/python3.6/site-packages/pkg_resources/__init__.py", line 2631, in load_entry_point
    return ep.load()
  File "/snap/snapcraft/409/usr/lib/python3.6/site-packages/pkg_resources/__init__.py", line 2291, in load
    return self.resolve()
  File "/snap/snapcraft/409/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/409/lib/python3.6/site-packages/snapcraft/cli/__main__.py", line 19, in <module>
    run(prog_name='snapcraft')
  File "/snap/snapcraft/409/lib/python3.6/site-packages/click/core.py", line 722, in __call__
    return self.main(*args, **kwargs)
  File "/snap/snapcraft/409/lib/python3.6/site-packages/click/core.py", line 697, in main
    rv = self.invoke(ctx)
  File "/snap/snapcraft/409/lib/python3.6/site-packages/click/core.py", line 1066, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/snap/snapcraft/409/lib/python3.6/site-packages/click/core.py", line 895, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/snap/snapcraft/409/lib/python3.6/site-packages/click/core.py", line 535, in invoke
    return callback(*args, **kwargs)
  File "/snap/snapcraft/409/lib/python3.6/site-packages/snapcraft/cli/lifecycle.py", line 188, in cleanbuild
    lifecycle.cleanbuild(project_options, remote)
  File "/snap/snapcraft/409/lib/python3.6/site-packages/snapcraft/internal/lifecycle.py", line 357, in cleanbuild
    metadata=config.get_metadata(), remote=remote).execute()
  File "/snap/snapcraft/409/lib/python3.6/site-packages/snapcraft/internal/lxd.py", line 155, in execute
    raise e
  File "/snap/snapcraft/409/lib/python3.6/site-packages/snapcraft/internal/lxd.py", line 149, in execute
    self._container_run(command, cwd=self._project_folder)
  File "/snap/snapcraft/409/lib/python3.6/site-packages/snapcraft/internal/lxd.py", line 104, in _container_run
    check_call(['lxc', 'exec', self._container_name, '--'] + cmd)
  File "/snap/snapcraft/409/usr/lib/python3.6/subprocess.py", line 291, in check_call
    raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['lxc', 'exec', 'local:snapcraft-unobesely-multichanneled-tyson', '--', 'sh', '-c', 'cd /root/build_liferea; snapcraft snap --output liferea_0.1_amd64.snap']' returned non-zero exit status 1.

Snapcraft unable to install core snap
Classic confinement + help for Task
#2

Agreed. Note that we’re taking steps to make this experience better. PR: #1436 improved this dramatically, but doesn’t solve the problem for non-snapcraft errors (such as the one you see here). We met with the one and only @mpt to redesign this experience, and we’re working toward it bit by bit.


#3

Also snapcraft#1641.


#4

Also also snapcraft#1512 (currently closed because of CI issues, but will re-investigate this soon).