I’ve been running with sudo as a (reluctant, but I figured benign) workaround to an issue similar to the one described here https://bugs.launchpad.net/snapcraft/+bug/1676684.
In my case, when running as a regular user, I get the following permissions error during the install stage:
File "/usr/lib/python3/dist-packages/snapcraft/plugins/python.py", line 368, in build
File "/usr/lib/python3/dist-packages/snapcraft/plugins/python.py", line 345, in _fix_permissions
File "/usr/lib/python3/dist-packages/snapcraft/plugins/python.py", line 536, in _replicate_owner_mode
PermissionError: [Errno 1] Operation not permitted: '/home/<username>/<snapname>/parts/<partname>/install/usr/lib/x86_64-linux-gnu/libnss_compat.so'
I’ve only pasted the last few lines here, but it’s basically a permissions error when attempting to chmod a file that’s actually for some reason a symlink to
The above permissions error only occurs if I include
stage-packages in my
snapcraft.yaml - which is similar behavior to the bug report on Launchpad that I linked to.
Is there a reasonable way to fix this behavior (e.g. by using a custom install script), or am I best off just doing a cleanbuild in a container?