Snapcraft on Ubuntu 22.04 broken and unusable

I decided to start using snap and found that it is very broken in almost every step of the way.

I have Ubuntu 22.04 and started following the tutorial with the following snapcraft.yml

name: controlenv # you probably want to 'snapcraft register <name>'
base: core20 # the base snap is the execution environment for this snap
version: '0.1' # just for humans, typically '1.2+git' or '1.3.2'
summary: Test summary
description: |
  Test description

grade: devel # must be 'stable' to release into candidate/stable channels
confinement: devmode # use 'strict' once you have the right plugs and slots

parts:
  gnu-hello:
    source: http://ftp.gnu.org/gnu/hello/hello-2.10.tar.gz
    plugin: autotools

First thing I noticed is that it started trying to pull packages from apt and was frozen because it was trying to use IPV6 when my vps didn’t have IPV6 enabled. So I tried removing ipv6 from LXC with

lxc network set lxdbr0 ipv6.address none

deleted the container and restarted snapcraft --use-lxd it still tries to use ipv6 inside the container… So I finally gave up and spent time activating ipv6 on the host.

Now after it downloads all the packages, there is ANOTHER error.

autoconf set to automatically installed.
automake set to automatically installed.
autopoint set to automatically installed.
gcc set to automatically installed.
libtool set to automatically installed.



'NoneType' object is not subscriptable
We would appreciate it if you anonymously reported this issue.
No other data than the traceback and the version of snapcraft in use will be sent.
Would you like to send this error data? (Yes/No/Always/View) [no]: 

Here is the error

Traceback (most recent call last):
  File "/snap/snapcraft/8619/lib/python3.8/site-packages/snapcraft_legacy/cli/legacy.py", line 27, in legacy_run
    run()
  File "/snap/snapcraft/8619/lib/python3.8/site-packages/click/core.py", line 1130, in __call__
    return self.main(*args, **kwargs)
  File "/snap/snapcraft/8619/lib/python3.8/site-packages/click/core.py", line 1055, in main
    rv = self.invoke(ctx)
  File "/snap/snapcraft/8619/lib/python3.8/site-packages/click/core.py", line 1657, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/snap/snapcraft/8619/lib/python3.8/site-packages/click/core.py", line 1404, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/snap/snapcraft/8619/lib/python3.8/site-packages/click/core.py", line 760, in invoke
    return __callback(*args, **kwargs)
  File "/snap/snapcraft/8619/lib/python3.8/site-packages/snapcraft_legacy/cli/lifecycle.py", line 406, in snap
    _execute(steps.PRIME, parts=tuple(), pack_project=True, output=output, **kwargs)
  File "/snap/snapcraft/8619/lib/python3.8/site-packages/snapcraft_legacy/cli/lifecycle.py", line 121, in _execute
    lifecycle.execute(step, project_config, parts)
  File "/snap/snapcraft/8619/lib/python3.8/site-packages/snapcraft_legacy/internal/lifecycle/_runner.py", line 122, in execute
    installed_snaps = _install_build_snaps(
  File "/snap/snapcraft/8619/lib/python3.8/site-packages/snapcraft_legacy/internal/lifecycle/_runner.py", line 83, in _install_build_snaps
    installed_snaps = repo.snaps.install_snaps(build_snaps)
  File "/snap/snapcraft/8619/lib/python3.8/site-packages/snapcraft_legacy/internal/repo/snaps.py", line 295, in install_snaps
    snap_pkg_channel = snap_info["channel"]
TypeError: 'NoneType' object is not subscriptable

And the funny thing is that sending the error message also results in an error. Which means that you are probably not getting this error message.

Sentry responded with an error: HTTPSConnectionPool(host='sentry.io', port=443): Max retries exceeded with url: /api/277754/store/ (Caused by ConnectTimeoutError(<urllib3.connection.HTTPSConnection object at 0x7fb79431cb80>, 'Connection to sentry.io timed out. (connect timeout=5)')) (url: https://sentry.io/api/277754/store/)
Traceback (most recent call last):
  File "/snap/snapcraft/8619/lib/python3.8/site-packages/snapcraft_legacy/cli/legacy.py", line 27, in legacy_run
    run()
  File "/snap/snapcraft/8619/lib/python3.8/site-packages/click/core.py", line 1130, in __call__
    return self.main(*args, **kwargs)
  File "/snap/snapcraft/8619/lib/python3.8/site-packages/click/core.py", line 1055, in main
    rv = self.invoke(ctx)
  File "/snap/snapcraft/8619/lib/python3.8/site-packages/click/core.py", line 1657, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/snap/snapcraft/8619/lib/python3.8/site-packages/click/core.py", line 1404, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/snap/snapcraft/8619/lib/python3.8/site-packages/click/core.py", line 760, in invoke
    return __callback(*args, **kwargs)
  File "/snap/snapcraft/8619/lib/python3.8/site-packages/snapcraft_legacy/cli/lifecycle.py", line 406, in snap
    _execute(steps.PRIME, parts=tuple(), pack_project=True, output=output, **kwargs)
  File "/snap/snapcraft/8619/lib/python3.8/site-packages/snapcraft_legacy/cli/lifecycle.py", line 121, in _execute
    lifecycle.execute(step, project_config, parts)
  File "/snap/snapcraft/8619/lib/python3.8/site-packages/snapcraft_legacy/internal/lifecycle/_runner.py", line 122, in execute
    installed_snaps = _install_build_snaps(
  File "/snap/snapcraft/8619/lib/python3.8/site-packages/snapcraft_legacy/internal/lifecycle/_runner.py", line 83, in _install_build_snaps
    installed_snaps = repo.snaps.install_snaps(build_snaps)
  File "/snap/snapcraft/8619/lib/python3.8/site-packages/snapcraft_legacy/internal/repo/snaps.py", line 295, in install_snaps
    snap_pkg_channel = snap_info["channel"]
TypeError: 'NoneType' object is not subscriptable

I just tried changing the base to core18 and now I get this.

Preparing to unpack .../apt-transport-https_1.6.14_all.deb ...
Unpacking apt-transport-https (1.6.14) ...
Setting up apt-transport-https (1.6.14) ...
Waiting for network to be ready...
2023-02-06T22:37:31Z INFO Waiting for automatic snapd restart...
snapd 2.58 from Canonical✓ installed
"snapd" switched to the "latest/stable" channel

error: unable to contact snap store
An error occurred when trying to execute 'snap install --channel stable core18' with 'LXD': returned exit code 1.

Running snapcraft again

Waiting for container to be ready
Waiting for network to be ready...
error: cannot communicate with server: Put http://localhost/v2/snaps/system/conf: dial unix /run/snapd.socket: connect: no such file or directory
An error occurred when trying to execute 'snap set system experimental.snapd-snap=true' with 'LXD': returned exit code 1.