Snapcraft no access to network

Ubuntu Version: Ubuntu core 24

Desktop Environment (if applicable):

Problem Description:

I am trying to build a snap and I keep getting this error - craft_providers.errors.NetworkError: A network related operation failed in a context of no network access.

Here is my snapcraft.yaml

# yaml-language-server: $schema=https://raw.githubusercontent.com/canonical/snapcraft/refs/heads/main/schema/snapcraft.json
name: the-frame
base: core24
version: '0.1'
summary: test
description: "test"

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

parts:
  the-frame-app:
    plugin: flutter
    flutter-target: lib/main.dart
    source: .

platforms:
  amd64:
    build-on: [amd64]
    build-for: [amd64]
  arm64:
    build-on: [arm64]
    build-for: [arm64]

apps:
  the-frame-app:
    command: the_frame_app
    extensions: 
      - gnome
    plugs:
      - desktop
      - network
      - home

I am not sure what is causing this error.

Relevant System Information:

I am on ubuntu 22.04.5 amd64 on Wayland

Snap list:

Name                       Version                     Rev    Tracking         Publisher   Notes
bare                       1.0                         5      latest/stable    canonical✓  base
canonical-livepatch        10.9.0                      286    latest/stable    canonical✓  -
core18                     20250123                    2855   latest/stable    canonical✓  base
core20                     20241206                    2496   latest/stable    canonical✓  base
core22                     20250210                    1802   latest/stable    canonical✓  base
core24                     20241217                    739    latest/stable    canonical✓  base
gnome-3-28-1804            3.28.0-19-g98f9e67.98f9e67  198    latest/stable    canonical✓  -
gnome-42-2204              0+git.38ea591               202    latest/stable/…  canonical✓  -
gtk-common-themes          0.1-81-g442e511             1535   latest/stable/…  canonical✓  -
lxd                        5.21.3-75def3c              32455  5.21/stable      canonical✓  -
snap-store                 41.3-72-g80e7130            1216   latest/stable/…  canonical✓  -
snapcraft                  8.7.4                       14117  latest/stable    canonical✓  classic
snapd                      2.67.1                      23771  latest/stable    canonical✓  snapd
snapd-desktop-integration  0.9                         253    latest/stable/…  canonical✓  -
vlc                        3.0.20-1-g2617de71b6        3777   latest/stable    videolan✓   -.

I also have Docker installed.

Screenshots or Error Messages:

