I am not able to delete some directories even with root privileges, error: read-only filesystem

I tried removing timeshift-btrfs directory in my home partition
(I have installed the snapper preview version of Garuda)
, /var/lib/snapd/snap/superproductivity/1415 this directory also gives error read-only filesystem.

This didn't happen to me before. I was able to remove almost everything with root privileges, I tried removing them from another Linux installation but gives same errors, read-only filesystem

Try with root user maybe (running su)

or try chattr -i <file_name> command which gives the perms afaik.

1 Like

try navigating into the folder and doing an mkdir test123 as root, sometimes it's kinda weird, using sudo grants root rights but does not execute them as root, rather it executes your command as your user but with elevated permissions, but the error "read-only filesystem" shouldn't be fixed with any kind of permissions, is it installed to a (virtual) disk that's read-only ?

can you check: btrfs prop get . ?
if it says something like ro: true , you can btrfs prop set . ro false ( or something, i haven't tested it here )

root@Austin-Inspiron-15-3567 /v/l/s/s/s/1415# pwd
/var/lib/snapd/snap/superproductivity/1415
root@Austin-Inspiron-15-3567 /v/l/s/s/s/1415# rm command.sh 
rm: cannot remove 'command.sh': Read-only file system
root@Austin-Inspiron-15-3567 /v/l/s/s/s/1415 [1]# sudo su
[root@Austin-Inspiron-15-3567 1415]# pwd
/var/lib/snapd/snap/superproductivity/1415
[root@Austin-Inspiron-15-3567 1415]# rm 
chrome_100_percent.pak     desktop-common.sh          icudtl.dat                 libGLESv2.so               meta/                      snapshot_blob.bin          v8_context_snapshot.bin
chrome_200_percent.pak     desktop-gnome-specific.sh  lib/                       libvk_swiftshader.so       resources/                 superproductivity          vk_swiftshader_icd.json
command.sh                 desktop-init.sh            libEGL.so                  libvulkan.so.1             resources.pak              swiftshader/               
data-dir/                  gnome-platform/            libffmpeg.so               locales/                   scripts/                   usr/                       
[root@Austin-Inspiron-15-3567 1415]# rm command.sh 
rm: cannot remove 'command.sh': Read-only file system
[root@Austin-Inspiron-15-3567 1415]# mkdir test123
mkdir: cannot create directory ‘test123’: Read-only file system
[root@Austin-Inspiron-15-3567 1415]#

&

[root@Austin-Inspiron-15-3567 2021-09-20_12-00-02]# ls
@home
[root@Austin-Inspiron-15-3567 2021-09-20_12-00-02]# pwd
/mnt/data/timeshift-btrfs/snapshots/2021-09-20_12-00-02
[root@Austin-Inspiron-15-3567 2021-09-20_12-00-02]# whoami
root
[root@Austin-Inspiron-15-3567 2021-09-20_12-00-02]# mkdir test
[root@Austin-Inspiron-15-3567 2021-09-20_12-00-02]# ls
@home  test
[root@Austin-Inspiron-15-3567 2021-09-20_12-00-02]# cd @home/
[root@Austin-Inspiron-15-3567 @home]# ls
austin
[root@Austin-Inspiron-15-3567 @home]# mkdir test
mkdir: cannot create directory ‘test’: Read-only file system
[root@Austin-Inspiron-15-3567 @home]#
  • @home in every snapshot was read-only (as we can see from my terminal outputs)
    so I tested btrfs prop get @home in every snapshot as suggested by @alexjp and I got ro: true so I ran btrfs prop set @home ro false in every snapshot and at the end I was able to do rm -rf timeshift-btrfs!

So I was able to successfully remove timeshift-btrfs directory from my home partition

  • As for /var/lib/snapd/snap/superproductivity/1415, it was bind mounted read-only, so I had to umount it first then I was able to remove it!

Could anyone help me remove /var/lib/snapd/snap/superproductivity/1415 directory?
1415 seems to be the read-only directory, and it is not a btrfs object.

sorry I can't help you more, my usage of snap is extremely limited, but:

is snapd running or superproductivity snap mounted and enabled?

( sidenote: do checkout joplin and qownnotes ... it was what replaced superproductivity for me )

1 Like

I don't use snap but don't those directories get bind mounted? Have you checked to ensure it isn't mounted?

1 Like

I think they are ... something like squashfs archive which then gets mounted RO into the file system

1 Like

Thanks a lot, @dalto and @alexjp, I didn't know it worked like that, as you said it was mounted and I had to umount it first then I was able to remove it!

2 Likes

As a side note, you should be able to remove snaps using snapd instead of forcibly deleting the files.

4 Likes

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.