[Q] Connecting to Network Shares - Nexus 10 Q&A, Help & Troubleshooting

I've been reading as much as I can if it is possible to mount a network share with your Nexus 10. I've downloaded both cifsmanager and mount manager, and can get neither to work.
I can connect to my network with mount manager and some other apps. But getting the Nexus 10 to see your shares as a local folder seems to be a big PIA.
Does anyone have it working, and can they document the steps?
I'm also using CM 10.1, but will flash to any kernel if it can be done.
Thanks
PT

ptmuldoon said:
I've been reading as much as I can if it is possible to mount a network share with your Nexus 10. I've downloaded both cifsmanager and mount manager, and can get neither to work.
I can connect to my network with mount manager and some other apps. But getting the Nexus 10 to see your shares as a local folder seems to be a big PIA.
Does anyone have it working, and can they document the steps?
I'm also using CM 10.1, but will flash to any kernel if it can be done.
Thanks
PT
Click to expand...
Click to collapse
Here is a link that discusses CIFS.
http://goo.gl/ot1mi
Also search for CIFS in the developer's forum that discusses your ROM. The issues with CIFS surround the addition of multi-user support in 4.2.2. That feature meant the mount command needed additional arguments plus you need to create RSA keys. The link above provides that information and other details.

I have it working. Requires a specific set of kernel modules, which means a specific ROM/kernel combination.
I use mrRobinsons AOKP PUB ROM with KTmanta kernel.
After that, I run a script as root to mount the CIFS share, in my case:
Username is the source PC windows username, and then password
The 192.168.1.101\files is the path to my share, extra \ needed for *nix escaping
The /data/media/0/TV-PC is the path on my tablet, empty directory where the mount will occur.
#!/system/bin/sh
#This will mount cifs shares if the network is available
insmod /system/lib/modules/md4.ko
insmod /system/lib/modules/cifs.ko
busybox mount -t cifs -o username=tv,password=<YOUR_PASSWORD>,rw,file_mode=0777,dir_mode=0777,uid=1000,gid=1000,unc=\\\\192.168.1.101\\files //192.168.1.101/files /data/media/0/TV-PC

sttovo said:
I have it working. Requires a specific set of kernel modules, which means a specific ROM/kernel combination.
I use mrRobinsons AOKP PUB ROM with KTmanta kernel.
After that, I run a script as root to mount the CIFS share, in my case:
Username is the source PC windows username, and then password
The 192.168.1.101\files is the path to my share, extra \ needed for *nix escaping
The /data/media/0/TV-PC is the path on my tablet, empty directory where the mount will occur.
#!/system/bin/sh
#This will mount cifs shares if the network is available
insmod /system/lib/modules/md4.ko
insmod /system/lib/modules/cifs.ko
busybox mount -t cifs -o username=tv,password=<YOUR_PASSWORD>,rw,file_mode=0777,dir_mode=0777,uid=1000,gid=1000,unc=\\\\192.168.1.101\\files //192.168.1.101/files /data/media/0/TV-PC
Click to expand...
Click to collapse
Thanks Stove. I'm changing to mrRobinsons AOKP PUB ROM with KTmanta kernel.
But when it comes to running the script, do you need to have the app open first before mounting the share? Or will the native apps find everything with not issues?

Just an update that I SSH'd into my Nexus 10 and ran the script in a terminal.
I now see the shares mounted in a terminal. But I do not see anything mounted when in either ES File Explorer any other app.

ptmuldoon said:
Just an update that I SSH'd into my Nexus 10 and ran the script in a terminal.
I now see the shares mounted in a terminal. But I do not see anything mounted when in either ES File Explorer any other app.
Click to expand...
Click to collapse
I think I had this problem too, but I regret I don't remember how i fixed it. I *think* it had something to do with permissions. Did you use the uid and gid arguments that I had in my script? Also, my CIFS mount point is under my data /sdcard (data) mount, if you're mounting under / then that might change things.
I run my script directly from my Nexus 10 in a terminal as root.
May want to look in the thread linked below, this is where I got what I needed for the script.
Edit - check post 62 in this link. Looks like it's related to setting the ownership bits… 0777
http://forum.xda-developers.com/showthread.php?t=2003836

I use esfileexplorer to access my samba shares. It's not a permanent mount in the root fs, but i can watch videos thid way.

nvertigo67 said:
I use esfileexplorer to access my samba shares. It's not a permanent mount in the root fs, but i can watch videos thid way.
Click to expand...
Click to collapse
Yes, but that's not the same as mounting a shared network folder. The idea is for all native apps to see your media as if it was locally on your device
sttovo said:
I think I had this problem too, but I regret I don't remember how i fixed it. I *think* it had something to do with permissions. Did you use the uid and gid arguments that I had in my script? Also, my CIFS mount point is under my data /sdcard (data) mount, if you're mounting under / then that might change things.
I run my script directly from my Nexus 10 in a terminal as root.
May want to look in the thread linked below, this is where I got what I needed for the script.
Edit - check post 62 in this link. Looks like it's related to setting the ownership bits… 0777
http://forum.xda-developers.com/showthread.php?t=2003836
Click to expand...
Click to collapse
Sttove.. You may be on to something. .. The script/mount command already is suing 0777, but I noticed i could not create a folder in terminal after mounting the share.
I hope to do some more testing and research when I get back home tonight.

ptmuldoon said:
Yes, but that's not the same as mounting a shared network folder. The idea is for all native apps to see your media as if it was locally on your device
Sttove.. You may be on to something. .. The script/mount command already is suing 0777, but I noticed i could not create a folder in terminal after mounting the share.
I hope to do some more testing and research when I get back home tonight.
Click to expand...
Click to collapse
One other thing I just thought of, how is your share setup on the server side? If you go into Advanced Sharing for the share, then Permissions, make sure you have Everyone set to read, write, etc… That leaves your share wide open, but at least something you can test.

sttovo said:
One other thing I just thought of, how is your share setup on the server side? If you go into Advanced Sharing for the share, then Permissions, make sure you have Everyone set to read, write, etc… That leaves your share wide open, but at least something you can test.
Click to expand...
Click to collapse
I can SSH into the Nexus10 via a terminal/putty from a PC. Create the mount point, and then see my share info. I am then also able to create a directory in terminal as well.
But when I than go to the Nexus and ESFile Explorer or any other app, the mapped share folder is blank.
I think I read something on blank mount/shares, but will have to keep looking into it.
Has anyone seen that happen before and know its cause?

Related

How can I mount a NFS share?

