2

Let's say I have a product installed in my linux (elementary OS):

NAME="elementary OS" VERSION="6.1 Jólnir"

I also have Windows 10 installed in my system (dual boot) and I want to make some changes in the source code, but I keep getting this error:

chmod: changing permissions of 'filename': Read-only file system

It just happens to this file/directory.

Things i tried :

  • chmod 777 file
  • mount -o remount,rw '/myfile/directory' : which returns no error
  • chown -R root:root /mydir
  • disabling fast boot on Windows (that breaks my OS, I don't know why)
  • I tried this

And none of them work. It looks like the product locks its own source files (that's my best guess).

So how can I solve this?

EDIT-1:

Here is some actual terminal output:

root@qwxp# chmod g+rw current

chmod: changing permissions of 'current': Read-only file system

root@qwxp# mount -o remount,rw /snap/pycharm-professional/current /`

The mount command has no output, only if I don't give it a mount point it will return:

mount: /snap/pycharm-professional/271: cannot remount /dev/loop6 read-write, is write-protected.

root@qwxp# chmod g+rw current

chmod: changing permissions of 'current': Read-only file system

root@qwxp# ls -al

total 8

drwxrwxrwx  3 root root 4096 Mar  5 05:46 .

drwxr-xr-x 13 root root 4096 Mar  5 06:24 ..

drwxr-xr-x 11 root root  239 Jan 27 18:52 271

lrwxrwxrwx  1 root root    3 Mar  5 05:11 **current -> 271**

-rw-r--r--  1 root root    0 Mar  5 05:46 hi.txt

3
  • can you add the actual output of the command mount? The line related to the filesystem you're having problems with. Before and after the remount. Ideally you should add that to the body of the question. Mar 5, 2022 at 4:17
  • Same issue, Did you solve it? Nov 4, 2022 at 11:23
  • 1
    @HosseinKurd install your app from a different source, anywhere but the damn snap. then you can modify it.thats the solution.
    – AliSalehi
    Nov 4, 2022 at 18:40

2 Answers 2

5

If you run df -hT /snap/pycharm-professional/current you will probably find that this is a filesystem of type squashfs.

Squashfs filesystems are read only by design and do not have a built in method to modify any part of the filesystem.

This appears to be a snap installed application. It is unclear from your question why you would want to modify part of an application. There is probably an easier way to do what you are attempting, but you haven't given enough details to determine that.

7
  • so there is no way to edit squashfs file?(i guess it possible if i change the file type?mybe?)
    – AliSalehi
    Mar 5, 2022 at 5:55
  • 3
    There is no direct way to edit a file in a squashfs, you can't change the file type. You are trying to solve the wrong problem. What exactly are you trying to accomplish?
    – user10489
    Mar 5, 2022 at 6:05
  • im trying to modify a product for my own purposes!now i understand it might be confusing but i dont have other options to do,but for now i`ll try to install the product from somewhere else so the issues with snap will be done
    – AliSalehi
    Mar 5, 2022 at 6:09
  • @GitLover you need to figure out how the squashfs you're mounting was created. Then you modify things before they get put into the squashfs, run the same process, get a different squashfs. As user10489 points out, you're doing something unlikely to be sensible. Instead of trying to modify a snap, you need to modify a non-snap version of the software. Mar 5, 2022 at 11:14
  • Or find a config option that does the same thing, or figure out how to get the snap to use an external library instead of its built in version.
    – user10489
    Mar 5, 2022 at 11:59
0

I don't know about the permission treatment of snap-installed applications, but I found a similar type of issue regarding my back-up USB drive which kept giving me an error 'read-only' status. I have been backing up this drive for the past 3 years without an issue before. And the permissions showed as including 'write' for my username on an ls -l, but made no difference whenever I tried to write to it. When I tried to change the drive's permissions it would not let me alter them either. I was going to clean the drive and start a full back-up from scratch, which would have meant copying over some 600GB of data.

Then, I had an idea about cleaning the partition first before resorting to that more extreme measure. I ran gparted from a Linux USB installer flash-drive, then selected the 'check' option from the partition tab. This seemed to proceed okay, and when I rebooted, with my back-up drive still connected, the problem eas sorted. I don't know how this issue arose in the first place, but I guess it's just one of the quirks of Linux.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .