I’ve recently been running into some issues when trying to use snapcraft in an Azure Pipelines CI setup. As far as I can tell it’s related to a permissions problem related to snapd.
Installation works OK (
sudo snap install --classic --stable snapcraft) but when the CI job tries to run
snapcraft it emits an error:
+ snapcraft --version / not root-owned 1001:50 + snapcraft / not root-owned 1001:50
The error is correct:
/ in the CI job is owned by
root (which I presume is a special user created by Azure Pipelines).
snapd itself is running as
root, as one would expect.
Any advice on how to deal with this? I presume it’s a safety feature to prevent
snapd from writing into directories it shouldn’t be able to, but in this case it appears to be coming up against a deliberate decision by Azure Pipelines that the root dir of the CI job should not be owned by the
root user. (Most of its contents on the other hand are
root-owned: all the usual system dirs.)