Hi,
Im using Cyanogenmod 5.0.8 on my htc Dream (G1).
I want to mount my NFS share with my music collection just as i do it with my pcs.
Code:
su
mount -t nfs 192.168.1.102:/media/media /sdcard/media
mount: mounting //192.168.1.102/media/media on /sdcard/media failed: No such device
Whats wrong?
Is there no NFS client support in the kernel?
Thanks,
Foyaxe
Unfortunately, this post probably comes way too late for the original poster, but it may be useful for anyone else, like me, who stumbles across this thread looking for a way to mount nfs on Android devices.
The answer is to use busybox.
There is support for nfs version 3 in the kernel, but the standard mount command seems to have been hobbled. The busybox mount command seems to work exactly the same as the standard linux mount command (except that it actually works on Android )
After downloading busybox from the Android Market, this is the command I use:
Code:
busybox mount -o nolock,ro,hard,intr,vers=3 -t nfs 192.xxx.xxx.x.x:/your/nfs/share /mnt/sdcard/YourLocalFolder
I'm not sure how important all the options are, but I suspect that vers=3 is important at least. nolock, hard and intr are also useful when having problems mounting according to the mount man page.
Thailandian said:
Unfortunately, this post probably comes way too late for the original poster, but it may be useful for anyone else, like me, who stumbles across this thread looking for a way to mount nfs on Android devices.
The answer is to use busybox.
There is support for nfs version 3 in the kernel, but the standard mount command seems to have been hobbled. The busybox mount command seems to work exactly the same as the standard linux mount command (except that it actually works on Android )
After downloading busybox from the Android Market, this is the command I use:
Code:
busybox mount -o nolock,ro,hard,intr,vers=3 -t nfs 192.xxx.xxx.x.x:/your/nfs/share /mnt/sdcard/YourLocalFolder
I'm not sure how important all the options are, but I suspect that vers=3 is important at least. nolock, hard and intr are also useful when having problems mounting according to the mount man page.
Click to expand...
Click to collapse
I am getting 'failed invalid argument' ;(
Trying since quite a while now but won't work. Any more hints?
cheers,
ArneAC said:
I am getting 'failed invalid argument' ;(
Click to expand...
Click to collapse
Well the good news is that 'failed invalid argument' probably means that it's just a typing mistake or something similar. This should be fairly easy to solve.
One idea to check first - you need to create the directory that you want to mount your NFS share onto before you can mount it. If I remember rightly, failing to do that will give you an 'invalid argument' error.
Also, you will need to give the command root privileges - but I think you must have already done that or you would be getting a 'permissions' error rather than 'invalid argument'.
Failing that, I suggest that you copy and paste the command you are using here - although you should replace your server's ip address with x's as I did for security.
Then I can have a look at it to see if there's anything obvious.
Cheers
You can also use AndSmb from Market to connect to Windows shares or Samba shares on Linux.
ArneAC said:
I am getting 'failed invalid argument' ;(
Trying since quite a while now but won't work. Any more hints?
cheers,
Click to expand...
Click to collapse
I'm getting the same invalid argument. It is not a typo, but I don't know what the cause of the problem is.
in busybox, my commands are:
Code:
su
mount -t nfs 192.168.1.1:/DataVolume/Public ~/Downloads/temp/
adding or removing the various options such as "-o nolock,ro,hard,intr,vers=3"
does not make a difference.
It is not a problem with the local mount point -- that error is "no such file or directory".
This error is "failed: invalid argument" -- even with no arguments other than "-t nfs".
lsmod shows the modules loaded:
nfs 104232 0 - Live 0xbf036000
lockd 42336 1 nfs, Live 0xbf028000
sunrpc 150792 3 nfs,lockd, Live 0xbf000000
Can anyone help? Thanks.
P.S. I'm testing with NFS v3, but my ultimate goal is to connect to an NFSv4 server. Does busybox support NFSv4 mounts?
EDIT: it looks like this error "invalid argument" may be due to a conflict between versions of busybox and linux.
Found this here
This is how I interpret it.
kernel is newer - recompile mount command (i.e. busybox etc)
Make sure that it uses the headers from the kernel it will run with.
Click to expand...
Click to collapse
My linux is 3.0.8-GLaDOS-V1-15
My busybox is 1.19.3-Stericson
Any idea how to proceed?
I ran into this same issue on my new Acer A200 (busybox 1.19.3-Stericson) and my host server is using NFS V3. I'm wondering if your 3.0 server might be using NFS V4 and support is not enabled? Here is an excerpt from my /proc/config.gz on the Acer. Ideally V3 and V4 would have been set.
CONFIG_LOCKD=y
CONFIG_SUNRPC=y
CONFIG_NFS_FS=y
# CONFIG_NFS_V3 is not set
# CONFIG_NFS_V4 is not set
CONFIG_ROOT_NFS=y
# CONFIG_NFSD is not set
CONFIG_NFS_COMMON=y
Now I suppose in my case that if I really want this to work that I'd have to learn how to create a build environment and compile a nfs.ko myself.
EDIT: I just seen that you specifically stated you are testing w/NFS v3
acertabuser said:
Now I suppose in my case that if I really want this to work that I'd have to learn how to create a build environment and compile a nfs.ko myself.
Click to expand...
Click to collapse
That's what I'm thinking too.
In the mean time the short term solutions I'm considering are either samba (CIFS) or SFTP (i.e., the SSH file system). I've been using SFTP in the other direction (PC to phone) and it works great. I haven't test using it on the phone to mount the share from the PC yet, but I hope to do that this weekend.
Tried to nfs mount from a CM9 running galaxy nexus, kernel self compiled and surely contains NFS (client and server).
Doesn't work, the same way already described here.
Looking at the source and build intermediates, it appears to me that
1) the CM9 compiled busybox does not contain NFS mounting code.
2) busybox does not support mounting NFS v4 at all
Trying to compile busybox with nfs support builtin, breaks because several header files related to
RPC and portmapper appear to be missing from the android sources. Which is probably the reason why
NFS in not in the standard busybox mount...
Oh, how I wish nfs mounting were handled by the kernel, instead of relying on magic code in the userlevel mount...
brian_o'fish said:
Tried to nfs mount from a CM9 running galaxy nexus, kernel self compiled and surely contains NFS (client and server).
Doesn't work, the same way already described here.
Looking at the source and build intermediates, it appears to me that
1) the CM9 compiled busybox does not contain NFS mounting code.
2) busybox does not support mounting NFS v4 at all
Trying to compile busybox with nfs support builtin, breaks because several header files related to
RPC and portmapper appear to be missing from the android sources. Which is probably the reason why
NFS in not in the standard busybox mount...
Oh, how I wish nfs mounting were handled by the kernel, instead of relying on magic code in the userlevel mount...
Click to expand...
Click to collapse
Thanks for sharing your findings. Very interesting. I guess the next option would be to compile the mount command and use that rather than using the BusyBox mount...
works for me
MountainX said:
I guess the next option would be to compile the mount command and use that rather than using the BusyBox mount...
Click to expand...
Click to collapse
Well, there already _is_ nfs mount code in busybox, but it was configured away, because it needs the SUN RPC library, which is missing from Android / Bionic. That issue would probably also exist for mount.nfs from other sources, which would most likely also need additional porting work.
Thus, I snatched the librpc code from uClibc today, and meddled with it until it compiled in my copy of the CM9 sources. Got it to work! I can now NFS mount on my GNex, and the freshly built and installed update.zip was copied onto the device via NFS
I sent the changes to the cyanogen review system. That was my first contribution ever - I have no idea whether they will like it or not.
If you would like to try it out - and have a KERNEL with NFS support compiled in - send me an E-Mail, and I'll send you a statically compiled busybox (approx. 800k) back that you can play with.
brian_o'fish said:
Well, there already _is_ nfs mount code in busybox, but it was configured away, because it needs the SUN RPC library, which is missing from Android / Bionic. That issue would probably also exist for mount.nfs from other sources, which would most likely also need additional porting work.
Thus, I snatched the librpc code from uClibc today, and meddled with it until it compiled in my copy of the CM9 sources. Got it to work! I can now NFS mount on my GNex, and the freshly built and installed update.zip was copied onto the device via NFS
I sent the changes to the cyanogen review system. That was my first contribution ever - I have no idea whether they will like it or not.
If you would like to try it out - and have a KERNEL with NFS support compiled in - send me an E-Mail, and I'll send you a statically compiled busybox (approx. 800k) back that you can play with.
Click to expand...
Click to collapse
Congratulations! That's very cool! I just sent you my email address. I'm looking forward to trying your busybox. Good job getting this to work!
brian_o'fish said:
If you would like to try it out - and have a KERNEL with NFS support compiled in - send me an E-Mail, and I'll send you a statically compiled busybox (approx. 800k) back that you can play with.
Click to expand...
Click to collapse
I got it. Thank you! How do I use it? Do I just replace /system/xbin/busybox with your (renamed) statically compiled file?
I'm running the GLaDOS kernel which claims to have NFS support, so we'll see what happens. Since you and I have the same phone (GSM GNex), if this doesn't work, my next step will be to do exactly what you did and compile my own CM9. I have never done that before, so I would appreciate anything you can share about the steps you did. Thanks again!
MountainX said:
I got it. Thank you! How do I use it? Do I just replace /system/xbin/busybox with your (renamed) statically compiled file?
I'm running the GLaDOS kernel which claims to have NFS support, so we'll see what happens.
Click to expand...
Click to collapse
There is also the question of where you would put the mountpoint.
To test it out, (as root) I made a directory /data/data/de.bof.mounts/, copied
the busybox file there and made it executable (chmod 700 file), made a
subdirectory mnt there, and then ran './busybox mount -o nolock -t nfs SER.VER.I.P:/export/path ./mnt'
You can use the normal 'umount' command to unmount later.
Since you and I have the same phone (GSM GNex), if this doesn't work, my next step will be to do exactly what you did and compile my own CM9. I have never done that before, so I would appreciate anything you can share about the steps you did. Thanks again!
Click to expand...
Click to collapse
If you want to go down that road, here's the feedback I got when I asked about that 10 days ago:
http://forum.xda-developers.com/showpost.php?p=22706426&postcount=352
In comment 360 there, I write a bit about the amount of source fetched from the net, and how much disk space you would need.
The most problematic part will be setting up your compile host with all the neccessary development packages, which is very dependant on what kind of host system / distribution you use. Google describes it here for an Ubuntu 10.04 install: http://s.android.com/source/initializing.html - which fortunately gave me enough hints to get my openSUSE 11.4 system into working order after half a day of builds aborting in mid-flight...
Your best bet is probably setting up a fresh Ubuntu 10.04 virtual server with approx. 64 GB hard disk and 8 GB RAM, as that is what google appears to use.
Thanks again. That's great info.
I'm testing the first option, which is using busybox the same way you used it.
For me, that involves two steps (loading modules and issuing the mount command).
Here's what I'm doing. I realize I probably don't need to load all these modules, but I'm doing it anyway.
My statically compiled busybox (which you supplied) is in /system/xbin/ and it is executable.
cd /system/xbin/
insmod /system/modules/sunrpc.ko
insmod /system/modules/lockd.ko
insmod /system/modules/nfs.ko
./busybox mount -t nfs 192.168.1.11:/Public /sdcard/nfs/Public
The error is:
mount: Mounting 192.168.1.11:/Public on yigit failed: Protocol not supported
My guess is that the kernel (GLaDOS) which claims to have NFS support may not actually have it (even though it does ship with both nfs.ko and nfsd.ko). Hopefully, I'm wrong on that point and there is a simple mistake I'm making.
For mount commands I have tried all these:
mount -o nolock -t nfs 192.168.1.11:/Public /sdcard/nfs/Public
mount -o vers=3 -t nfs 192.168.1.11:/Public /sdcard/nfs/Public
mount -o prot=17 -t nfs 192.168.1.11:/Public /sdcard/nfs/Public
mount -o prot=6 -t nfs 192.168.1.11:/Public /sdcard/nfs/Public
I had no success with any of them (although the errors were different with some of them). The last two simply report "failed" with no additional detail.
MountainX said:
Here's what I'm doing. I realize I probably don't need to load all these modules, but I'm doing it anyway.
Click to expand...
Click to collapse
Well, I built my kernel nonmodular / have NFS compiled in, as CM9 does not
even have a modules directory + I don't want to hassle with loading modules
before use.
Anyway - to check that after loading the modules, the kernel thinks it has
an nfs client filesystem type, have a look at /proc/filesystems. For NFS v3,
you need an entry reading nodev nfs there.
./busybox mount -t nfs 192.168.1.11:/Public /sdcard/nfs/Public
The error is:
mount: Mounting 192.168.1.11:/Public on yigit failed: Protocol not supported
Click to expand...
Click to collapse
Hmm. Did you check that the NFS server supports the NFS v3 protocol?
Try mounting it using mount -t nfs -o vers=3 ... from your desktop box.
If that does not help - do you have an "strace" program? Then you might try
to run (on device) something like
strace -o /sdcard/mount.nfs.trc /system/xbin/busybox.static mount -t nfs -o vers=3,nolock ...
Click to expand...
Click to collapse
and then e-mail me the /sdcard/mount.nfs.trc file? That will give a hint about
which step in the mounting receives the error.
Would you mind sharing your busybox binary? I got my modules compiled for the kernel and they are loading just fine but the busybox binary I have is missing the nfs functionality as previously mentioned in this thread. And I currently don't have the ressources to build half the android framework.
cyanogenmod NFS mount testing
xywin said:
Would you mind sharing your busybox binary? I got my modules compiled for the kernel and they are loading just fine but the busybox binary I have is missing the nfs functionality as previously mentioned in this thread. And I currently don't have the ressources to build half the android framework.
Click to expand...
Click to collapse
There are now available for testing, several cyanogenmod static busybox
binaries, as well as a CM9 kernel with NFS support.
Visit http://bei.bof.de/droid/mykernel/ for directions and download links.
brian_o'fish said:
There are now available for testing, several cyanogenmod static busybox
binaries, as well as a CM9 kernel with NFS support.
Visit http://bei.bof.de/droid/mykernel/ for directions and download links.
Click to expand...
Click to collapse
Okay I tried your busybox version and it works pretty good. After I realized I forgot to add nfs v3 and v4 support in the module >.>. But yeah it works. The nolock switch is of course mandatory for the mount. Unless you intend to start a portmap daemon.
MountainX said:
Thanks again. That's great info.
I'm testing the first option, which is using busybox the same way you used it.
For me, that involves two steps (loading modules and issuing the mount command).
Here's what I'm doing. I realize I probably don't need to load all these modules, but I'm doing it anyway.
My statically compiled busybox (which you supplied) is in /system/xbin/ and it is executable.
The error is:
mount: Mounting 192.168.1.11:/Public on yigit failed: Protocol not supported
My guess is that the kernel (GLaDOS) which claims to have NFS support may not actually have it (even though it does ship with both nfs.ko and nfsd.ko). Hopefully, I'm wrong on that point and there is a simple mistake I'm making.
Click to expand...
Click to collapse
I got that error in the beginning. As mentioned I forgot to tick the boxes for v3 and v4 support in the nfs module. If you have the kernelconfig you can just add the the functionality and push the kernel modules. No need to flash a new kernel. For NFSv4 support you also need to add auth_rpcgss.ko and rpcsec_gss_krb5.ko in that order before loading nfs.ko
A little speed test:
Procedure: Copying a 1GB file via WLAN (n-Wlan) over both the CIFS and NFS mount. Timed with `time` and using a simple `cp`
Result: CIFS comes in at 1.654MB/s and NFSv3 at 3.219MB/s. So with NFS it's actually possible to watch HD-movies over the network. Finally
CIFSManager:
If you want to use CIFSManager you have to do the following (as root):
Code:
rm /system/bin/mount
ln -sf /system/bin/busybox.static /system/bin/mount
To autoload the modules with CIFSManager open the options and tick every box and change the value of the "Path to cifs.ko" to the following value:
Code:
/system/lib/modules/sunrpc.ko:/system/lib/modules/auth_rpcgss.ko:/system/lib/modules/rpcseg_gss_krb5.ko:/system/lib/modules/lockd.ko:/system/lib/modules/nfs.ko:/system/lib/modules/cifs.ko
Now you can add NFS mounts using the following syntax when creating a new share:
Code:
XXX.XXX.XXX.XXX:/path/to/your/export
Don't forget the colon. In the option parameter for the new mount add "nolock" without the " of course.
Thanks xywin for testing and reporting!
One question though: you talk about NFSv4. I had the impression that my static busybox contains no code at all to do v4 mounting. It tells me "NFSv4 not supported" when trying to force v4 mounts.
Are you sure you have it work with v4?

