Android userspace filesystem driver on non-rooted device?
Asked Answered
M

3

14

Can I write a custom userspace file system that can be run on non-rooted factory devices through the standard available utilities?

I am aware of the existence of fuse-android, however as far as I have understood, it requires a rooted device. If that is not the case, please do correct me.

The goal I am trying to achieve is create a 'fake' FS that actually is mounted to a file.

Miceli answered 11/2, 2012 at 16:4 Comment(0)
K
15

I had the same need some time ago and came to the point where I had to admit that's not possible at all (mostly). It shouldn't be a problem to build libfuse for android, also the Java wrapper is no problem.

The real problem is that most of the systems I have seen aren't build with fuse support buildin nor do they provide modules which may be loaded (which would require root, but anyway).

You can easily find out if fuse is enabled by reading /proc/filesystems. It should list fuse, otherwise you will need root. But it's very likely that most android devices are build without fuse support.

My other ideas were to use another filesystem to "fake" something like fuse. This may be possible with nfs or some other network filesystem where you can implement the server by yourself. This whould enable you to write a fake fuse but I don't think it's worth it.

Edit: And even if many devices would have fuse support buildin chances are high they wouldn't let you mount it as a user, you would need root access as your app wouldn't have the privileges to mount fuse filesystems.

Kursh answered 15/2, 2012 at 11:59 Comment(5)
Thanks, that is exactly the answer I needed. Bounty well spent :)Miceli
i encounter the same problem.But anyway,i think i can make it if i overcome the following problems.1:make the android kernel capable of loading the kernel module(i've done it)2:cross-compile the fuse project(i've done it)3:modprobe the fuse.ko into the android kernel(because i have no idea where the ko switchs to in the fuse 2.9.0,i stop here).So,anyone can help me throgh?here is the detail of the problem:#10477809Haught
well check out apps like Web Drive or Wuala. They are able to mount on Android and iOS without root. Anyone has an idea on how they do this?Almsgiver
@Bryan Kim: are you sure they create a virtual file system ? they may well just use a regular folder and monitor it for changes...Buhl
@Buhl I actually realized that they don't actually mount. because they don't appear as extra "SD Cards", and I can't actually browse them using my file managers.Almsgiver
S
2

Luminger almost has the right idea. Here's what I found on my Galaxy S3 (on Verizon):

The appropriate fuse stuff does exist in /proc/filesystems. So something must be using it, quite possibly system. However, when I attempt to execute 'fusermount', I get "Cannot execute -- Permission denied."

So it looks like all the FUSE stuff is there, but I've got no idea whether I could actually use it directly (dropbox? sshfs?) without rooting the device.

Spokesman answered 29/8, 2012 at 5:29 Comment(1)
I also confirm the presence for the vendor’s version in Galaxy S tab.Jefe
I
1

It depends on your implementation. What it sounds like to me is you want to have a physical file(s) that represent a full user space file system. Perhaps similar to a mounted .iso. If this is the case, I cannot think of any reason for needing root: You simply create/install the file somewhere such as /sdcard/ and "mount" your file system on top of it.

That said, if you want said file system to be accessible from other applications that you do not control, you'll need root as your application will be running in a Android sandbox otherwise.

Incriminate answered 14/2, 2012 at 17:42 Comment(8)
Ok, so if I want to have other apps access it too and to have it shown in the general file system tree, there's no way, right?Miceli
No way that I know of without root, no.Incriminate
@Incriminate I need to have a file mounted as a filesystem just for my application, not for others. How is it possible? You seem to know something about this partial achievement that would be enough for me. Please, any suggestion or advice from you is highly appreciated. Thanks in advanceCockpit
@Cockpit Without knowing more details on your goals it's hard to say. Perhaps something like code.google.com/p/whefs/wiki/HomePage.Incriminate
@Incriminate Thank you. I think that library does not mount any filesystem. I need that a Zip file is seen as a mounted folder so that Java methods that want a path (file:////path/file.ext) can be feeded. For example if I have a Zip file containing an HTML file and its images folder I want that the WebView is able to load the HTML file and then the images in it (which have src='images/image.jpg' as attribute).Cockpit
@Cockpit The linked library allows you to interact with a virtual file system that are all stored in one physical file (or memory). If you're looking to use a persistent zip file with WebView I suggest you open a question for that specifically.Incriminate
@Cockpit were you able to figure out how to do this? I have a similar requirement, where I want to have WebView render html + resources inside .zip file.Gessner
@Innocent Bystander No problem achieving that by simply overriding some WebView or/and WebClient methods. It's all about loading HTML as data and then also intercepting resources loading. But you have to keep the zip file open in RAM because unzipping happens there I think with available Zip classes.Cockpit

© 2022 - 2024 — McMap. All rights reserved.