2025-04-03 10:37:41.901 A network related operation failed in a context of no network access.
2025-04-03 10:37:41.910 Traceback (most recent call last):
2025-04-03 10:37:41.911   File "/snap/snapcraft/14117/lib/python3.12/site-packages/craft_providers/base.py", line 1151, in _execute_run
2025-04-03 10:37:41.911     proc = executor.execute_run(
2025-04-03 10:37:41.911            ^^^^^^^^^^^^^^^^^^^^^
2025-04-03 10:37:41.911   File "/snap/snapcraft/14117/lib/python3.12/site-packages/craft_providers/lxd/lxd_instance.py", line 254, in execute_run
2025-04-03 10:37:41.911     return self.lxc.exec(
2025-04-03 10:37:41.911            ^^^^^^^^^^^^^^
2025-04-03 10:37:41.911   File "/snap/snapcraft/14117/lib/python3.12/site-packages/craft_providers/lxd/lxc.py", line 390, in exec
2025-04-03 10:37:41.911     return runner(final_cmd, timeout=timeout, check=check, **kwargs)
2025-04-03 10:37:41.911            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2025-04-03 10:37:41.911   File "/snap/snapcraft/current/usr/lib/python3.12/subprocess.py", line 571, in run
2025-04-03 10:37:41.911     raise CalledProcessError(retcode, process.args,
2025-04-03 10:37:41.911 subprocess.CalledProcessError: Command '['lxc', '--project', 'snapcraft', 'exec', 'local:base-instance-snapcraft-buildd-base-v7-c-f91ee4af44ccdf02cefb', '--', 'env', 'CRAFT_MANAGED_MODE=1', 'DEBIAN_FRONTEND=noninteractive', 'DEBCONF_NONINTERACTIVE_SEEN=true', 'DEBIAN_PRIORITY=critical', 'apt-get', 'update']' returned non-zero exit status 100.
2025-04-03 10:37:41.911 
2025-04-03 10:37:41.911 The above exception was the direct cause of the following exception:
2025-04-03 10:37:41.911 Traceback (most recent call last):
2025-04-03 10:37:41.911   File "/snap/snapcraft/14117/lib/python3.12/site-packages/craft_application/application.py", line 691, in run
2025-04-03 10:37:41.911     return_code = self._run_inner()
2025-04-03 10:37:41.911                   ^^^^^^^^^^^^^^^^^
2025-04-03 10:37:41.911   File "/snap/snapcraft/14117/lib/python3.12/site-packages/snapcraft/application.py", line 203, in _run_inner
2025-04-03 10:37:41.911     return_code = super()._run_inner()
2025-04-03 10:37:41.911                   ^^^^^^^^^^^^^^^^^^^^
2025-04-03 10:37:41.911   File "/snap/snapcraft/14117/lib/python3.12/site-packages/craft_application/application.py", line 674, in _run_inner
2025-04-03 10:37:41.911     self.run_managed(platform, build_for)
2025-04-03 10:37:41.911   File "/snap/snapcraft/14117/lib/python3.12/site-packages/craft_application/application.py", line 471, in run_managed
2025-04-03 10:37:41.911     with self.services.provider.instance(
2025-04-03 10:37:41.911   File "/snap/snapcraft/current/usr/lib/python3.12/contextlib.py", line 137, in __enter__
2025-04-03 10:37:41.911     return next(self.gen)
2025-04-03 10:37:41.911            ^^^^^^^^^^^^^^
2025-04-03 10:37:41.911   File "/snap/snapcraft/14117/lib/python3.12/site-packages/craft_application/services/provider.py", line 154, in instance
2025-04-03 10:37:41.911     with provider.launched_environment(
2025-04-03 10:37:41.911   File "/snap/snapcraft/current/usr/lib/python3.12/contextlib.py", line 137, in __enter__
2025-04-03 10:37:41.911     return next(self.gen)
2025-04-03 10:37:41.911            ^^^^^^^^^^^^^^
2025-04-03 10:37:41.911   File "/snap/snapcraft/14117/lib/python3.12/site-packages/craft_providers/lxd/lxd_provider.py", line 147, in launched_environment
2025-04-03 10:37:41.911     instance = launch(
2025-04-03 10:37:41.911                ^^^^^^^
2025-04-03 10:37:41.911   File "/snap/snapcraft/14117/lib/python3.12/site-packages/craft_providers/lxd/launcher.py", line 806, in launch
2025-04-03 10:37:41.912     _create_instance(
2025-04-03 10:37:41.912   File "/snap/snapcraft/14117/lib/python3.12/site-packages/craft_providers/lxd/launcher.py", line 150, in _create_instance
2025-04-03 10:37:41.912     base_configuration.setup(executor=base_instance, mount_cache=False)
2025-04-03 10:37:41.912   File "/snap/snapcraft/14117/lib/python3.12/site-packages/craft_providers/base.py", line 1035, in setup
2025-04-03 10:37:41.912     self._pre_setup_packages(executor=executor)
2025-04-03 10:37:41.912   File "/snap/snapcraft/14117/lib/python3.12/site-packages/craft_providers/bases/ubuntu.py", line 214, in _pre_setup_packages
2025-04-03 10:37:41.912     self._execute_run(
2025-04-03 10:37:41.912   File "/snap/snapcraft/14117/lib/python3.12/site-packages/craft_providers/base.py", line 1160, in _execute_run
2025-04-03 10:37:41.912     raise NetworkError from exc
2025-04-03 10:37:41.912 craft_providers.errors.NetworkError: A network related operation failed in a context of no network access.

This needs to be posted in https://forum.snapcraft.io. Snaps are not exclusive to Ubuntu. I have to close this since we do not support this here.