Tested cifs.ko and nls_utf8.ko (from factory kernel)

Just for interested people, I have compiled cifs.ko and nls_utf8.ko from US version SGHI897 kernel (from samsung opensource website). This package has been tested under JF6, (out-of-box settings, but rooted). Key notes:
0. mount with -o iocharset=utf8, -t cifs
1. use "busybox" to do "mv or cp or mount or umount"
2. use direct "#" prompt to do "insmod"
3. better use GScript after you have tested these ko's
hiway123 said:
Just for interested people, I have compiled cifs.ko and nls_utf8.ko from US version SGHI897 kernel (from samsung opensource website). This package has been tested under JF6, (out-of-box settings, but rooted). Key notes:
0. mount with -o iocharset=utf8, -t cifs
1. use "busybox" to do "mv or cp or mount or umount"
2. use direct "#" prompt to do "insmod"
3. better use GScript after you have tested these ko's
Click to expand...
Click to collapse
I have absolutely no idea what you are talking about, other than it means someone's gonna come up with SOMETHING new to play with here....... =)
techmik67 said:
I have absolutely no idea what you are talking about, other than it means someone's gonna come up with SOMETHING new to play with here....... =)
Click to expand...
Click to collapse
coz, from searching the forum, there is no cifs and utf8 support for captivate. The first is used when using captivate to mount remote windows share folders. In other words, you can use rockplayer on captivate to browser media files on windows desktop. For some reasons, there could be encoding problem to view these media files' names, such as asian characters. Then the second one is needed.
hiway123 said:
coz, from searching the forum, there is no cifs and utf8 support for captivate. The first is used when using captivate to mount remote windows share folders. In other words, you can use rockplayer on captivate to browser media files on windows desktop. For some reasons, there could be encoding problem to view these media files, such as asian characters. Then the second one is needed.
Click to expand...
Click to collapse
I can definitely see why UTF8 is important, though I have no idea what to do with these files to be honest. also, linux-based system that doesn't support UTF8, really?
Kaik541 said:
I can definitely see why UTF8 is important, though I have no idea what to do with these files to be honest. also, linux-based system that doesn't support UTF8, really?
Click to expand...
Click to collapse
Don't quite understand your meaning, sorry. But anyway, just for interested people...
the module works great thanks for your effort.
network pimp... android novice.
hiway123, i pulled down your make of cifs.ko; loaded it in a network folder on my ext sdcard, but am not sure what to do now. (insmod, etc)
I attempted a few mount commands, and a few other linux norm paths, but I think I am lost here. Can you give a 1, 2, step of how to run the mount command? your post was rather cryptic. (i know i know, for the interested only! well definitely interested...)
*Note* I downloaded this nifty app: CIFSmanager app from the market, and it is open enough that it allows for the user to direct path for the cifs module (insmod path) to the file you compiled (again which is now on my sdcard) it seemed to be happy with it, but gave me some other error I believe had something to do with it not being root. (phone is rooted, have several apps with root level access... however haven't yet figured out how to run certain individual apps as root, that don't automatically try to obtain root access. blah blah blah, another project.)
anyhoot - i would love to be able to mount a vfs on this bird! had the captivate for about a month and love'n it! I got tons of media I'd like to stream over the network and found a few nice apps (ARCmedia / rocket, etc.) that i tested (direct copy to sd) and played my .flv files just fine! :-D
now all i need to do it trick the system into thinking my network paths are mounted resources. (Everything else works well, I can access network shares, view pictures, docs, standard video that the default video player can play fine.) So next step is to learn what YOU know.
sorry for the long post! - th x
tucxforever said:
hiway123, i pulled down your make of cifs.ko; loaded it in a network folder on my ext sdcard, but am not sure what to do now. (insmod, etc)
I attempted a few mount commands, and a few other linux norm paths, but I think I am lost here. Can you give a 1, 2, step of how to run the mount command? your post was rather cryptic. (i know i know, for the interested only! well definitely interested...)
*Note* I downloaded this nifty app: CIFSmanager app from the market, and it is open enough that it allows for the user to direct path for the cifs module (insmod path) to the file you compiled (again which is now on my sdcard) it seemed to be happy with it, but gave me some other error I believe had something to do with it not being root. (phone is rooted, have several apps with root level access... however haven't yet figured out how to run certain individual apps as root, that don't automatically try to obtain root access. blah blah blah, another project.)
anyhoot - i would love to be able to mount a vfs on this bird! had the captivate for about a month and love'n it! I got tons of media I'd like to stream over the network and found a few nice apps (ARCmedia / rocket, etc.) that i tested (direct copy to sd) and played my .flv files just fine! :-D
now all i need to do it trick the system into thinking my network paths are mounted resources. (Everything else works well, I can access network shares, view pictures, docs, standard video that the default video player can play fine.) So next step is to learn what YOU know.
sorry for the long post! - th x
Click to expand...
Click to collapse
I have a samba server in LAN, say at 192.168.1.1. So, I do these steps:
1. unzip my package to your computer, there are two ko files. Then use USB cable to transfer these two files to your phone in /sdcard folder.
2. on the phone, I used "terminal emulator", run "su" into root mode, make new folders like "busybox mkdir /system/lib/modules", you may try other directory name, I don't think that does a matter. Move the two ko files from /sdcard to this newly created folder, remember to use "busybox mv" command.
3. create a mount point on your phone, "mkdir /sdcard/smb" for example. or "busybox mkdir" I cannot remember.
4. insert modules, using "insmod /system/lib/modules/cifs.ko" and "insmod /system/lib/modules/nls_utf8.ko", remember these commands must be run everytime after you reboot your phone, so I use Gscript to create a shortcut, it's very convenient.
5. mount server's samba share folder in the phone, using "busybox mount -t cifs //192.168.1.1/your_share_folder /sdcard/smb -v -o user=yourusername,pass=yourpasswd,iocharset=utf8".
6. now, you can use rockplayer to browse into /sdcard/smb on your phone to view what is shared.
7. It is better to umount your folder once you finish transferring files. Then simply do "busybox umount /sdcard/smb".
Actually, only commands 5-7 are needed after your first attempt. Of course, if you have not done step 4 after a reboot, you need to do that step as well. I use Gscript in market to create shortcuts to these 4-7 commands. That's more convenient instead of typing on such small screen.
Have you tried this with any of the Custom ROMs in this section? If so, which ones work? Can you tell me how to compile a CIFS.KO?
Can it be compiled against the ROMs supplied here?
Thanks in advance,
Freaking brilliant, was exactly what I was looking for...thanks OP!
*edit*
Should mention, I used the posted .KO with stock rogers rom (i896) and it seems to be working flawlessly from my testing so far. I've even been able to stream some lower bitrate HD video and have it run smoothly and consistantly
insmod: init_module '/system/lib/modules/cifs.ko' failed (Exec format error)
something wrong?
i use SetiroN's kernel... and I9000 Froyo - maybe that is the reason?
Id assume that the kernel you are using isn't compatible and the module will have to be compiled for it.
Sent from my SAMSUNG-SGH-I896
love the rom just wish had few diff tweaks

