I installed a snap package in Ubuntu 18.04 package and I want to edit one of its files using root account. First I switched to root with su
, but then when I opened file in nano it tells me:
[ File '/snap/phpstorm/36/bin/phpstorm64.vmoptions' is unwritable ]
Then I tried this:
root@elahe-VPCEA31FX:/home/elahe# sudoedit /snap/phpstorm/36/bin/phpstorm64.vmoptions
after above command the file opened in nano, but after making changes and saving with Ctrl+O and after exiting with Ctrl+x I got this message:
sudoedit: unable to write to /snap/phpstorm/36/bin/phpstorm64.vmoptions: Read-only file system
sudoedit: contents of edit session left in /var/tmp/phpstorm64XXRCQzZi.vmoptions
I even tried to change the permissions of the file with this command:
root@elahe-VPCEA31FX:/home/elahe# chmod 755 /snap/phpstorm/36/bin/phpstorm64.vmoptions
and got this:
chmod: changing permissions of '/snap/phpstorm/36/bin/phpstorm64.vmoptions': Read-only file system
It is really amazing that the root user cannot edit a file! Is this a bug?
The snap files are mounted as read-only (ro), and you can check this by using the mount command.
To modify files in squashfs, you need to unsquash it, modify the files and then re-make the squashfs file. E.g., if I want to modify files in
/var/lib/snapd/snaps/vlc_365.snap
Modify anything you want in
squashfs-root
(it's where all the files are unpacked into), and then repack it.Copy it back to its original location and re-mount it.