Snap's program files are protected against change. This is done by the process of mounting the protected files in their specific space as read only.
The process also has specific space for configuration data which includes the user's specific home space (/home/user/snap
) for data and configurations and a space for world-wide data (/var/snap
).
All the world-wide snap files are readable and accessible via symbolic links to the /snap
area.
You can verify the real location and how the spaces are linked with the following commands.
A command to see examples of snap's protected mounts:
$ mount | egrep snap | egrep ro,
/var/lib/snapd/snaps/core_4486.snap on /snap/core/4486 type squashfs (ro,nodev,relatime,x-gdu.hide)
/var/lib/snapd/snaps/communitheme_185.snap on /snap/communitheme/185 type squashfs (ro,nodev,relatime,x-gdu.hide)
/var/lib/snapd/snaps/hello-world_27.snap on /snap/hello-world/27 type squashfs (ro,nodev,relatime)
/var/lib/snapd/snaps/core_4407.snap on /snap/core/4407 type squashfs (ro,nodev,relatime,x-gdu.hide)
/var/lib/snapd/snaps/communitheme_124.snap on /snap/communitheme/124 type squashfs (ro,nodev,relatime,x-gdu.hide)
/var/lib/snapd/snaps/core_4571.snap on /snap/core/4571 type squashfs (ro,nodev,relatime,x-gdu.hide)
/var/lib/snapd/snaps/communitheme_246.snap on /snap/communitheme/246 type squashfs (ro,nodev,relatime,x-gdu.hide)
/var/lib/snapd/snaps/vlc_190.snap on /snap/vlc/190 type squashfs (ro,nodev,relatime,x-gdu.hide)
A command to see examples of snap's spaces that are not write protected:
$ mount | egrep snap | egrep -v ro,
tmpfs on /run/snapd/ns type tmpfs (rw,nosuid,noexec,relatime,size=3293156k,mode=755)
nsfs on /run/snapd/ns/hello-world.mnt type nsfs (rw)
nsfs on /run/snapd/ns/vlc.mnt type nsfs (rw)
By your error message you are trying to make change on files that have been programmably protected by the programmer. Your question suggests that you are the app's programmer. So you would have to use the features of snap's programming configuration to decide which files will be placed where.
How can I resolve this?
As I suggested in the comments, it would be safer and more common for you to design your program in a development environment as a normal user... normally in your own personal space, then use the snap's development system for installing the new version.
I'm not a snap programmer and can't give exact specifics of how the designing and export for use process works with snap. But I can imagine it might be similar to designing Android, or Java programs, where the developer will use some type of export or publish method to run or to test the new version in an installed configuration.
You could possibly experiment with remounting the protected read-only filesystems to read/write. I wouldn't advise it, because it might be possible to break the integrity of the snap system, or provide unexpected behavior where your application may not behave as intended because of the modification of the snap system itself.
sudo
command. My suggestion was then, with is consistent, is that you really shouldn't have to work on the program and development fromsudo
. The/snap/my_app/my_file.js
appeared to be a project that you were working on. Your recent comment still appears to suggest the same. Even if it's slightly different, it would be best to work on the your integration project in your personal space by a non-elevated user account and (develope
), work on it that way. – L. D. James May 15 '18 at 21:22/snap
isn't the best and most secure method. Making the system-wide change, while you're working and debugging it could cause a undesirable integrity effect of yoursnap
installation ( or your overall system's integrity). You can easily make the changes to the data files if you bring your project into your personal space. Once you get it working the way you want it, you can then apply your changes and patches necessary to the/snap
(which is system-wide) environment. – L. D. James May 15 '18 at 21:26