[Q] Error mounting CIFS shares on N4 CM10.1

Hi folks
My issue that I cannot seem to resolve is one of CIFS share mounting. I have trawled the XDA forums, google, and many many other android sites with no luck.
Current state
Nexus 4
CyanogenMod 10.1 RC4 (but have been running nightlies and RCs almost since release)
Latest version of CifsManager
Folders created:
/mnt/cifs/*
Where * is various folder names matched to my CIFS shares being served from an OpenMediaVault storage PC.
My understanding is that CM10.1 has CIFS support built into the kernel, as there are no cifs modules in the usual places one would expect to find them.
No matter what I try in CifsManager, the mount fails with:
Code:
Mounting the share has failed with an error. mount: Invalid argument
I thought this may be an issue with CifsManager, so I hopped into the shell to see what I could find. I am no *nix guru, but am comfortable (mostly) in the commandline.
I fired up ADB, connected the device and entered an ADB shell with root access via su.
I issued a BUNCH of different mount commands, with no luck, some of which were:
Code:
mount -t cifs //192.168.1.3/share1 /mnt/cifs/share1
mount -o username=<username> -t cifs //192.168.1.3/share1 /mnt/cifs/share1
mount -o username=<username>,password=<password> -t cifs //192.168.1.3/share1 /mnt/cifs/share1
I tried variations of these with the options after the type and vice versa, and with one/both of those after the device/mount point pieces.
All consistently gave the same error as CifsManager:
Code:
mount: Invalid argument
I even tried using
Code:
-t smbfs
and get the following error:
Code:
mount: No such device
The only additional note I could find that I thought worth mentioning is this entry in dmesg:
Code:
<3>[14314.292444] CIFS VFS: Connecting to DFS root not implemented yet
At this point I am officially out of ideas and operating beyond my capabilities so if you have any suggestions or advice, please let me know what additional information I can provide here.
I should note that I have two Xoom's and an SGS2 all of which mount these shares fine. The Xooms are running EOS4 and the SGS2 was also running CM10.x - interestingly both of these ROMS had cifs modules rather than having them built into the kernel.
Thanks in advance.
/system/xbin/mount (soft-linked to busybox) rather than /system/bin/mount (linked to toolbox) works for me. I'm not sure that it's entirely safe to point the link in "bin" to busybox (which is necessary if you're using CifsManager as it has no option to set a path to "mount"), but everything seems to be alright, except that the busybox'es "mount" refuses to remount root read-write sometimes, and you need to specify a different dir for CifsManager (e.g. /data/cifs instead of /mnt/cifs).
[SOLVED]
OK,
so with a bit of luck, I seem to have got to the bottom of this.
Within CifsManager, the following configuration for a share works:
Share Path
<IP address>/<share>
Mount Point
/mnt/cifs/<share>
Username
<username>
Password
Leave blank - if this is populated, it causes the "Invalid argument" error when mounting the CIFS share.
Options
Code:
unc=\\\\<IP address>\\<share>,pass=<password>
Now that I have it working, I remember reading on a post long time ago, that if the CIFS module is built into the kernel it required the unc= option to work.
Would it be worth getting in touch with the CifsManager devs and logging this as a bug do you think?
[keywords]
How to mount a cifs share on Google Nexus 4 with CifsManager and CyanogenMod 10
Does it still works? I am using CM 10.1 nightly based on Android 4.2.2 and I am unable to make it work.
Do you use a kernel other than CM default?
Why do i want to mount cifs? Any specific reason?
Sent from my Nexus 4
kewlfais said:
Why do i want to mount cifs? Any specific reason?
Sent from my Nexus 4
Click to expand...
Click to collapse
I want to conect to my samba share over wifi. I'd prefer to mount them because, If I can mount them, I am free to use all programs/file explorers etc. to browse files/watch movies etc.
Well basically nexus talks only on mtp protocol.
U have options of connecting ur device via ssh by installing ssh server on phone but for me it wss slow so i dropped that.
Even there is a app name software data cable which connects via ftp.
Sent from my Nexus 4
---------- Post added at 02:08 AM ---------- Previous post was at 02:07 AM ----------
Or use airdroid that is also good app
Sent from my Nexus 4
gergefil said:
Does it still works? I am using CM 10.1 nightly based on Android 4.2.2 and I am unable to make it work.
Do you use a kernel other than CM default?
Click to expand...
Click to collapse
Hi
yes this still works. Please note my original post got screwed up by the forums - it removed some of the \'s. I have fixed this now in the original post, but by explanation there should be double the number of normal \'s in the UNC path (as escape characters I guess) so \ \ \ \ unc \ \ path
I do not use any custom kernel, just what is in the standard nightly CM builds (I also update to most nightlies..)
I hope this is clear
Swaziboy said:
Hi
yes this still works. Please note my original post got screwed up by the forums - it removed some of the \'s. I have fixed this now in the original post, but by explanation there should be double the number of normal \'s in the UNC path (as escape characters I guess) so \ \ \ \ unc \ \ path
I do not use any custom kernel, just what is in the standard nightly CM builds (I also update to most nightlies..)
I hope this is clear
Click to expand...
Click to collapse
I am now able to make it work. Thanks.
Hey Swaziboy,
I have one more question:
Did you try to mount cifs share anywhere other than /mnt/cifs/SHARE
I want all applications to see my share, so I try to mount them into /mnt/sdcard/SHARE When I mount it to /mnt/cifs/ everything is perfect. However when I try to mount it into /mnt/sdcard/SHARE, cifs manager says it is mounted, however I can't see it on mount list and, it is not mounted at all.
Do you have any idea/suggestions?

[Q] cifs mounting problem with android 4.3

Hi guys,
Do any of you have successful solution to mount cifs shares with ANY kernel available? I've tried to do it with Project Flaming Monkey kernel, but had no luck. Most of the time I got "device not authorized" error when tried to mount via adb shell. But even if I could overcome this error (didn't figure out exact sequence of steps) it always says that mounting failed or even gets segfault.
With KTmanta kernel device is always authorized, I get root credentials immediately, but mounting also fails. Later I discovered that mounting actually happens and I can see it via adb shell, but it's invisible for all other users including root. Does it mean that 'mount using adb shell' trick doesn't work anymore?
Anyway I'll be very grateful for any kind of working solution or direction where to get it. Thanks in advance.
P.S. interesting but StickMount just works even on stock kernel that is said to have module loading disabled.
Sent from my Nexus 10 using xda app-developers app
uentity said:
Hi guys,
Do any of you have successful solution to mount cifs shares with ANY kernel available? I've tried to do it with Project Flaming Monkey kernel, but had no luck. Most of the time I got "device not authorized" error when tried to mount via adb shell. But even if I could overcome this error (didn't figure out exact sequence of steps) it always says that mounting failed or even gets segfault.
With KTmanta kernel device is always authorized, I get root credentials immediately, but mounting also fails. Later I discovered that mounting actually happens and I can see it via adb shell, but it's invisible for all other users including root. Does it mean that 'mount using adb shell' trick doesn't work anymore?
Anyway I'll be very grateful for any kind of working solution or direction where to get it. Thanks in advance.
P.S. interesting but StickMount just works even on stock kernel that is said to have module loading disabled.
Sent from my Nexus 10 using xda app-developers app
Click to expand...
Click to collapse
CM 10.2 plus Trinity Kernel plus Mount Manager works
I didn't yet tried trinity kernel
Thanks for the reply!
I think that kernel actually affects mounting process and not the ROM. Didn't tried trinity kernel yet, because author said that it's not feature complete for 4.3.
Do you have any issues with it? Everything works fine?
Sent from my Nexus 10 using xda app-developers app
uentity said:
I didn't yet tried trinity kernel
Thanks for the reply!
I think that kernel actually affects mounting process and not the ROM. Didn't tried trinity kernel yet, because author said that it's not feature complete for 4.3.
Do you have any issues with it? Everything works fine?
Sent from my Nexus 10 using xda app-developers app
Click to expand...
Click to collapse
Running the kernel version TX10, I have had some rare forced close issues, but i have no idea if it is kernel- or rom-related, propably the latter. Other than that it works just as well as any 4.2 combo I had before. Some kinks here and there, but perfectly usable.
I use Trinity with any 4.3 ROM and a script to mount my home file share. Works great.
I'm running 4.3 and Trinity kernel (tx17), I'm able to mount the cifs share from adb shell, I see the data there, but it's not available for the apps on the tablet. I also tried mounting the share using mount manager but it didn't help. I see it as a mounted, but no apps can see the data.
Where (mountpoint) and how should you mount the cifs share so it's visible for the rest of apps as well? Thx.
slano said:
I'm running 4.3 and Trinity kernel (tx17), I'm able to mount the cifs share from adb shell, I see the data there, but it's not available for the apps on the tablet. I also tried mounting the share using mount manager but it didn't help. I see it as a mounted, but no apps can see the data.
Where (mountpoint) and how should you mount the cifs share so it's visible for the rest of apps as well? Thx.
Click to expand...
Click to collapse
I remember having this problem, but I don't remember how I fixed it. Here's my script, compare it to yours to see if there's any difference. The below is all one line;
busybox mount -t cifs -o username=tv,password=<your_password>,rw,file_mode=0777,dir_mode=0777,uid=1000,gid=1000,unc=\\\\192.168.1.101\\files //192.168.1.101/files /data/media/0/TV-PC
I seem to remember it having something to do with mounting to /data/media/(whatever) or the uid/gid.
sttovo said:
I remember having this problem, but I don't remember how I fixed it. Here's my script, compare it to yours to see if there's any difference. The below is all one line;
busybox mount -t cifs -o username=tv,password=<your_password>,rw,file_mode=0777,dir_mode=0777,uid=1000,gid=1000,unc=\\\\192.168.1.101\\files //192.168.1.101/files /data/media/0/TV-PC
I seem to remember it having something to do with mounting to /data/media/(whatever) or the uid/gid.
Click to expand...
Click to collapse
Did try all possible combinations but still no luck. I've changed rom to Flaming Monkey and everything works like a charm there, so I'll probably stick with it for a while.
slano said:
Did try all possible combinations but still no luck. I've changed rom to Flaming Monkey and everything works like a charm there, so I'll probably stick with it for a while.
Click to expand...
Click to collapse
So to confirm, you did get cifs working with project flaming monkey rom or that's just the Rom you settled with since cifs never worked anyway? Did you use trinity kernel tx17? That's currently the combo I have and for the life of me cannot get it to work..... I am just learning about this so I'm sure it's me but if I know I have the same combo as someone who got it working, I will keep trying.
c683 said:
So to confirm, you did get cifs working with project flaming monkey rom or that's just the Rom you settled with since cifs never worked anyway? Did you use trinity kernel tx17? That's currently the combo I have and for the life of me cannot get it to work..... I am just learning about this so I'm sure it's me but if I know I have the same combo as someone who got it working, I will keep trying.
Click to expand...
Click to collapse
I've tried stock ROM with the Trinity kernel but no luck. I was able to mount the cifs filesystem, but it was not accessible for other apps. I've switched to Flaming monkey and everything mounted and was available just fine.
What is your problem with the current set-up? Will the share mount ok but it's not accessible from other apps or are you not able to perform the mount at all?
slano said:
I've tried stock ROM with the Trinity kernel but no luck. I was able to mount the cifs filesystem, but it was not accessible for other apps. I've switched to Flaming monkey and everything mounted and was available just fine.
What is your problem with the current set-up? Will the share mount ok but it's not accessible from other apps or are you not able to perform the mount at all?
Click to expand...
Click to collapse
Thanks for the reply. I have tried to use 3 different ways, below is a brief summary:
- CIFS Manager - No matter what I do, I get an "Invalid Argument" or "directory cant be found" error. Read and tried what is listed in CIFS FAQ to no avail.
- Mount Manger - Shows as connected, but there are no files; not in any apps or in the directory when using a file browser (root explorer or ES)
- Script - Yeah, just copied the script a few posts back and modified based on what I thought I needed to and used terminal emulator, gave it a go but nothing happens. Really don't know what I am doing with regard to script, over my head...
I also read that modules are needed but I thought the the trinity kernel already had them...
I am running the latest flaming monkey rom and trinity kernel on my nexus 10. So in short I really don't know exactly what I am doing but I will keep trying since I know you got it working with the same ROM and kernel setup. I can also access the files on my shared files through ES file explorer when I use the LAN or server feature so I know the PC is at least setup correctly, I think...
I haven't tried it on 4.3 yet. But the "Invalid argument" error is a problem in Linux kernels 3.4 in general. Take a look here:
How to Troubleshoot CIFS Problems on Android and Linux in General
I encountered that problem ever since JB. The problem is that mount is usually used in this way:
Code:
mount -o username=youruser,password=yourpasswd -t cifs //ipofpc/shareonpc dironphone
But that does not work in kernel 3.4. The share-directory as a device name is ignored. It has to be specified with argument unc. Like this:
Code:
mount -o unc=\\\\ipofpc\\shareonpc,username=youruser,password=yourpasswd -t cifs none dironphone
Note: since backslash is an escape character the double \\ is needed instead of \. It's also a good idea to specify noperm if you want the mounted directory to be accessible by all apps. Otherwise the mounted directory might only be accessible by root on the phone.
So a working example looks like this:
Code:
mount -o noperm,unc=\\\\10.0.0.200\\Public,username=guest,password=secret -t cifs none /sdcard/shares/nas
You have to work around that problem in CifsManager. Enter it like this:
Share Path: Enter anything. It will be ignored.
Mount Point: directory on phone: e.g. /sdcard/shares/nas
Username: enter user name
Password: leave empty
Options: e.g. noperm,unc=\\\\10.0.0.200\\Public,password=secret
{
"lightbox_close": "Close",
"lightbox_next": "Next",
"lightbox_previous": "Previous",
"lightbox_error": "The requested content cannot be loaded. Please try again later.",
"lightbox_start_slideshow": "Start slideshow",
"lightbox_stop_slideshow": "Stop slideshow",
"lightbox_full_screen": "Full screen",
"lightbox_thumbnails": "Thumbnails",
"lightbox_download": "Download",
"lightbox_share": "Share",
"lightbox_zoom": "Zoom",
"lightbox_new_window": "New window",
"lightbox_toggle_sidebar": "Toggle sidebar"
}
gwodus said:
I haven't tried it on 4.3 yet. But the "Invalid argument" error is a problem in Linux kernels 3.4 in general. Take a look here:
How to Troubleshoot CIFS Problems on Android and Linux in General
I encountered that problem ever since JB. The problem is that mount is usually used in this way:
Code:
mount -o username=youruser,password=yourpasswd -t cifs //ipofpc/shareonpc dironphone
But that does not work in kernel 3.4. The share-directory as a device name is ignored. It has to be specified with argument unc. Like this:
Code:
mount -o unc=\\\\ipofpc\\shareonpc,username=youruser,password=yourpasswd -t cifs none dironphone
Note: since backslash is an escape character the double \\ is needed instead of \. It's also a good idea to specify noperm if you want the mounted directory to be accessible by all apps. Otherwise the mounted directory might only be accessible by root on the phone.
So a working example looks like this:
Code:
mount -o noperm,unc=\\\\10.0.0.200\\Public,username=guest,password=secret -t cifs none /sdcard/shares/nas
You have to work around that problem in CifsManager. Enter it like this:
Share Path: Enter anything. It will be ignored.
Mount Point: directory on phone: e.g. /sdcard/shares/nas
Username: enter user name
Password: leave empty
Options: e.g. noperm,unc=\\\\10.0.0.200\\Public,password=secret
Click to expand...
Click to collapse
Thank you for the detailed response, I will give that a try.
Sent from my Nexus 10 using xda app-developers app
c683 said:
Thank you for the detailed response, I will give that a try.
Sent from my Nexus 10 using xda app-developers app
Click to expand...
Click to collapse
BTW. I forgot. Before you try anything. Check if the directory /proc/fs/cifs exists. If it doesn't, then you are missing the required cifs kernel module. But more often then not, the kernel module is there and the problem is elsewhere.
gwodus said:
BTW. I forgot. Before you try anything. Check if the directory /proc/fs/cifs exists. If it doesn't, then you are missing the required cifs kernel module. But more often then not, the kernel module is there and the problem is elsewhere.
Click to expand...
Click to collapse
Thank you for your help. I thought for sure I tried what you said in your last post before as I read something similar. However, the info was wrong or I screwed up because when I followed your detailed description, it worked! The weird thing is some files open and others I'll get "the file doesn't exist error" but I am not concerned with it since I can get what I need. Thanks again.
c683 said:
Thank you for your help. I thought for sure I tried what you said in your last post before as I read something similar. However, the info was wrong or I screwed up because when I followed your detailed description, it worked! The weird thing is some files open and others I'll get "the file doesn't exist error" but I am not concerned with it since I can get what I need. Thanks again.
Click to expand...
Click to collapse
Awesome. You got it working!
I never ran across the "file doesn't exist" error. But I read around here that other people have such troubles too. It's probably a permission problem. Maybe try to play around with options like gid, forceuid, file_mode and dir_mode. A complete list of options is here: mount.cifs man page
gwodus said:
I haven't tried it on 4.3 yet. But the "Invalid argument" error is a problem in Linux kernels 3.4 in general. Take a look here:
How to Troubleshoot CIFS Problems on Android and Linux in General
I encountered that problem ever since JB. The problem is that mount is usually used in this way:
Code:
mount -o username=youruser,password=yourpasswd -t cifs //ipofpc/shareonpc dironphone
But that does not work in kernel 3.4. The share-directory as a device name is ignored. It has to be specified with argument unc. Like this:
Code:
mount -o unc=\\\\ipofpc\\shareonpc,username=youruser,password=yourpasswd -t cifs none dironphone
Note: since backslash is an escape character the double \\ is needed instead of \. It's also a good idea to specify noperm if you want the mounted directory to be accessible by all apps. Otherwise the mounted directory might only be accessible by root on the phone.
So a working example looks like this:
Code:
mount -o noperm,unc=\\\\10.0.0.200\\Public,username=guest,password=secret -t cifs none /sdcard/shares/nas
You have to work around that problem in CifsManager. Enter it like this:
Share Path: Enter anything. It will be ignored.
Mount Point: directory on phone: e.g. /sdcard/shares/nas
Username: enter user name
Password: leave empty
Options: e.g. noperm,unc=\\\\10.0.0.200\\Public,password=secret
Click to expand...
Click to collapse
I tried your solution (4.4, Nexus 5) and it actually mounts the volume correctly. The only problem is that mounted content is visibile only if you're root: i can't see the folders mounted from the applications even if the cifsmanager say it has been mounted.
I verified by mounting the volume via ADB and navigated to the mounted folder -> root can see the folder and normal user can't.
I also tried adding the parameters "rw,file_mode=0777,dir_mode=0777,nounix,iocharset=utf8", nothing.
Do you know something about this?
Same problem here on 4.4 N4
Sent from my Nexus 4 using Tapatalk 2
root only problem
ludalex07 said:
I tried your solution (4.4, Nexus 5) and it actually mounts the volume correctly. The only problem is that mounted content is visibile only if you're root: i can't see the folders mounted from the applications even if the cifsmanager say it has been mounted.
Click to expand...
Click to collapse
i've got the same issue on nexus 7 (new) running 4.3
here is my mount command:
mount -o noperm,unc=\\\\192.168.2.16\\Volume_2,username=guest,password=guest -t cifs musiq /sdcard/NAS
root only can see it.
from google groups, someone seems to have a workaraound, but i can not firgure out excactly what he means:
"when I mount using a shell-script (masked as a system-service like /system/bin/debuggerd) with "/system/bin/start" the mount is visible systemwide"
i tried replacing debuggerd with a script, but it is not part of the start-up services, so i am guessing /system/bin/start has to be invoked somehow?
noktilux said:
i've got the same issue on nexus 7 (new) running 4.3
here is my mount command:
mount -o noperm,unc=\\\\192.168.2.16\\Volume_2,username=guest,password=guest -t cifs musiq /sdcard/NAS
root only can see it.
from google groups, someone seems to have a workaraound, but i can not firgure out excactly what he means:
"when I mount using a shell-script (masked as a system-service like /system/bin/debuggerd) with "/system/bin/start" the mount is visible systemwide"
i tried replacing debuggerd with a script, but it is not part of the start-up services, so i am guessing /system/bin/start has to be invoked somehow?
Click to expand...
Click to collapse
The debugger method is described here: http://forum.xda-developers.com/showpost.php?p=37751808&postcount=55
Not sure it will work on 4.3, but you can give it a try.

How to mount a NFS share?

Hello there!
I'm not sure wether this is the right Forum thread, nor if it's even possible.
English is not my first language, but i hope i can make myself clear and explain my problem.
As in the title mentioned I just want to mount a nfs share into my filesystem so that i can access my media through a vpn whereever I go.
I'm using a Synology Diskstation as NAS and created some NFS-shares (tried version 3 and 4) which are accessable in my Network. It's working flawless with my raspberry pi and with my debian system. I don't want to use smb (cfis).
I want to use my favorit musicplayer to listen to my music, mounted via fstab in the musicfolder for example.
Right now i'm using the yatse app, works fine - but it's just a workaround....
I tried FreedomOS(stock kernel and elementalx)+busybox and Resurrection Remix(stockkernel and lightningkernel)+ busybox. All i get is Invalid argument or error messages. I just can't get it to work. It's a linux system, why can't i use a simple nfs share?
Any help would be apreciated.
Thanks in advance!
I used to mount a nfs share with busybox so be sure to have that installed.
next be sure to have a working VPN connection to your home network.
One more thing to check is that VPN connections are allowed to access the nfs shares. Dont know if you need to set this up with synology or that it's enabled by default.
Thanks for the response.
I have all permissions set to get access to the nfs-share, tried it without vpn aswell. The vpn itself is working like a charm.
I have access to my NAS via webinterface and sftp, i can control and stream from my raspberry pi aswell. No problems with the vpn for sure.
I'm using busybox aswell. Can you post me your mount command or your fstab line for the mount?
the1weasel said:
Thanks for the response.
I have all permissions set to get access to the nfs-share, tried it without vpn aswell. The vpn itself is working like a charm.
I have access to my NAS via webinterface and sftp, i can control and stream from my raspberry pi aswell. No problems with the vpn for sure.
I'm using busybox aswell. Can you post me your mount command or your fstab line for the mount?
Click to expand...
Click to collapse
I used this i believe.
Your kernel needs to support it.
https://gist.github.com/aldur/4a3f90a111b71662f056
maikvitesse said:
I used this i believe.
Your kernel needs to support it.
https://gist.github.com/aldur/4a3f90a111b71662f056
Click to expand...
Click to collapse
Thats exactly what i was told over here https://forum.xda-developers.com/oneplus-5/development/kernel-elementalx-op3-1-00-t3626808/post73156290#post73156290
I will follow up on that, thanks for pointing me in the right direction aswell.
Ok, i was able to mount the share.
Now that it's getting a general question i will follow up here. I posted what i did over here aswell and got it solved to this state.
I can see the files in the Terminal, but not in any App (explorer, musicplayer etc.).
As i already wrote here: https://forum.xda-developers.com/showpost.php?p=73161675&postcount=437 I'm guessing it's because i mounted as root so normal users can't use it. Or at least thats what I'm thinking.
I searched the forum already and just found a thread with someone having the same problem without solution.
Is there a way that i can use the mounted share with any app I want?
Just for the roundup.
Here is whats working:
mount a nfs-share through an terminal app. => Files are visible/browsable
whats not working:
Use the mounted nfs-share systemwide with any other app.
What i tried (used Termux):
mount into /mnt/remotenfs => files show up in terminal, just there.
mount into /storage/emulated/0/Music/remote => files show up in terminal, just there.
mounted the share and then started an explorer (solidexplorer) from terminal - same result. No fileaccess through explorer.
the1weasel said:
Just for the roundup.
Here is whats working:
mount a nfs-share through an terminal app. => Files are visible/browsable
whats not working:
Use the mounted nfs-share systemwide with any other app.
What i tried (used Termux):
mount into /mnt/remotenfs => files show up in terminal, just there.
mount into /storage/emulated/0/Music/remote => files show up in terminal, just there.
mounted the share and then started an explorer (solidexplorer) from terminal - same result. No fileaccess through explorer.
Click to expand...
Click to collapse
I think I suggested something like this as a way to glean some information about this problem in the other thread, but don't recall for certain what the outcome if any was:
At least since V5 and above of Android OS, there's been some sort of thread insularity that keeps another thread from seeing what some of the first one sees. (moreso than before V5). I figured that since fstab.qcom (or whatever the name of the actual startup file where "mount -a" is pointed) must contain the mounted partitions that are visible to all. If that's the case, it's either the startup mount daemon, or it is in one of the columns of each "mount" entry in fstab.*.
I think I suggested adding a mount entry without the "automount at start" parameter for your remote music. Just curious if that was tried? Also, I thought the file where these were entries were kept in M & N (6 & 7) had "*vold*" in the title.
I'm also curious about this and will look around for some better answer because it seems very non-linux / android that only the thread performing the action can see the result (although that is how local actions / variables act).
After some poking around: I think this link explains some possible reasons for this behavior, not that there isn't some way around it. Probably there is no way around it without some compromise of whatever privacy additions android OS is after. It sounds a lot like an SELinux & /proc FS change. https://stackoverflow.com/questions/38590140/file-system-changes-in-android-nougat
hachamacha said:
I think I suggested something like this as a way to glean some information about this problem in the other thread, but don't recall for certain what the outcome if any was:
At least since V5 and above of Android OS, there's been some sort of thread insularity that keeps another thread from seeing what some of the first one sees. (moreso than before V5). I figured that since fstab.qcom (or whatever the name of the actual startup file where "mount -a" is pointed) must contain the mounted partitions that are visible to all. If that's the case, it's either the startup mount daemon, or it is in one of the columns of each "mount" entry in fstab.*.
I think I suggested adding a mount entry without the "automount at start" parameter for your remote music. Just curious if that was tried? Also, I thought the file where these were entries were kept in M & N (6 & 7) had "*vold*" in the title.
I'm also curious about this and will look around for some better answer because it seems very non-linux / android that only the thread performing the action can see the result (although that is how local actions / variables act).
After some poking around: I think this link explains some possible reasons for this behavior, not that there isn't some way around it. Probably there is no way around it without some compromise of whatever privacy additions android OS is after. It sounds a lot like an SELinux & /proc FS change. https://stackoverflow.com/questions/38590140/file-system-changes-in-android-nougat
Click to expand...
Click to collapse
Thanks for the response, looks like you are much more into that android thing....
I just added
"10.11.12.10:/volume1/Audio /storage/emulated/0/Music/remote nfs nolock,ro defaults"
to the fstab.qcom . Doesn't mount at startup.
I realized some inconsitency in the ssh thing, sometimes it works mounting via ssh, sometimes not....strange. (mount: applet not found)
To be sure i'm doing all that stuff without ssh.
Edit:
For everyone else reading this. It's not about music, the musicfolder is just a random folder to see if it's working.
the1weasel said:
Thanks for the response, looks like you are much more into that android thing....
I just added
"10.11.12.10:/volume1/Audio /storage/emulated/0/Music/remote nfs nolock,ro defaults"
to the fstab.qcom . Doesn't mount at startup.
I realized some inconsitency in the ssh thing, sometimes it works mounting via ssh, sometimes not....strange. (mount: applet not found)
To be sure i'm doing all that stuff without ssh.
Edit:
For everyone else reading this. It's not about music, the musicfolder is just a random folder to see if it's working.
Click to expand...
Click to collapse
To add to that: It doesn't seem like any surprise that just putting an entry in the fstab.qcom doesn't work the same as the others. As I search around for a way to do this it becomes apparent that even a Synology app designed to do this (DS File) (Mounts a NFS share on Synology box and allows file transfers) isn't able to allow others to see it's mounted share.
Before I mounted a Synology folder using Synology DS File, I created a tmp folder and cd there and then did a mount > mountbefore.log. After the mount of the share while still running DS File pointing to my Synology folder, I did a mount > ./mountafter.log. I then did a diff -urN (and just a diff) ./mountbefore.log ./mountafter.log that showed no differences. That seems telling.
Also, I did the same with /proc/mounts /proc/mountinfo /proc/mountstatus before and after, and nothing showed up as different. Also I did a ps | grep DS to see whether the ps output gave me any clue as to what local mount point was used, but though I could see the DS process, I couldn't see it's mountpoints.
I'm pretty sure there's an SELINUX (or many) entrie(s) for the mounted share that prevent the usual visibility. I recall reading that "fixing" the /proc exploits was a big priority with the advent of SElinux so I'll look at that angle too. I don't think that the fact that DLNA works is of much use in this problem. It's really a solution to a different and specific problem.
hachamacha said:
To add to that: It doesn't seem like any surprise that just putting an entry in the fstab.qcom doesn't work the same as the others. As I search around for a way to do this it becomes apparent that even a Synology app designed to do this (DS File) (Mounts a NFS share on Synology box and allows file transfers) isn't able to allow others to see it's mounted share.
Before I mounted a Synology folder using Synology DS File, I created a tmp folder and cd there and then did a mount > mountbefore.log. After the mount of the share while still running DS File pointing to my Synology folder, I did a mount > ./mountafter.log. I then did a diff -urN (and just a diff) ./mountbefore.log ./mountafter.log that showed no differences. That seems telling.
Also, I did the same with /proc/mounts /proc/mountinfo /proc/mountstatus before and after, and nothing showed up as different. Also I did a ps | grep DS to see whether the ps output gave me any clue as to what local mount point was used, but though I could see the DS process, I couldn't see it's mountpoints.
I'm pretty sure there's an SELINUX (or many) entrie(s) for the mounted share that prevent the usual visibility. I recall reading that "fixing" the /proc exploits was a big priority with the advent of SElinux so I'll look at that angle too. I don't think that the fact that DLNA works is of much use in this problem. It's really a solution to a different and specific problem.
Click to expand...
Click to collapse
Hmm I just found this: https://forum.xda-developers.com/showthread.php?t=2106480 and will have a closer look into it later, I'm running out of time right now and have to leave.
But what I've read so far looks similar to the problem we are facing right now. Maye thats the way to go. I'll try it, as I said, later.
At this point i don't even care if it's smb or nfs as long as i can mount my stuff into the filesystem.
One other thing I noticed but haven't messed around with yet is that I was looking at the various mount commands for different implementations (not that any will just work like 2 versions ago), and noticed that only /system/xbin/mount is a soft link to /system/xbin/busybox (standard busybox link to allow using it various look-alike-to-linux commands.
But then I realized that /system/bin/mount is also there, also a soft-link to /system/bin/toybox (another busybox clone) and am wondering if it behaves any differently. Might be worth a look (but I doubt it). /system/bin/toybox is at least a different version of busybox and not linked to it.
Just looked at your last reply and realized that unfortunately the two links of interest are at the now nonexistant domain cyanogenmod.org. Maybe the diffs are worthwhile. Gotta work, Later.
hachamacha said:
One other thing I noticed but haven't messed around with yet is that I was looking at the various mount commands for different implementations (not that any will just work like 2 versions ago), and noticed that only /system/xbin/mount is a soft link to /system/xbin/busybox (standard busybox link to allow using it various look-alike-to-linux commands.
But then I realized that /system/bin/mount is also there, also a soft-link to /system/bin/toybox (another busybox clone) and am wondering if it behaves any differently. Might be worth a look (but I doubt it). /system/bin/toybox is at least a different version of busybox and not linked to it.
Just looked at your last reply and realized that unfortunately the two links of interest are at the now nonexistant domain cyanogenmod.org. Maybe the diffs are worthwhile. Gotta work, Later.
Click to expand...
Click to collapse
I'm back home already a little late but enaugh time for more researches.
This link:
https://github.com/mkasick/android_...mmit/b358bf82c079a577f011c167da8b65faef73a06e
is working. And really worth reading it and explains the visibility problem.
mkasick said:
Android 4.2 breaks Dalvik-apps that mount file systems to be shared with other apps. This includes CifsManager, Mount Manager, essentially anything that mounts cifs shares, FUSE file sytems, etc. The symptom is that the mounted contents appear fine to app that peforms the mount operation (assuming the app itself provides the ability to browse the contents), but every other app only sees an empty directory at the mount point.
It turns out that this problem is a side-effect of the approach used to implement multi-user storage in Android 4.2. I've explained the problem in detail in the commit log for a Gerrit issue we're reviewing for CyanogenMod 10.1 that addresses the problem:
Ideally, any 4.2 ROM can provide support for CifsManager by applying a change to Dalvik, and a second change to the boot ramdisk's init.rc:
Dalvik change: Zygote: Restrict slave mountspace so Dalvik apps can mount system-wide volumes
init.rc change: init.rc: Create /storage mountpoint so Dalvik can mark as slave in zygotes
Alternatively, ROMs that can't/prefer not to use a source-build Dalvik (libdvm), I've also provided a kernel patch that implements a similar workaround within the kernel. It also requires the above init.rc modification:
Kernel commit: Restrict slave mountspace so Dalvik apps can mount system-wide volumes
init.rc change: init.rc: Create /storage mountpoint so Dalvik can mark as slave in zygotes
With either of the above two fixes, CifsManager et al. should work when using a mountpoint outside /storage (and /mnt/shell/emulated). I'd recommend using "/mnt/cifs" or something similar. Attempting to mount inside /storage retains the previous behavior where the mount can not be seen by other apps.
Note that ROMs only need one of the above two fixes, although they are compatible with each other and will function correctly if both are present. The Dalvik approach is preferred over the kernel workaround where feasible. Attached are the three patches referenced in the issues/commits.
Attachments: (sry for editing the quote)
dalvik.diff: https://forum.xda-developers.com/attachment.php?attachmentid=1656555&d=1358548352
nitrc.diff: https://forum.xda-developers.com/attachment.php?attachmentid=1656556&d=1358548352
kernel.diff: https://forum.xda-developers.com/attachment.php?attachmentid=1656557&d=1358548352
Click to expand...
Click to collapse
Look at the attached files, the answer is in there, but i don't know what to do with it
Thanks. I've got to do some work from home before I go back to messing around with this. I read the zygote/Dalvik page. I'm sure I've read it before but had the impression that the information was obsolete, but maybe not!
I guess there a couple of problems for me with that information.
1) It is pretty old (2013 or so): I can't even find the pertinent file in my source tree anymore.
2) dalvik has undergone a lot of revisions since this was tried. I'm not at all sure the change looks very different from the way tmpfs is /storage mounted already.
(but I could try this one. I figure in real time, if it'd let me remount it with the changes, the worst it could do is lock me up).
3) the kernel I'm using doesn't appear to have that line in it, besides, I'd have to rebuild the kernel.
I guess I'd much rather find a userspace way around this problem if possible. I seems almost unthinkable that there'd be no other way (via the mount cmd for example and careful choice of mount folder) to mount something that could be seen by any process. I'll keep trying from that angle.
Regrouping: I was ssh'd into the synology server poking around when I noticed that the running nfs daemon (as shown by ps -ef | grep nfs) was nfs4. I didn't see that Android supported that so I decided to just move the entire exercise of mount.nfs4 over to Ubuntu 16.04 box.
I made sure I had all the NFS stuff installed and pretty much did these statement:
mount -t nfs -o ro x.x.x.x/share /mnt/remote # failed with bad argument
mount -t nfs4 -o ro x.x.x.x/share /mnt/remote # failed with bad argument
mount.nfs4 x.x.x.x/share /mnt/remote #failed with bad argument.
At that point I decided that android didn't matter if I couldn't figure out how to mount NFS shares from linux.
I then tried mount -t cifs -o ro,user=me,pass=pwd //server/share /mnt/remote
It mounted up immediately. I need to look up some working examples of someone using mount.nfs / 4 from anywhere to synology. While I'm sure I've used it before, I'm also pretty sure I don't recall how exactly the setup and syntax works.

Categories

Resources