Snapcraft fails with: shutil.Error: ... call_feedback` is a named pipe')

For about a year I was using this command to successfully build my snaps in a docker-container, but 1-2 weeks ago snapcraft suddenly stopped working :

docker run --rm -v $PWD/tmp:/tmp -v $PWD:/code snapcore/snapcraft bash -c "cd /code;snapcraft clean;snapcraft"

Now it always fails with some shutil.Error.

I could reproduce the error with this example snap here:

Snapcraft version is: ‘2.43’

Traceback (most recent call last):
  File "/snap/snapcraft/current/bin/snapcraft", line 11, in <module>
    load_entry_point('snapcraft==2.43', 'console_scripts', 'snapcraft')()
  File "/snap/snapcraft/current/lib/python3.5/site-packages/click/core.py", line 722, in __call__
    return self.main(*args, **kwargs)
  File "/snap/snapcraft/current/lib/python3.5/site-packages/click/core.py", line 697, in main
    rv = self.invoke(ctx)
  File "/snap/snapcraft/current/lib/python3.5/site-packages/click/core.py", line 1043, in invoke
    return Command.invoke(self, ctx)
  File "/snap/snapcraft/current/lib/python3.5/site-packages/click/core.py", line 895, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/snap/snapcraft/current/lib/python3.5/site-packages/click/core.py", line 535, in invoke
    return callback(*args, **kwargs)
  File "/snap/snapcraft/current/lib/python3.5/site-packages/click/decorators.py", line 17, in new_func
    return f(get_current_context(), *args, **kwargs)
  File "/snap/snapcraft/current/lib/python3.5/site-packages/snapcraft/cli/_runner.py", line 93, in run
    ctx.forward(lifecyclecli.commands["snap"])
  File "/snap/snapcraft/current/lib/python3.5/site-packages/click/core.py", line 553, in forward
    return self.invoke(cmd, **kwargs)
  File "/snap/snapcraft/current/lib/python3.5/site-packages/click/core.py", line 535, in invoke
    return callback(*args, **kwargs)
  File "/snap/snapcraft/current/lib/python3.5/site-packages/snapcraft/cli/lifecycle.py", line 136, in snap
    project = _execute(steps.PRIME, parts=[], **kwargs)
  File "/snap/snapcraft/current/lib/python3.5/site-packages/snapcraft/cli/lifecycle.py", line 35, in _execute
    lifecycle.execute(step, project_config, parts)
  File "/snap/snapcraft/current/lib/python3.5/site-packages/snapcraft/internal/lifecycle/_runner.py", line 90, in execute
    executor.run(step, part_names)
  File "/snap/snapcraft/current/lib/python3.5/site-packages/snapcraft/internal/lifecycle/_runner.py", line 194, in run
    self._handle_step(part_names, part, step, current_step, cli_config)
  File "/snap/snapcraft/current/lib/python3.5/site-packages/snapcraft/internal/lifecycle/_runner.py", line 208, in _handle_step
    getattr(self, "_run_{}".format(current_step.name))(part)
  File "/snap/snapcraft/current/lib/python3.5/site-packages/snapcraft/internal/lifecycle/_runner.py", line 261, in _run_build
    self._run_step(step=steps.BUILD, part=part, progress="Building")
  File "/snap/snapcraft/current/lib/python3.5/site-packages/snapcraft/internal/lifecycle/_runner.py", line 327, in _run_step
    getattr(part, step.name)()
  File "/snap/snapcraft/current/lib/python3.5/site-packages/snapcraft/internal/pluginhandler/__init__.py", line 520, in build
    ignore=ignore,
  File "/snap/snapcraft/current/usr/lib/python3.5/shutil.py", line 353, in copytree
    raise Error(errors)
shutil.Error: [('/code/parts/mount/src/tmp/tmpia2x682h/function_call', '/code/parts/mount/build/tmp/tmpia2x682h/function_call', '`/code/parts/mount/src/tmp/tmpia2x682h/function_call` is a named pipe'), ('/code/parts/mount/src/tmp/tmpia2x682h/call_feedback', '/code/parts/mount/build/tmp/tmpia2x682h/call_feedback', '`/code/parts/mount/src/tmp/tmpia2x682h/call_feedback` is a named pipe')]

While I think it goes counter to the standard docker methodology, the snapcraft release in latest is the bleeding edge release, not the stable release. Instead the stable release is tagged stable:

docker run --rm -it -v $(pwd):$(pwd) -w $(pwd) snapcore/snapcraft:stable snapcraft

The same error occurs with the stable release. Also I think snapcraft doesn’t really distinguish between stable and edge. Or at least promotes edge extremly fast to stable.

The problem still occurs with stable and with edge release. Were you able to reproduce it in your environment with the minimal snap I linked?

docker run --rm snapcore/snapcraft:stable snapcraft --version
snapcraft, version '2.43'
docker run --rm snapcore/snapcraft:edge snapcraft --version
snapcraft, version 2.43.1

I think your problem is that you’re mounting part of your project to the container’s /tmp folder, which means that random junk gets dumped there. Snapcraft is complaining that it cannot copy a file from this /tmp folder because it is a named pipe, not a regular file.

Oh my god, you are right, I tried with the following command and it worked. I only added the tmp volume to have a look into the trace file of a different error, and probably from that point on I was stuck with the error caused by myself.

Thank you very much, that saved my day :slight_smile:

docker run --rm -v /tmp/snapbuild:/tmp -v $PWD:/code snapcore/snapcraft:stable bash -c "cd /code;snapcraft clean;snapcraft"