Being able to test snapcraft builds locally before submitting to a CI builder is a huge time-saver for me. Since I already do this in a dedicated VM, I use SNAPCRAFT_BUILD_ENVIRONMENT=host
in order to avoid creating unnecessary layers of abstraction/resource use.
However, since updating to snapcraft 7, trying to run this is a regular user leads to a permission error:
$ snapcraft
Executed: pull <some-part>
Failed to refresh package list: failed to run apt update.
Full execution log: '/<...>/log/snapcraft-20220718-170429.544282.log'
The above error is fairly self explanatory: the log file confirms that snapcraft
tries to run apt-get update
and fails, which makes sense since it’s running under a regular user without permissions to the relevant system files. I’m not sure how this worked previously, but this was definitely not an issue with older versions of snapcraft.
Am I trying to do something that is no longer supported? Should I be running snapcraft
with sudo
?