Snapcraft suddenly fails installing build-snaps

For my already quite complex Flutter app (Snapcraft config: fluffychat/snap/snapcraft.yaml at main · krille-chan/fluffychat · GitHub) I have a new problem that snapcraft suddenly can’t build it anymore. It fails at the “Installing build-snaps” phase with an error like this:

2024-11-02 15:32:52.237 :: 2024-11-02 15:26:06.672 Installing build-snaps
2024-11-02 15:32:52.237 :: 2024-11-02 15:26:07.223 Installing snap: mesa-2404
2024-11-02 15:32:52.237 :: 2024-11-02 15:32:51.746 Error installing snap 'mesa-2404' from channel 'latest/stable'.
2024-11-02 15:32:52.237 :: 2024-11-02 15:32:51.749 Traceback (most recent call last):
2024-11-02 15:32:52.237 :: 2024-11-02 15:32:51.749   File "/snap/snapcraft/12971/lib/python3.10/site-packages/craft_parts/packages/snaps.py", line 236, in install
2024-11-02 15:32:52.237 :: 2024-11-02 15:32:51.749     subprocess.run(
2024-11-02 15:32:52.237 :: 2024-11-02 15:32:51.749   File "/snap/snapcraft/12971/usr/lib/python3.10/subprocess.py", line 526, in run
2024-11-02 15:32:52.237 :: 2024-11-02 15:32:51.749     raise CalledProcessError(retcode, process.args,
2024-11-02 15:32:52.237 :: 2024-11-02 15:32:51.749 subprocess.CalledProcessError: Command '['snap', 'install', 'mesa-2404']' returned non-zero exit status 1.
2024-11-02 15:32:52.237 :: 2024-11-02 15:32:51.749
2024-11-02 15:32:52.237 :: 2024-11-02 15:32:51.749 The above exception was the direct cause of the following exception:
2024-11-02 15:32:52.237 :: 2024-11-02 15:32:51.749 Traceback (most recent call last):
2024-11-02 15:32:52.237 :: 2024-11-02 15:32:51.749   File "/snap/snapcraft/12971/lib/python3.10/site-packages/craft_application/services/lifecycle.py", line 264, in run
2024-11-02 15:32:52.237 :: 2024-11-02 15:32:51.749     with self._lcm.action_executor() as aex:
2024-11-02 15:32:52.237 :: 2024-11-02 15:32:51.749   File "/snap/snapcraft/12971/lib/python3.10/site-packages/craft_parts/executor/executor.py", line 304, in __enter__
2024-11-02 15:32:52.237 :: 2024-11-02 15:32:51.749     self._executor.prologue()
2024-11-02 15:32:52.237 :: 2024-11-02 15:32:51.749   File "/snap/snapcraft/12971/lib/python3.10/site-packages/craft_parts/executor/executor.py", line 89, in prologue
2024-11-02 15:32:52.237 :: 2024-11-02 15:32:51.749     self._install_build_snaps()
2024-11-02 15:32:52.237 :: 2024-11-02 15:32:51.749   File "/snap/snapcraft/12971/lib/python3.10/site-packages/craft_parts/executor/executor.py", line 270, in _install_build_snaps
2024-11-02 15:32:52.237 :: 2024-11-02 15:32:51.749     packages.snaps.install_snaps(build_snaps)
2024-11-02 15:32:52.237 :: 2024-11-02 15:32:51.749   File "/snap/snapcraft/12971/lib/python3.10/site-packages/craft_parts/packages/snaps.py", line 304, in install_snaps
2024-11-02 15:32:52.237 :: 2024-11-02 15:32:51.749     snap_pkg.install()
2024-11-02 15:32:52.237 :: 2024-11-02 15:32:51.749   File "/snap/snapcraft/12971/lib/python3.10/site-packages/craft_parts/packages/snaps.py", line 243, in install
2024-11-02 15:32:52.237 :: 2024-11-02 15:32:51.749     raise errors.SnapInstallError(
2024-11-02 15:32:52.237 :: 2024-11-02 15:32:51.749 craft_parts.packages.errors.SnapInstallError: Error installing snap 'mesa-2404' from channel 'latest/stable'.
2024-11-02 15:32:52.237 Executing on host: lxc --project snapcraft config device show local:snapcraft-fluffychat-on-amd64-for-amd64-10358964
2024-11-02 15:32:52.305 Executing on host: lxc --project snapcraft config device remove local:snapcraft-fluffychat-on-amd64-for-amd64-10358964 disk-/root/project
2024-11-02 15:32:52.394 Executing on host: lxc --project snapcraft stop local:snapcraft-fluffychat-on-amd64-for-amd64-10358964
2024-11-02 15:32:56.259 Failed to execute snapcraft in instance.
2024-11-02 15:32:56.268 Traceback (most recent call last):
2024-11-02 15:32:56.268   File "/snap/snapcraft/12971/lib/python3.10/site-packages/craft_application/application.py", line 380, in run_managed
2024-11-02 15:32:56.268     instance.execute_run(  # pyright: ignore[reportUnknownMemberType,reportUnknownVariableType]
2024-11-02 15:32:56.268   File "/snap/snapcraft/12971/lib/python3.10/site-packages/craft_providers/lxd/lxd_instance.py", line 293, in execute_run
2024-11-02 15:32:56.268     return self.lxc.exec(
2024-11-02 15:32:56.268   File "/snap/snapcraft/12971/lib/python3.10/site-packages/craft_providers/lxd/lxc.py", line 387, in exec
2024-11-02 15:32:56.268     return runner(final_cmd, timeout=timeout, check=check, **kwargs)
2024-11-02 15:32:56.268   File "/snap/snapcraft/12971/usr/lib/python3.10/subprocess.py", line 526, in run
2024-11-02 15:32:56.268     raise CalledProcessError(retcode, process.args,
2024-11-02 15:32:56.268 subprocess.CalledProcessError: Command '['lxc', '--project', 'snapcraft', 'exec', 'local:snapcraft-fluffychat-on-amd64-for-amd64-10358964', '--cwd', '/root/project', '--', 'env', 'CRAFT_MANAGED_MODE=1', 'DEBIAN_FRONTEND=noninteractive', 'DEBCONF_NONINTERACTIVE_SEEN=true', 'DEBIAN_PRIORITY=critical', 'CRAFT_PLATFORM=amd64', 'CRAFT_VERBOSITY_LEVEL=BRIEF', 'snapcraft']' returned non-zero exit status 1.
2024-11-02 15:32:56.268 
2024-11-02 15:32:56.268 The above exception was the direct cause of the following exception:
2024-11-02 15:32:56.268 Traceback (most recent call last):
2024-11-02 15:32:56.268   File "/snap/snapcraft/12971/lib/python3.10/site-packages/craft_application/application.py", line 568, in run
2024-11-02 15:32:56.268     return_code = self._run_inner()
2024-11-02 15:32:56.268   File "/snap/snapcraft/12971/lib/python3.10/site-packages/snapcraft/application.py", line 212, in _run_inner
2024-11-02 15:32:56.268     return_code = super()._run_inner()
2024-11-02 15:32:56.268   File "/snap/snapcraft/12971/lib/python3.10/site-packages/craft_application/application.py", line 552, in _run_inner
2024-11-02 15:32:56.268     self.run_managed(platform, build_for)
2024-11-02 15:32:56.268   File "/snap/snapcraft/12971/lib/python3.10/site-packages/craft_application/application.py", line 387, in run_managed
2024-11-02 15:32:56.268     raise craft_providers.ProviderError(
2024-11-02 15:32:56.268 craft_providers.errors.ProviderError: Failed to execute snapcraft in instance.

This does happen on my Ubuntu 24.10 machine but also on the snapcraft build servers which I use via the Github integration. It first started to happen 11 days ago.

While the snap which fails to install is sometimes something different. After a snapcraft clean it is core24, sometimes it is the gnome-46-... platform snap and so on. I have now idea what suddenly causes this. I tried to reset to the last version which was successfully built and the same error occured. So I could maybe assume that a change in snapcraft itself is the actual root cause. I also tried to:

  • Switch back to core22
  • Build without some of the parts, like the zenity-integration
  • Build without the gnome extension
  • snapcraft clean
  • purge and reinstall lxd
  • Try the snapcraft --edge version

I literally have no idea what to do now. The error does not tell me what the next steps could be. Especially when I saw that core24 failed to install. As the error blocks me completely since 11 days (October 23, there doesn’t seem to be a snapcraft update on this date) I fear that the problem doesn’t disappear by itself.

1 Like

I just checked out v1.22.1 and built it successfully:

snapcraft remote-build
remote-build is experimental and is subject to change. Use with caution.
All data sent to remote builders will be publicly available. Are you sure you want to continue? [y/N]: y
Build completed.rtifacts... :: Downloading 2 files (<---)
Log files: snapcraft-fluffychat-0d5ed1af949c33b43491e999c5dd188b_amd64_2024-11-06T13:10:25.txt, snapcraft-fluffychat-0d5ed1af949c33b43491e999c5dd188b_arm64_2024-11-06T13:10:25.txt
Artifacts: fluffychat_rc1.21.2+git240.9d8a17ef_amd64.snap, fluffychat_rc1.21.2+git240.9d8a17ef_arm64.snap

What version fails? The tip of git master, or some other branch?

Yes it is the current main branch. However suddenly now there is a different error message on remote build for me:

::
:: [        ] ensureAnalyticsSent: 0ms
:: [        ] Running 1 shutdown hook
:: [        ] Shutdown hooks complete
:: [        ] exiting with code 1
:: error:
:: Traceback (most recent call last):
::   File "/snap/snapcraft/current/lib/python3.10/site-packages/craft_parts/ctl.py", line 110, in main
::     ret = CraftCtl.run(cmd, args)
::   File "/snap/snapcraft/current/lib/python3.10/site-packages/craft_parts/ctl.py", line 44, in run
::     _client(cmd, args)
::   File "/snap/snapcraft/current/lib/python3.10/site-packages/craft_parts/ctl.py", line 97, in _client
::     raise RuntimeError(message)
:: RuntimeError: Failed to run the build script for part 'fluffychat'.
'override-build' in part 'fluffychat' failed with code 1.
Recommended resolution: Review the scriptlet and make sure it's correct.
Full execution log: '/root/.local/state/snapcraft/log/snapcraft-20241106-131547.193408.log'
Build failed
Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/lpbuildd/target/build_snap.py", line 302, in run
    self.build()
  File "/usr/lib/python3/dist-packages/lpbuildd/target/build_snap.py", line 286, in build
    self.run_build_command(["snapcraft"], cwd=output_path, env=env)
  File "/usr/lib/python3/dist-packages/lpbuildd/target/operation.py", line 62, in run_build_command
    return self.backend.run(args, cwd=cwd, env=full_env, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3/dist-packages/lpbuildd/target/lxd.py", line 718, in run
    subprocess.check_call(cmd, **kwargs)
  File "/usr/lib/python3.12/subprocess.py", line 413, in check_call
    raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['lxc', 'exec', 'lp-noble-amd64', '--env', 'LANG=C.UTF-8', '--env', 'SHELL=/bin/sh', '--env', 'http_proxy=http://10.10.10.1:8222/', '--env', 'https_proxy=http://10.10.10.1:8222/', '--env', 'GIT_PROXY_COMMAND=/usr/local/bin/lpbuildd-git-proxy', '--env', 'SNAPPY_STORE_NO_CDN=1', '--env', 'LAUNCHPAD_INSTANCE=production', '--env', 'LAUNCHPAD_SERVER_URL=launchpad.net', '--env', 'SNAPCRAFT_BUILD_INFO=1', '--env', 'SNAPCRAFT_IMAGE_INFO={"build-request-id": "lp-93519389", "build-request-timestamp": "2024-11-06T13:10:44Z", "build_url": "https://launchpad.net/~build.snapcraft.io/+snap/a77ba112c01baebca5b0a5349ef53d9c/+build/2649239"}', '--env', 'SNAPCRAFT_BUILD_ENVIRONMENT=host', '--env', 'SNAPCRAFT_BUILD_FOR=amd64', '--', '/bin/sh', '-c', 'cd /build/fluffychat && linux64 snapcraft']' returned non-zero exit status 1.
Revoking proxy token...
RUN: /usr/share/launchpad-buildd/bin/in-target scan-for-processes --backend=lxd --series=noble --arch=amd64 SNAPBUILD-2649239
Scanning for processes to kill in build SNAPBUILD-2649239

I don’t know what’s causing the RuntimeError - but I suspect you’re also hitting the issue where snapcraft doesn’t expose errors out to the running machine, but just prints the name of the log file, which is pretty useless in a VM on a remote machine in a datacentre.

I think it’s this bug: Failures when running `snap pack` don't get sent to the user. · Issue #4499 · canonical/snapcraft · GitHub