Override-build behavior changes for V3?

Hi there,

I’m updating budgie-welcome to Snapcraft V3 - and to start I am just attempting a build of the existing snapcraft.yaml. I hit an error where the override-build section is failing (missing files - rebuild-translations.sh in this case).

So I jumped into the image with snapcraft --debug, and I cannot find the needed files as reported in the error. I was looking at /home/multipass/parts/budgie-welcome/build (as per docs).

In that directory I see:

.
├── hooks
│   ├── install
│   ├── post-refresh -> install
│   └── remove
├── scripts
│   └── welcome-wrapper
└── ubuntu-budgie-welcome_source.tar.bz2

Now the content I am trying to target (and that had previously built) sits in the top level scripts folder (in our repo):

(This is a pruned tree - just to exhibit where the script sits in the repo compared to the snap folder).

.
|-- LICENSE
|-- README.md
|-- debian
|   |-- budgie-welcome.install
|   |-- budgie-welcome.links
|   |-- changelog
|   |-- compat
|   |-- control
|   |-- copyright
|   |-- files
|   |-- rules
|   `-- source
|-- docs
|   `-- standards.md
|-- org.budgie.welcome.policy
|-- scripts
|   |-- rebuild-translations.sh
|   |-- regenerate-translation-templates.sh
|   |-- translation-support.py
|   |-- update-desktop-files.sh
|   `-- welcome-po.py
`-- snap
    |-- hooks
    |-- scripts
    `-- snapcraft.yaml

Am I missing something that changed?

snapcraft.yaml

https://raw.githubusercontent.com/UbuntuBudgie/budgie-welcome/snapcraft_3.x/snap/snapcraft.yaml

Full Repo

Thank you in advance.

Dustin

This is odd. I added base: core18 to the same YAML.

Now it fails out with:

An error occurred when trying to execute 'sudo -i env SNAPCRAFT_HAS_TTY=True snapcraft snap' with 'multipass': returned exit code 2.

Googled around for that error (to no results). HM.

Try running snapcraft with the SNAPCRAFT_ENABLE_DEVELOPER_DEBUG=yes environment variable.

Is this run within multipass? Or on the host? (Assume host)

Should be run on the host IIRC.

Confirmed. I should have just tested. :blush:

Appreciate your time.

Weuuffff. That’s verbose. :slight_smile:

If I read this correctly, it seems like my snapcraft does not want to play nice with multipass.

Running multipass stop snapcraft-ubuntu-budgie-welcome
Traceback (most recent call last):                                              
  File "/snap/snapcraft/2650/legacy_snapcraft/lib/python3.5/site-packages/snapcraft/internal/build_providers/_multipass/_multipass_command.py", line 160, in execute
    return runnable(cmd)
  File "/snap/snapcraft/2650/legacy_snapcraft/lib/python3.5/site-packages/snapcraft/internal/build_providers/_multipass/_multipass_command.py", line 31, in _run
    subprocess.check_call(command)
  File "/snap/snapcraft/2650/legacy_snapcraft/usr/lib/python3.5/subprocess.py", line 581, in check_call
    raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['multipass', 'exec', 'snapcraft-ubuntu-budgie-welcome', '--', 'snapcraft', 'snap']' returned non-zero exit status 2

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/snap/snapcraft/2650/legacy_snapcraft/bin/snapcraft", line 11, in <module>
    load_entry_point('snapcraft==2.43.1', 'console_scripts', 'snapcraft')()
  File "/snap/snapcraft/2650/legacy_snapcraft/lib/python3.5/site-packages/click/core.py", line 722, in __call__
    return self.main(*args, **kwargs)
  File "/snap/snapcraft/2650/legacy_snapcraft/lib/python3.5/site-packages/click/core.py", line 697, in main
    rv = self.invoke(ctx)
  File "/snap/snapcraft/2650/legacy_snapcraft/lib/python3.5/site-packages/click/core.py", line 1043, in invoke
    return Command.invoke(self, ctx)
  File "/snap/snapcraft/2650/legacy_snapcraft/lib/python3.5/site-packages/click/core.py", line 895, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/snap/snapcraft/2650/legacy_snapcraft/lib/python3.5/site-packages/click/core.py", line 535, in invoke
    return callback(*args, **kwargs)
  File "/snap/snapcraft/2650/legacy_snapcraft/lib/python3.5/site-packages/click/decorators.py", line 17, in new_func
    return f(get_current_context(), *args, **kwargs)
  File "/snap/snapcraft/2650/legacy_snapcraft/lib/python3.5/site-packages/snapcraft/cli/_runner.py", line 114, in run
    ctx.forward(lifecyclecli.commands["snap"])
  File "/snap/snapcraft/2650/legacy_snapcraft/lib/python3.5/site-packages/click/core.py", line 553, in forward
    return self.invoke(cmd, **kwargs)
  File "/snap/snapcraft/2650/legacy_snapcraft/lib/python3.5/site-packages/click/core.py", line 535, in invoke
    return callback(*args, **kwargs)
  File "/snap/snapcraft/2650/legacy_snapcraft/lib/python3.5/site-packages/snapcraft/cli/lifecycle.py", line 209, in snap
    _execute(steps.PRIME, parts=[], pack_project=True, output=output, **kwargs)
  File "/snap/snapcraft/2650/legacy_snapcraft/lib/python3.5/site-packages/snapcraft/cli/lifecycle.py", line 83, in _execute
    instance.pack_project(output=output)
  File "/snap/snapcraft/2650/legacy_snapcraft/lib/python3.5/site-packages/snapcraft/internal/build_providers/_base_provider.py", line 167, in pack_project
    self._run(command=command)
  File "/snap/snapcraft/2650/legacy_snapcraft/lib/python3.5/site-packages/snapcraft/internal/build_providers/_multipass/_multipass.py", line 40, in _run
    instance_name=self.instance_name, command=command, hide_output=hide_output
  File "/snap/snapcraft/2650/legacy_snapcraft/lib/python3.5/site-packages/snapcraft/internal/build_providers/_multipass/_multipass_command.py", line 166, in execute
    ) from process_error
snapcraft.internal.build_providers.errors.ProviderExecError: An error occurred when trying to execute 'snapcraft snap' with 'multipass': returned exit code 2.

You snapcraft seemed to be still running in V2 mode…?

UDPATE: Oh you’re just starting the port, not already ported to V3

1 Like

@bashfulrobot can you paste the full log somewhere? The extracts you posted miss the meat of the problem.

Does multipass launch work OK?

1 Like

@Saviq I did a quick test, and it does in fact work (pulled an image and spun up a VM).

AS for the log - that was all of the output (terminal). Is there a better way to generate a more verbose log?

journalctl --unit snap.multipass

Boy - this is just stumping me.

journalctl --unit snap.multipass
-- Logs begin at Mon 2019-03-25 19:21:01 PDT, end at Wed 2019
-- No entries --

Try adding a .* at the end:

$ journalctl -e --no-pager --unit snap.multipass.*
-- Logs begin at Thu 2018-10-18 09:38:29 CDT, end at Wed 2019-04-03 17:17:01 CDT. --
Apr 02 23:44:05 multipassd[28601]: /build/multipass/parts/multipass/src/src/ssh/ssh_process.cpp:119 read_stream(type = 0, timeout = -1): 
Apr 02 23:44:05 multipassd[28601]: /build/multipass/parts/multipass/src/src/ssh/ssh_process.cpp:137 read_stream(): num_bytes = 8
Apr 02 23:44:05 multipassd[28601]: /build/multipass/parts/multipass/src/src/ssh/ssh_process.cpp:137 read_stream(): num_bytes = 0
1 Like

I’ll give it a go. Appreciate the insight.

Was this ever resolved?

I’m running into this on MacOS and getting same error, “snapcraft.internal.build_providers.errors.ProviderExecError: An error occurred when trying to execute ‘sudo -i env SNAPCRAFT_HAS_TTY=True snapcraft snap’ with ‘multipass’: returned exit code 2.”.

I tried the “export SNAPCRAFT_ENABLE_DEVELOPER_DEBUG=yes” and got the following:
ken@dione3:~/workspace/duplicity-src8/build/duplicity-0.8.06$ snapcraft
Starting snapcraft 3.8 from /usr/local/Cellar/snapcraft/3.8_1/libexec/lib/python3.7/site-packages/snapcraft/cli.
snapcraft is running in a docker or podman (OCI) container
Parts dir /Users/ken/workspace/duplicity-src8/build/duplicity-0.8.06/parts
Stage dir /Users/ken/workspace/duplicity-src8/build/duplicity-0.8.06/stage
Prime dir /Users/ken/workspace/duplicity-src8/build/duplicity-0.8.06/prime
snapcraft is running in a docker or podman (OCI) container
Parts dir /Users/ken/workspace/duplicity-src8/build/duplicity-0.8.06/parts
Stage dir /Users/ken/workspace/duplicity-src8/build/duplicity-0.8.06/stage
Prime dir /Users/ken/workspace/duplicity-src8/build/duplicity-0.8.06/prime
Launching a VM.
Running multipass start snapcraft-duplicity
snapcraft is running as a snap False, SNAP_NAME set to ‘’
Holding refreshes for snaps.
Running multipass exec snapcraft-duplicity – sudo -i env SNAPCRAFT_HAS_TTY=True snap set core refresh.hold=2019-11-03T11:26:39.766109Z
Waiting for pending snap auto refreshes.
Running multipass exec snapcraft-duplicity – sudo -i env SNAPCRAFT_HAS_TTY=True snap watch --last=auto-refresh
Parts dir /Users/ken/workspace/duplicity-src8/build/duplicity-0.8.06/parts
Stage dir /Users/ken/workspace/duplicity-src8/build/duplicity-0.8.06/stage
Prime dir /Users/ken/workspace/duplicity-src8/build/duplicity-0.8.06/prime
Parts dir /Users/ken/workspace/duplicity-src8/build/duplicity-0.8.06/parts
Stage dir /Users/ken/workspace/duplicity-src8/build/duplicity-0.8.06/stage
Prime dir /Users/ken/workspace/duplicity-src8/build/duplicity-0.8.06/prime
Parts dir /Users/ken/workspace/duplicity-src8/build/duplicity-0.8.06/parts
Stage dir /Users/ken/workspace/duplicity-src8/build/duplicity-0.8.06/stage
Prime dir /Users/ken/workspace/duplicity-src8/build/duplicity-0.8.06/prime
Parts dir /Users/ken/workspace/duplicity-src8/build/duplicity-0.8.06/parts
Stage dir /Users/ken/workspace/duplicity-src8/build/duplicity-0.8.06/stage
Prime dir /Users/ken/workspace/duplicity-src8/build/duplicity-0.8.06/prime
Getting information for core
Calling …://api.snapcraft.io/v2/snaps/info/core with params {‘fields’: ‘channel-map,snap-id,name,publisher,confinement,revision,download’} and headers {‘Accept’: ‘application/json’, ‘Snap-Device-Series’: ‘16’, ‘User-Agent’: ‘snapcraft/3.8 / (amd64)’}
Running multipass exec snapcraft-duplicity – sudo -i env SNAPCRAFT_HAS_TTY=True snap refresh --channel stable core
snap “core” has no updates available
Parts dir /Users/ken/workspace/duplicity-src8/build/duplicity-0.8.06/parts
Stage dir /Users/ken/workspace/duplicity-src8/build/duplicity-0.8.06/stage
Prime dir /Users/ken/workspace/duplicity-src8/build/duplicity-0.8.06/prime
Parts dir /Users/ken/workspace/duplicity-src8/build/duplicity-0.8.06/parts
Stage dir /Users/ken/workspace/duplicity-src8/build/duplicity-0.8.06/stage
Prime dir /Users/ken/workspace/duplicity-src8/build/duplicity-0.8.06/prime
Parts dir /Users/ken/workspace/duplicity-src8/build/duplicity-0.8.06/parts
Stage dir /Users/ken/workspace/duplicity-src8/build/duplicity-0.8.06/stage
Prime dir /Users/ken/workspace/duplicity-src8/build/duplicity-0.8.06/prime
Parts dir /Users/ken/workspace/duplicity-src8/build/duplicity-0.8.06/parts
Stage dir /Users/ken/workspace/duplicity-src8/build/duplicity-0.8.06/stage
Prime dir /Users/ken/workspace/duplicity-src8/build/duplicity-0.8.06/prime
Getting information for snapcraft
Calling …//api.snapcraft.io/v2/snaps/info/snapcraft with params {‘fields’: ‘channel-map,snap-id,name,publisher,confinement,revision,download’} and headers {‘Accept’: ‘application/json’, ‘Snap-Device-Series’: ‘16’, ‘User-Agent’: ‘snapcraft/3.8 / (amd64)’}
Running multipass exec snapcraft-duplicity – sudo -i env SNAPCRAFT_HAS_TTY=True snap refresh --classic --channel stable snapcraft
snap “snapcraft” has no updates available
Parts dir /Users/ken/workspace/duplicity-src8/build/duplicity-0.8.06/parts
Stage dir /Users/ken/workspace/duplicity-src8/build/duplicity-0.8.06/stage
Prime dir /Users/ken/workspace/duplicity-src8/build/duplicity-0.8.06/prime
Parts dir /Users/ken/workspace/duplicity-src8/build/duplicity-0.8.06/parts
Stage dir /Users/ken/workspace/duplicity-src8/build/duplicity-0.8.06/stage
Prime dir /Users/ken/workspace/duplicity-src8/build/duplicity-0.8.06/prime
Parts dir /Users/ken/workspace/duplicity-src8/build/duplicity-0.8.06/parts
Stage dir /Users/ken/workspace/duplicity-src8/build/duplicity-0.8.06/stage
Prime dir /Users/ken/workspace/duplicity-src8/build/duplicity-0.8.06/prime
Parts dir /Users/ken/workspace/duplicity-src8/build/duplicity-0.8.06/parts
Stage dir /Users/ken/workspace/duplicity-src8/build/duplicity-0.8.06/stage
Prime dir /Users/ken/workspace/duplicity-src8/build/duplicity-0.8.06/prime
Getting information for core18
Calling …://api.snapcraft.io/v2/snaps/info/core18 with params {‘fields’: ‘channel-map,snap-id,name,publisher,confinement,revision,download’} and headers {‘Accept’: ‘application/json’, ‘Snap-Device-Series’: ‘16’, ‘User-Agent’: ‘snapcraft/3.8 / (amd64)’}
Running multipass exec snapcraft-duplicity – sudo -i env SNAPCRAFT_HAS_TTY=True snap refresh --channel stable core18
snap “core18” has no updates available
Running multipass exec snapcraft-duplicity – sudo -i env SNAPCRAFT_HAS_TTY=True printenv HOME
Running multipass exec snapcraft-duplicity – sudo -i env SNAPCRAFT_HAS_TTY=True snapcraft snap
Could not find snap/snapcraft.yaml. Are you sure you are in the right directory?
To start a new project, use snapcraft init
Running multipass exec snapcraft-duplicity – sudo -i env SNAPCRAFT_HAS_TTY=True test -f /var/folders/qr/rwbgbn9s1d1g4vhk1g9zngdr0000gn/T/snapcraft_provider_traceback
— Logging error —
Traceback (most recent call last):
File “/usr/local/Cellar/snapcraft/3.8_1/libexec/lib/python3.7/site-packages/snapcraft/internal/build_providers/_multipass/_multipass_command.py”, line 231, in execute
_run(cmd, stdin=None)
File “/usr/local/Cellar/snapcraft/3.8_1/libexec/lib/python3.7/site-packages/snapcraft/internal/build_providers/_multipass/_multipass_command.py”, line 36, in _run
subprocess.check_call(command, stdin=stdin)
File “/usr/local/opt/python/Frameworks/Python.framework/Versions/3.7/lib/python3.7/subprocess.py”, line 347, in check_call
raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command ‘[‘multipass’, ‘exec’, ‘snapcraft-duplicity’, ‘–’, ‘sudo’, ‘-i’, ‘env’, ‘SNAPCRAFT_HAS_TTY=True’, ‘snapcraft’, ‘snap’]’ returned non-zero exit status 2.

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
File “/usr/local/Cellar/snapcraft/3.8_1/libexec/lib/python3.7/site-packages/snapcraft/cli/lifecycle.py”, line 104, in _execute
instance.pack_project(output=output)
File “/usr/local/Cellar/snapcraft/3.8_1/libexec/lib/python3.7/site-packages/snapcraft/internal/build_providers/_base_provider.py”, line 203, in pack_project
self._run(command=command)
File “/usr/local/Cellar/snapcraft/3.8_1/libexec/lib/python3.7/site-packages/snapcraft/internal/build_providers/_multipass/_multipass.py”, line 89, in _run
instance_name=self.instance_name, command=command, hide_output=hide_output
File “/usr/local/Cellar/snapcraft/3.8_1/libexec/lib/python3.7/site-packages/snapcraft/internal/build_providers/_multipass/_multipass_command.py”, line 237, in execute
) from process_error
snapcraft.internal.build_providers.errors.ProviderExecError: An error occurred when trying to execute ‘sudo -i env SNAPCRAFT_HAS_TTY=True snapcraft snap’ with ‘multipass’: returned exit code 2.

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File “/usr/local/Cellar/snapcraft/3.8_1/libexec/lib/python3.7/site-packages/snapcraft/internal/build_providers/_multipass/_multipass_command.py”, line 231, in execute
_run(cmd, stdin=None)
File “/usr/local/Cellar/snapcraft/3.8_1/libexec/lib/python3.7/site-packages/snapcraft/internal/build_providers/_multipass/_multipass_command.py”, line 36, in _run
subprocess.check_call(command, stdin=stdin)
File “/usr/local/opt/python/Frameworks/Python.framework/Versions/3.7/lib/python3.7/subprocess.py”, line 347, in check_call
raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command ‘[‘multipass’, ‘exec’, ‘snapcraft-duplicity’, ‘–’, ‘sudo’, ‘-i’, ‘env’, ‘SNAPCRAFT_HAS_TTY=True’, ‘test’, ‘-f’, ‘/var/folders/qr/rwbgbn9s1d1g4vhk1g9zngdr0000gn/T/snapcraft_provider_traceback’]’ returned non-zero exit status 1.

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
File “/usr/local/Cellar/snapcraft/3.8_1/libexec/lib/python3.7/site-packages/snapcraft/cli/lifecycle.py”, line 141, in _retrieve_provider_error
instance.pull_file(TRACEBACK_MANAGED, TRACEBACK_HOST, delete=True)
File “/usr/local/Cellar/snapcraft/3.8_1/libexec/lib/python3.7/site-packages/snapcraft/internal/build_providers/_multipass/_multipass.py”, line 227, in pull_file
self._run(command=[“test”, “-f”, name])
File “/usr/local/Cellar/snapcraft/3.8_1/libexec/lib/python3.7/site-packages/snapcraft/internal/build_providers/_multipass/_multipass.py”, line 89, in _run
instance_name=self.instance_name, command=command, hide_output=hide_output
File “/usr/local/Cellar/snapcraft/3.8_1/libexec/lib/python3.7/site-packages/snapcraft/internal/build_providers/_multipass/_multipass_command.py”, line 237, in execute
) from process_error
snapcraft.internal.build_providers.errors.ProviderExecError: An error occurred when trying to execute ‘sudo -i env SNAPCRAFT_HAS_TTY=True test -f /var/folders/qr/rwbgbn9s1d1g4vhk1g9zngdr0000gn/T/snapcraft_provider_traceback’ with ‘multipass’: returned exit code 1.

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File “/usr/local/opt/python/Frameworks/Python.framework/Versions/3.7/lib/python3.7/logging/init.py”, line 1025, in emit
msg = self.format(record)
File “/usr/local/opt/python/Frameworks/Python.framework/Versions/3.7/lib/python3.7/logging/init.py”, line 869, in format
return fmt.format(record)
File “/usr/local/Cellar/snapcraft/3.8_1/libexec/lib/python3.7/site-packages/snapcraft/internal/log.py”, line 45, in format
log_message = super().format(record)
File “/usr/local/opt/python/Frameworks/Python.framework/Versions/3.7/lib/python3.7/logging/init.py”, line 608, in format
record.message = record.getMessage()
File “/usr/local/opt/python/Frameworks/Python.framework/Versions/3.7/lib/python3.7/logging/init.py”, line 369, in getMessage
msg = msg % self.args
TypeError: not all arguments converted during string formatting
Call stack:
File “/usr/local/bin/snapcraft”, line 8, in
sys.exit(run())
File “/usr/local/Cellar/snapcraft/3.8_1/libexec/lib/python3.7/site-packages/click/core.py”, line 764, in call
return self.main(*args, **kwargs)
File “/usr/local/Cellar/snapcraft/3.8_1/libexec/lib/python3.7/site-packages/click/core.py”, line 717, in main
rv = self.invoke(ctx)
File “/usr/local/Cellar/snapcraft/3.8_1/libexec/lib/python3.7/site-packages/click/core.py”, line 1114, in invoke
return Command.invoke(self, ctx)
File “/usr/local/Cellar/snapcraft/3.8_1/libexec/lib/python3.7/site-packages/click/core.py”, line 956, in invoke
return ctx.invoke(self.callback, **ctx.params)
File “/usr/local/Cellar/snapcraft/3.8_1/libexec/lib/python3.7/site-packages/click/core.py”, line 555, in invoke
return callback(*args, **kwargs)
File “/usr/local/Cellar/snapcraft/3.8_1/libexec/lib/python3.7/site-packages/click/decorators.py”, line 17, in new_func
return f(get_current_context(), *args, **kwargs)
File “/usr/local/Cellar/snapcraft/3.8_1/libexec/lib/python3.7/site-packages/snapcraft/cli/_runner.py”, line 103, in run
snap_command.invoke(ctx)
File “/usr/local/Cellar/snapcraft/3.8_1/libexec/lib/python3.7/site-packages/snapcraft/cli/_command.py”, line 87, in invoke
return super().invoke(ctx)
File “/usr/local/Cellar/snapcraft/3.8_1/libexec/lib/python3.7/site-packages/click/core.py”, line 956, in invoke
return ctx.invoke(self.callback, **ctx.params)
File “/usr/local/Cellar/snapcraft/3.8_1/libexec/lib/python3.7/site-packages/click/core.py”, line 555, in invoke
return callback(*args, **kwargs)
File “/usr/local/Cellar/snapcraft/3.8_1/libexec/lib/python3.7/site-packages/snapcraft/cli/lifecycle.py”, line 261, in snap
_execute(steps.PRIME, parts=[], pack_project=True, output=output, **kwargs)
File “/usr/local/Cellar/snapcraft/3.8_1/libexec/lib/python3.7/site-packages/snapcraft/cli/lifecycle.py”, line 111, in _execute
_retrieve_provider_error(instance)
File “/usr/local/Cellar/snapcraft/3.8_1/libexec/lib/python3.7/site-packages/snapcraft/cli/lifecycle.py”, line 143, in _retrieve_provider_error
logger.debug(“can’t retrieve error file: {}”, str(e))
Message: “can’t retrieve error file: {}”
Arguments: (“An error occurred when trying to execute ‘sudo -i env SNAPCRAFT_HAS_TTY=True test -f /var/folders/qr/rwbgbn9s1d1g4vhk1g9zngdr0000gn/T/snapcraft_provider_traceback’ with ‘multipass’: returned exit code 1.”,)
Run the same command again with --debug to shell into the environment if you wish to introspect this failure.
Running multipass stop --time 10 snapcraft-duplicity
Sorry, an error occurred in Snapcraft:
An error occurred when trying to execute ‘sudo -i env SNAPCRAFT_HAS_TTY=True snapcraft snap’ with ‘multipass’: returned exit code 2.
Traceback (most recent call last):
File “/usr/local/Cellar/snapcraft/3.8_1/libexec/lib/python3.7/site-packages/snapcraft/internal/build_providers/_multipass/_multipass_command.py”, line 231, in execute
_run(cmd, stdin=None)
File “/usr/local/Cellar/snapcraft/3.8_1/libexec/lib/python3.7/site-packages/snapcraft/internal/build_providers/_multipass/_multipass_command.py”, line 36, in _run
subprocess.check_call(command, stdin=stdin)
File “/usr/local/opt/python/Frameworks/Python.framework/Versions/3.7/lib/python3.7/subprocess.py”, line 347, in check_call
raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command ‘[‘multipass’, ‘exec’, ‘snapcraft-duplicity’, ‘–’, ‘sudo’, ‘-i’, ‘env’, ‘SNAPCRAFT_HAS_TTY=True’, ‘snapcraft’, ‘snap’]’ returned non-zero exit status 2.

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
File “/usr/local/bin/snapcraft”, line 8, in
sys.exit(run())
File “/usr/local/Cellar/snapcraft/3.8_1/libexec/lib/python3.7/site-packages/click/core.py”, line 764, in call
return self.main(*args, **kwargs)
File “/usr/local/Cellar/snapcraft/3.8_1/libexec/lib/python3.7/site-packages/click/core.py”, line 717, in main
rv = self.invoke(ctx)
File “/usr/local/Cellar/snapcraft/3.8_1/libexec/lib/python3.7/site-packages/click/core.py”, line 1114, in invoke
return Command.invoke(self, ctx)
File “/usr/local/Cellar/snapcraft/3.8_1/libexec/lib/python3.7/site-packages/click/core.py”, line 956, in invoke
return ctx.invoke(self.callback, **ctx.params)
File “/usr/local/Cellar/snapcraft/3.8_1/libexec/lib/python3.7/site-packages/click/core.py”, line 555, in invoke
return callback(*args, **kwargs)
File “/usr/local/Cellar/snapcraft/3.8_1/libexec/lib/python3.7/site-packages/click/decorators.py”, line 17, in new_func
return f(get_current_context(), *args, **kwargs)
File “/usr/local/Cellar/snapcraft/3.8_1/libexec/lib/python3.7/site-packages/snapcraft/cli/_runner.py”, line 103, in run
snap_command.invoke(ctx)
File “/usr/local/Cellar/snapcraft/3.8_1/libexec/lib/python3.7/site-packages/snapcraft/cli/_command.py”, line 87, in invoke
return super().invoke(ctx)
File “/usr/local/Cellar/snapcraft/3.8_1/libexec/lib/python3.7/site-packages/click/core.py”, line 956, in invoke
return ctx.invoke(self.callback, **ctx.params)
File “/usr/local/Cellar/snapcraft/3.8_1/libexec/lib/python3.7/site-packages/click/core.py”, line 555, in invoke
return callback(*args, **kwargs)
File “/usr/local/Cellar/snapcraft/3.8_1/libexec/lib/python3.7/site-packages/snapcraft/cli/lifecycle.py”, line 261, in snap
_execute(steps.PRIME, parts=[], pack_project=True, output=output, **kwargs)
File “/usr/local/Cellar/snapcraft/3.8_1/libexec/lib/python3.7/site-packages/snapcraft/cli/lifecycle.py”, line 104, in _execute
instance.pack_project(output=output)
File “/usr/local/Cellar/snapcraft/3.8_1/libexec/lib/python3.7/site-packages/snapcraft/internal/build_providers/_base_provider.py”, line 203, in pack_project
self._run(command=command)
File “/usr/local/Cellar/snapcraft/3.8_1/libexec/lib/python3.7/site-packages/snapcraft/internal/build_providers/_multipass/_multipass.py”, line 89, in _run
instance_name=self.instance_name, command=command, hide_output=hide_output
File “/usr/local/Cellar/snapcraft/3.8_1/libexec/lib/python3.7/site-packages/snapcraft/internal/build_providers/_multipass/_multipass_command.py”, line 237, in execute
) from process_error
snapcraft.internal.build_providers.errors.ProviderExecError: An error occurred when trying to execute ‘sudo -i env SNAPCRAFT_HAS_TTY=True snapcraft snap’ with ‘multipass’: returned exit code 2.
You can find the traceback in file ‘/var/folders/qr/rwbgbn9s1d1g4vhk1g9zngdr0000gn/T/tmp5mdjsuvn/trace.txt’.

Replying to self.

I have a partial fix for this and that is to not let the build system shutdown between tries. I do:

$ multipass stop --cancel snapcraft-duplicity

after each run and it’s stayed stable for many builds now.