Permission denied when building with snapcore/snapcraft

I’m still getting the same failure when using both of the versions I have installed:

snap list --all snapcraft
Name       Version  Rev   Tracking  Publisher   Notes
snapcraft  2.42.1   1594  stable    canonical✓  classic
snapcraft  2.43     1803  stable    canonical✓  disabled,classic

FYI our snap is defined here:

Bugfix is at , but it’s not at newest snap package.

So I removed snap version, and installed snapcraft from source, and it seems to work for me.

Snapcraft source install on Ubuntu 16.04 64bit

# Add to /root/.bashrc:
export PATH="$PATH:/home/user/repos/snapcraft/bin"

# Install dependencies
sudo apt install python3-yaml python3-tabulate python3-pymacaroons python3-progressbar \
python3-requests-unixsocket python3-petname python3-pyelftools xdelta3

# Install snapcraft
cd ~/repos
git clone
cd snapcraft
sudo python3 install

# Workaround bug
sudo ln -s /usr/local/lib/python3.5/dist-packages/snapcraft-2.43-py3.5.egg/share/snapcraft/ /usr/share/snapcraft

# Build package
cd ~/repos/myproject
sudo snapcraft

that shows you don’t have any other revision, and as I said

(if you don’t have it, you can’t revert to it)

Can you detail how you are building? Having the snap and having docker are orthogonal situations for me.

But considering docker, by doing,

diff --git a/snap/ b/snap/
index 8a73ab6..9b09623 100755
--- a/snap/
+++ b/snap/
@@ -1,2 +1,2 @@
-docker pull snapcore/snapcraft
-docker run -it -v "$PWD:$PWD" -w "$PWD" snapcore/snapcraft snapcraft
\ No newline at end of file
+docker pull snapcore/snapcraft:stable
+docker run -it -v "$PWD:$PWD" -w "$PWD" snapcore/snapcraft:stable snapcraft

I successfully built zaproxy, here’s a full video doing that from a fresh Digital Ocean instance using its pre-baked docker setup


If however you are using snapcraft, I do not suspect the title of this topic is what is affecting you and I would appreciate a new thread to not mix up the topics for other casual readers passing through :slight_smile:

I’m building a snap because we want to release ZAP as a snap.
I’m using docker to build it because I use Fedora which is not supported for building snaps :slight_smile:

Yes there are 2 different problems here.
Although you can build zaproxy with snapcraft:stable you cannot run it - it fails with ‘desktop-launch: not found’. Thats a known problem which appears to happen for both stable and beta docker containers. Thats why we need to use latest. If you use latest then the build fails as per this issue.
Any idea when the latest image will be rebuilt?

This affects also me, because I get permission denied error.

Docker Hub image snapcore/snapcraft installs old version of snapcraft from Ubuntu xenial repos:

To make new Docker version, you would need Dockerfile similar to this, but completed with all steps (I did not have time to finish it yet)

FROM ubuntu:xenial

# Enable multiverse as snapcraft cleanbuild does.
RUN sed -i 's/ universe/ universe multiverse/' /etc/apt/sources.list

RUN apt-get update && \
  apt-get dist-upgrade --yes && \
  apt-get install --yes \
  git \
  python3-yaml \
  python3-tabulate \
  python3-pymacaroons \
  python3-progressbar \
  python3-requests-unixsocket \
  python3-petname \
  python3-pyelftools \
  xdelta3 \
  && \
  git clone && \
  cd snapcraft && \
  python3 install && \
  ln -s /usr/local/lib/python3.5/dist-packages/snapcraft-2.43-py3.5.egg/share/snapcraft/ /usr/share/snapcraft && \
  && \
  apt-get autoclean --yes && \
  apt-get clean --yes

The snap version of snapcraft, that is installed with sudo snap install snapcraft --classic also does not have newest fix for permission denied yet.

I did not get snapcraft working in Docker, VirtualBox, etc. Only way to get it working for me was to install Xubuntu 16.04 64 desktop, and then install snapcraft from GitHub repo, so I did get Wekan snap package built and uploaded to snap store.

To remind myself later, I added wiki page for myself to:

Today I noticed new activity on this issue, so I hope snap build servers will be fixed:

1 Like

For cleanbuild? That is true, 2.43.1 should have the fix, snapd was released a bit to quickly for us to sync that out.

Why don’t you docker pull snapcore/snapcraft:stable though? That dockerfile, as is, will miss out environment settings when building classic confined snaps.

I did try docker longer time ago, and it did not work for me. Also using virtualbox did not work for me.

I build wekan for strict confinement. Not classic.

When installing snapcraft, sudo snap install snapcraft --classic installs snapcraft command for building snap packages locally with command sudo snapcraft on my local desktop. It does run on my laptop bare metal, so command line option cleanbuild is not used. But that snap package version of snapcraft command is broken, so I installed snapcraft command from source, without any docker/virtualbox/lxc.

Any update on this?
The bug appears to have been fixed.
But I’ve just had the same error using the most recent ‘latest’ docker image :frowning:
For info I’m using the configs in this PR:

Use the docker image tagged stable as @sergiusens stated above.

And as I stated above, the stable docker image does build the snap, but when you try to run the zaproxy snap it fails with ‘desktop-launch: not found’.

Sorry, I missed that bit :man_facepalming:.

I’m not sure what else to suggest then, beyond coming across really arsey by suggesting completely changing your entire infrastructure to use snapcraft outside of a docker image (I appreciate that’s really not helpful :frowning: )

Its a pain because it was working until this bug reared its head.
I dont want to change my desktop distro just to satisfy one tool, but I can ask someone else who uses ubuntu to generate the snap.
But I would have thought an option for people who dont use ubuntu would be worth supporting…

did you consider using the lxd snap for container builds instead of docker ? (not sure how well this setup works on other distros, but perhaps it would be worth a try)

I’ve used docker a fair amount but not used lxd at all, which is why I went for docker. I dont have a problem using lxd but it’ll probably take me a while to get up to speed with it.

depending on your host distro, this should work:

For a dirty but quick build, use this one :wink:

I built the repo that was mentioned, check the asciinema video and it all worked (desktop-launch was found at least).

snapcraft/snapcore:latest is now fixed with 2.43.1

snapcraft/snapcore:stable also has 2.43.1 as well