1

I'm looking to delete a folder that is in /config/sdcardfs. My device is rooted and I'm trying as superuser. I still get the results operation not permitted.

What do I need to do to get the permission to do this.

I have tried to do sudo rm -rf name-of-folder with no success. I have also tried to do it after running tsu (Termux's version of su). No success.

P.S.
I haven't had any issues deleting in other places even in places I need root permission (for example in the /data folder.

2
  • 1
    configfs is kernel's virtual filesystem like sysfs. What's inside them aren't actual files but kernel intrrfaces to userspace, to provide some info or make configurations. You can't simply delete them. Instead build the kernel with the said filesystem disabled. // What are you trying to achieve by deleting sdcardfs? It's one of Android's core components. External storage (/sdcard as well as physically external SD cards, USB drives etc.) functionality entirely depends on it. And most probably device will bootloop when vold is unable to emulate filesystems. – Irfan Latif Nov 4 '20 at 7:06
  • I'm trying to delete a folder residing in the /config/sdcardfs folder. There seems to be a folder left there from an app that isn't installed on my device anymore that I want to get rid of. – Sruly Nov 4 '20 at 16:56
1

SHORT ANSWER

You don't need to delete anything in /config. What appear inside the directory aren't actual files. They are cleared and repopulated on device restart.

You can't delete /config/sdcardfs directory. SDCard FileSystem (sdcardfs) is a core OS component. Your device (or at least storage) won't be usable without sdcardfs properly configured.

DETAILS

Android is based on Linux kernel. Kernel is the backbone of OS which handles hardware components and many other core functionalities. The other part of OS: userspace talks to kernel space through different mechanisms like syscalls, sockets and virtual filesystems. procfs, sysfs and configfs are common virtual/pseudo filesystems i.e. they live in RAM. Kernel exports information about processes, hardware devices, and drivers etc. to user space through virtual files in these filesystems.

/proc and /sys are mostly read-only, except a few interfaces to which userspace can write some values in order to make configurations. configfs (which is mounted at /config on Android devices) is relatively a new addition to Linux kernel. It allows userspace to make relatively bigger kernel configurations by creating large number of virtual files in sub-directories under /config.

Android uses configfs at least for two purposes:

In order to make file sharing among apps possible, Android sets fixed permissions on files in external storage (be it physically internal or external). To achieve this, at start, Android used FUSE for filesystem emulation, then sdcardfs replaced it. For more details see my answer to What is /storage/emulated/0/? and Android's Storage Journey, in particular the concept of synthesized permissions.

So it's the Android OS which creates and deletes virtual files in /config/sdcardfs/ in order to let kernel know which permissions to enforce on which files/directories in external storage (/sdcard as well as physically external SD cards, USB drives etc).

Additionally Android uses sdcardfs to assign three GIDs: AID_MEDIA_AUDIO (1055), AID_MEDIA_VIDEO (1056) and AID_MEDIA_IMAGE (1057) to media files by providing their relevant list of file extensions in /config/sdcardfs/extensions/. It's to quickly categorize files without scanning all of them. See some details in this answer.

So deleting something in /config/sdcardfs (and in kernel's other virtual filesystems as well) doesn't make sense if you don't know what you are doing. That would do no good except breaking storage functionality on your device.

1
  • 1
    Thanks for the detailed answer, this helped me understand more of what is going on. – Sruly Nov 5 '20 at 19:36

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.