[modules] cifs.ko, md4.ko, nls_utf8.ko, stock [4.2 / 4.2.2] 3.4.5-g4e6298b / gaf9c307

Search This thread

sam3000

Senior Member
Jul 11, 2009
365
421
Seattle
Interesting. I'm following this thread as a Nexus 7 user. I'm wondering if it's worth trying this on a Nexus 7 running the stock ROM. The only thing I can think of that might cause it to not work is the patched /system/lib/libdvm.so. Any thoughts on that? If it's not a show stopper, then I'm willing to try and report my results. I'll never use the multi-user aspect of 4.2.x, so I don't care about losing that either. And it's easy enough to go back to 4.1.2 and bide my time, if this fails. Just don't want to waste my time if the patched library won't work on a Nexus 7.

Let me know. And thanks.

I happen to have a nexus 7 but not yet put on 4.2. I'll see if I can get things together so that I can pm you a zip to try.
 

ThurstonX

Senior Member
Oct 29, 2012
255
120
I happen to have a nexus 7 but not yet put on 4.2. I'll see if I can get things together so that I can pm you a zip to try.

You are da man! Look forward to your PM :)

I have the three CIFS .ko modules for 4.1.2. Would these need to be replaced when I upgrade to 4.2.1? If so, could you please include the modules in the zip. Thanks.
 
Last edited:

amans

Member
Aug 10, 2009
33
1
Update: craigacgomez AOSP does not appear to work with this. I suspect libdvm.so incompatibility. If this is true, it's likely the zip only works with cm. Please still do try if you are running cm.

Okay, here's an experiment...

Attached is a flashable zip that does the following:
1) replaces /system/xbin/busybox with a version that has the unc fixup patch (for roms that don't already include it).
2) removes existing symlink /system/bin/mount and recreates it pointing to /system/xbin/mount so that the default "mount" uses the fixed version.
3) installs a patched /system/lib/libdvm.so dalvik library that has had removed the unshare() call that is partitioning the mount namespace and making cifs mounts invisible to other processes (unless you do hack around adb shell etc).

Use at your own risk and I'd certainly recommend ensuring you have your current rom available for reflashing if anything goes wrong... However, for me, with stock cm I can now simply flash this and then cifsmanager works as it always did previously without any other hackery whatsoever.

I can't see why this wouldn't work for any rom (certainly stock and cm should be good). The only thing you need to ensure is that you have the cifs module for your rom already installed.

Final note: this is a dirty hack because it entirely destroys the per user mount namespace separation feature. That said, I only have one user account on my tablet so my personal care level is zero.

Let me know if it works for you.

Hi,
I confirm that cifs has been merged in cm !
I tried just to put your libdvm.so file in /system/lib of cm and now i can mount and see it under solid explorer or others.... :D
Just a little problem.....it's absolutly unstable :(
I begin to browse in it, watch or listen something, and after few minutes, it's getting unmounted....!
I need to remount it again and again...don't know why...
I didn't had the time to look at logs.
Just tell me if you need something ;)
Thanks !!
 

sam3000

Senior Member
Jul 11, 2009
365
421
Seattle
Hi,
I confirm that cifs has been merged in cm !
I tried just to put your libdvm.so file in /system/lib of cm and now i can mount and see it under solid explorer or others.... :D
Just a little problem.....it's absolutly unstable :(
I begin to browse in it, watch or listen something, and after few minutes, it's getting unmounted....!
I need to remount it again and again...don't know why...
I didn't had the time to look at logs.
Just tell me if you need something ;)
Thanks !!

That's strange. Was it working for you originally using the mount via adb shell hack described in the OP of this thread? (or did you not ever happen to try that?) ie is it possible this might happen even if you didn't use the hacked libdvm.so

FWIW, I don't see any such behaviour myself (ie the mounts persist indefinitely).

Logcat and dmesg output from when this happens might be interesting to look at.
 

amans

Member
Aug 10, 2009
33
1
i didn't tried using adb...
other thing....i just noticed that with your file, i can't update any app, it fails each time :(
i can't even open titanium backup with your file...weird...
so i reverted back with the original cm file
i'll try tomorrow to give you logcat and dmesg output ;)
 

Barguast

Senior Member
Sep 30, 2008
266
12
Has anyone had any luck following the step-by-step in the first post, under 'EDIT2'?
 

DanielGwalter

Member
Dec 14, 2007
14
0
Surrey
No luck here,

clean install with CM nightly build.... now I am lost as to the correct approach as this thread has twisted and turned...

can someone summarize the correct approach in a new thread?

thanks

Dan
 

darkuni

Senior Member
Sep 12, 2010
378
75
Did anyone report back on craig's rom for sure not working with this? I could care less about multiuser features.

What would craig (or we) have to do to get this flashable working?

Update: craigacgomez AOSP does not appear to work with this. I suspect libdvm.so incompatibility. If this is true, it's likely the zip only works with cm. Please still do try if you are running cm.

Okay, here's an experiment...

Attached is a flashable zip that does the following:
1) replaces /system/xbin/busybox with a version that has the unc fixup patch (for roms that don't already include it).
2) removes existing symlink /system/bin/mount and recreates it pointing to /system/xbin/mount so that the default "mount" uses the fixed version.
3) installs a patched /system/lib/libdvm.so dalvik library that has had removed the unshare() call that is partitioning the mount namespace and making cifs mounts invisible to other processes (unless you do hack around adb shell etc).

Use at your own risk and I'd certainly recommend ensuring you have your current rom available for reflashing if anything goes wrong... However, for me, with stock cm I can now simply flash this and then cifsmanager works as it always did previously without any other hackery whatsoever.

I can't see why this wouldn't work for any rom (certainly stock and cm should be good). The only thing you need to ensure is that you have the cifs module for your rom already installed.

Final note: this is a dirty hack because it entirely destroys the per user mount namespace separation feature. That said, I only have one user account on my tablet so my personal care level is zero.

Let me know if it works for you.
 

DanielGwalter

Member
Dec 14, 2007
14
0
Surrey
Hi

can someone give me an update on this thread please.

I am running CM nightlies that have cifs modules installed and I have tried the fixup script version too both to no avail

I have tried the script method (and via mount manager) and i get empty folders

I have also tried the ADB method but I get a permission denied when executing the command (not sure where this is coming from and am using script manager with SU option to load the script provided by the OP in edit 3.

....

is it the common view that at this point in time CIFS mounts are not achievable in 4.2?

please advise, I am not fussed about multi user functionality and would happily break it to get CIFS working!

thanks

Dan.
 

H3g3m0n

Senior Member
Sep 15, 2009
60
16
Hi

can someone give me an update on this thread please.

I am running CM nightlies that have cifs modules installed and I have tried the fixup script version too both to no avail

I have tried the script method (and via mount manager) and i get empty folders

I have also tried the ADB method but I get a permission denied when executing the command (not sure where this is coming from and am using script manager with SU option to load the script provided by the OP in edit 3.

....

is it the common view that at this point in time CIFS mounts are not achievable in 4.2?

please advise, I am not fussed about multi user functionality and would happily break it to get CIFS working!

thanks

Dan.
It's still working fine here but I'm on stock. Try doing the commands manually 1 by 1 on the terminal to find out exactly which command is giving the error.
 

DanielGwalter

Member
Dec 14, 2007
14
0
Surrey
It's still working fine here but I'm on stock. Try doing the commands manually 1 by 1 on the terminal to find out exactly which command is giving the error.

Thanks for the reply....

What version of the method are you using and is it stable an viewable from other apps ... For example can you view the files on a share from a file manager?

Also what version of android are you running?

Sorry, for all the questions, just I was convinced this did not work!

Thanks

Dan
 

H3g3m0n

Senior Member
Sep 15, 2009
60
16
Thanks for the reply....

What version of the method are you using and is it stable an viewable from other apps ... For example can you view the files on a share from a file manager?

Also what version of android are you running?

Sorry, for all the questions, just I was convinced this did not work!

Thanks

Dan

I'm using the script with the modules in my OP. Working fine in all apps, doesn't matter if they where load before or after the script. Stock Android (rooted, busyboxed) 4.2.1
 

DanielGwalter

Member
Dec 14, 2007
14
0
Surrey
I'm using the script with the modules in my OP. Working fine in all apps, doesn't matter if they where load before or after the script. Stock Android (rooted, busyboxed) 4.2.1

I was hoping you wouldnt say that!!!...

I am running CM nightly ... rooted, busyboxed when executing insmod in the script I get exec format error .... is this something you can help with ?

D
 

H3g3m0n

Senior Member
Sep 15, 2009
60
16
I was hoping you wouldnt say that!!!...

I am running CM nightly ... rooted, busyboxed when executing insmod in the script I get exec format error .... is this something you can help with ?

D

The modules in this thread are specific to the kernel that ships with the stock version of Android 4.2 and 4.2.1 (possibly future versions if they don't change the kernel).. You will need modules for CM. Someone in a previous post said that it now ships with them. If that's correct you will need to find where they are installed and insmod them instead.
 

regystro

Member
Feb 18, 2008
7
2
Got the adb script working

For those having trouble with the adb script in POST #1 you may try this:

Remove the word "root" from line: adb -s $SERIAL shell su root -c "$COMMANDS"
I also changed the "mount" command by "busybox mount" (I didn't make the hardlink as recommended in some posts)

That was driving me nuts. Everytime I executed the script I saw "SuperSU - Copyright [...] Chainfire" message until I removed the "root". Now it all works flawlessly. I guess this may be happening because of the superuser binary version I have installed.

Merry Xmas.
 
  • Like
Reactions: blurp76 and x51

x51

Senior Member
Apr 23, 2008
364
40
Remove the word "root" from line: adb -s $SERIAL shell su root -c "$COMMANDS"
I also changed the "mount" command by "busybox mount" (I didn't make the hardlink as recommended in some posts)

That was driving me nuts. Everytime I executed the script I saw "SuperSU - Copyright [...] Chainfire" message until I removed the "root". Now it all works flawlessly. I guess this may be happening because of the superuser binary version I have installed.

Merry Xmas.

I spent HOURS messing with this.. Finally!! his worked for me.Thanks.
I still have other issues.. but this got me closer to something that resembles working.
 
  • Like
Reactions: blurp76

DanielGwalter

Member
Dec 14, 2007
14
0
Surrey
Hi,

last night i decided to start fresh with a new install (complete wipe back to factory defaults)..

I am now running the cm nightly based on 4.2.1 with kernel version 3.4.5-g73335a3

inside system/lib/modules there is a cifs.ko (installed as part of the cm10 distro)

I have script manager installed and have been trying to run the script from the OP (localhost adb).

i have not copied any new files as the ones on this post were meant for a stock rom and they always result in errors (invalid argument etc etc).

when i run the script it executes fine down to the actual mount command at which point i get "segmentation fault" in the terminal window.

the only edit I have made to the file is to remove the two additional insmods (as i dont have those files!) and to adjust the paths to suit my network.

can anyone point me in the right direction to move past segmentation fault and onto a working solution!!!

thanks in advance

Dan.
 

H3g3m0n

Senior Member
Sep 15, 2009
60
16
Hi,

last night i decided to start fresh with a new install (complete wipe back to factory defaults)..

I am now running the cm nightly based on 4.2.1 with kernel version 3.4.5-g73335a3

inside system/lib/modules there is a cifs.ko (installed as part of the cm10 distro)

I have script manager installed and have been trying to run the script from the OP (localhost adb).

i have not copied any new files as the ones on this post were meant for a stock rom and they always result in errors (invalid argument etc etc).

when i run the script it executes fine down to the actual mount command at which point i get "segmentation fault" in the terminal window.

the only edit I have made to the file is to remove the two additional insmods (as i dont have those files!) and to adjust the paths to suit my network.

can anyone point me in the right direction to move past segmentation fault and onto a working solution!!!

thanks in advance

Dan.
The only time I managed to get mount to segfault was when I was trying to pass the 'make shared' option which I was hoping would allow it to multi mount without the adb hack.

It's possible CM have applied some hack to try and get mounts working through the multiuser stuff.

Your correct in not needing the files from the original post but you may still need to insmod the CM modules. I'm not sure if it loads them by itself.

Ignore the script for now and try stripping the mount command down to it's most basic possible line. This will let you see if it mounts without using the adb hack and if the files are visible on the console (if not the apps). See if removing the UNC option does anything, it's only needed for unpatched Busybox binaries (CM may have patched their busybox binary already).

If it's still segfaulting with a very basic mount command, then I would file a bug with the CM people.

Did you happen to try a cifsmanager at all? Maybe CM have applied patches that allow it to work unmodified.
 

DanielGwalter

Member
Dec 14, 2007
14
0
Surrey
The only time I managed to get mount to segfault was when I was trying to pass the 'make shared' option which I was hoping would allow it to multi mount without the adb hack.

It's possible CM have applied some hack to try and get mounts working through the multiuser stuff.

Your correct in not needing the files from the original post but you may still need to insmod the CM modules. I'm not sure if it loads them by itself.

Ignore the script for now and try stripping the mount command down to it's most basic possible line. This will let you see if it mounts without using the adb hack and if the files are visible on the console (if not the apps). See if removing the UNC option does anything, it's only needed for unpatched Busybox binaries (CM may have patched their busybox binary already).

If it's still segfaulting with a very basic mount command, then I would file a bug with the CM people.

Did you happen to try a cifsmanager at all? Maybe CM have applied patches that allow it to work unmodified.

hi,

I tried cifs manager but that only shows up in the current session (ES File manager but no other apps).

so, i stripped all the commands back to the point where i could get it to mount, then i started adding back and got it working ....

question: I am trying to write a script that cleans up and creates the mounts....

what command can i use to unmount the mount points. i tried umount <path> and this appears to work (as long as you su it) but then when i try to delete the folder i get "device busy" ... if i reboot and delete its fine but thats not the desired umount method!

so what I am looking for is a forcible unmount and delete of mount folder...

thanks

Dan.
 

ThurstonX

Senior Member
Oct 29, 2012
255
120
I'm trying to make this work on a Nexus 7. I've got the modules and the script seems to load them and mount successfully. The mount point is empty, though.

Script Manager reports the following after connecting to localhost:5555 and "Mounting share via adb...":
Usage: adb services [-l] (I think that's a lowercase "L")

usage: setprop <key> <value>
Mounting success!


To get that far I had to edit the script to change ` to ' and to stop CIFS Manager from loading the modules at startup (was getting "insmod .... failed (file exists)" errors.

I realize this is a Nexus 10 thread, but surely the principles are the same.

Any advice? Thanks.

My script:

Code:
#!/system/bin/sh

# Your settings here
USERNAME=guest
PASSWORD=
IPADDRESS="192.168.1.200"
SHARE="myshare"
MOUNT_POINT="/sdcard/cifs/myshare"


# If you need to change the mount command edit this
MOUNT_CMD="\
busybox mount -t cifs                   \
                                \
-o ro                             \
user=$USERNAME,\
password=$PASSWORD,\
unc=\\\\\\\\\\\\\\\\$IPADDRESS\\\\\\\\$SHARE      \
                                \
//$IPADDRESS/$SHARE             \
$MOUNT_POINT"

COMMANDS="\
insmod /sdcard/modules/CIFS/md4.ko;          \
insmod /sdcard/modules/CIFS/nls_utf8.ko;     \
insmod /sdcard/modules/CIFS/cifs.ko;         \
$MOUNT_CMD
"

# Starting ADB...
PORT='getprop service.adb.tcp.port'
setprop service.adb.tcp.port 5555
stop adbd
start adbd
adb connect localhost

# Make sure we only use the first device (sometimes there is more than one)
SERIAL='adb devices | head -n2 | tail -n1 | cut -f1'
if [ "$SERIAL" = "" ] ; then
    echo "ERROR: Could not find ADB device.";
fi

echo Mounting share via adb...
adb -s $SERIAL shell su -c "$COMMANDS"

# If you started adb, then stop it here for security:
adb disconnect localhost
stop adbd
setprop service.adb.tcp.port $PORT
start adbd

RESULT='mount | grep $MOUNT_POINT'

if [ "$RESULT" = "" ] ; then
    echo "Mounting failed..."
else
    echo "Mounting sucess!"
fi

echo Done... You may close this script window.
 

Top Liked Posts

  • There are no posts matching your filters.
  • 6
    I have managed to get CIFS working on stock Nexus 10.

    It's quite a bit more problematic on the Nexus 10 than normal.

    There are 2 main issues to deal with. Newer versions of the Linux kernel require a UNC variable to be passed to them and the current version of busybox doesn't do this. There is a patch out. I have extracted the patched busybox binary from craigacomez's AOSP Nexus 10 rom.
    (Check it out here: http://xdaforums.com/showthread.php?t=1998585 ). Otherwise it should work on the stock mount command if you specify the unc= mount option with the share.

    The other issue is the multiuser stuff. If you execute the mount command from inside Terminal Emulator (or a script program) it looks like it mounts ok and you can 'ls' in the directory but it doesn't work for Android apps, they just see an empty directory but if you do it via a 'adb shell' it works fine in Android apps. My theory is ADB is outside of the multiuser stuff. adb actually ships on the device.

    1) Unlock bootloader (fastboot oem unlock)
    2) Flash recovery adb flash recovery whatever.img
    3) Root device (flash CWM-SuperSU-0.98.zip)
    4) Install BusyBox (from the market)
    5) Copy md4.ko and cifs.ko to device. The files can go anywhere you like. In this example I will just use the root of the sdcard. Some people like them in /system/modules or /system/lib/modules
    6) busybox mount -o rw,remount /
    7) adb shell
    8) Override /system/bin/busybox with the patched version (maybe move it first so it's backed up).
    9) insmod /sdcard/md4.ko
    10) insmod /sdcard/cifs.ko
    11) busybox mount -t cifs -o username=MYUSER,password=MYPASS,unc=\\\\192.168.1.1\\storage //192.168.1.1/storage /data/media/0/cifs/Storage

    You will need to manually preform the last 3 commands each time you reboot the device from a adb shell.

    NOTE: You can probably get rid of the -o flags completely. In theory the patched version of busybox makes the UNC bit redundant. Possibly you can use the stock busybox with the UNC flag and avoid using the patched one totally. I have just included it to be sure.

    Make sure you type 'busybox mount' not 'mount', by default they are different binaries. Otherwise you can remove the /system/bin/mount command and make a new one linking /system/bin/mount to /system/bin/busybox.

    Possibly there is some way to get the mount working in the multiuser environment without requiring busybox. If you figure it out please tell ☺

    Some threads on the issue:
    http://xdaforums.com/showthread.php?p=34397868#post34397868
    http://xdaforums.com/showthread.php?t=733490&page=6
    http://www.mail-archive.com/busybox@busybox.net/msg17650.html

    The modules are for 3.4.5-g4e6298b.

    EDIT: I added nls_utf8.ko by request

    EDIT2: Since adb comes on the device, it is possible to use it to connect to local host:
    1) Install cifs modules to /system/lib/modules
    2) Install Script Manager from the play store
    3) Copy script to device
    4) Start SManager
    5) Find your script and open it.
    6) Tick the su box
    7) Hit save
    8) Goto home sccreen
    9) Add a 'SMShortcuts' widget to your home screen
    10) "Add one script shortcut"
    11) Choose your script
    12) Optionally use this pretty icon
    13) Give it a nice name like "Mount Shares"

    Here is a shell script...
    Code:
    #!/system/bin/sh
    
    # Your settings here
    USERNAME="USERNAME"
    PASSWORD="PASSWORD"
    IPADDRESS="192.168.1.1"
    SHARE="storage"
    MOUNT_POINT="/data/media/0/cifs/Storage"
    
    # If you need to change the mount command edit this
    MOUNT_CMD="\
    mount -t cifs                   \
                                    \
    -o                              \
    user=$USERNAME,\
    password=$PASSWORD,\
    unc=\\\\\\\\\\\\\\\\$IPADDRESS\\\\\\\\$SHARE      \
                                    \
    //$IPADDRESS/$SHARE             \
    $MOUNT_POINT"
    
    COMMANDS="\
    insmod /system/lib/modules/md4.ko;          \
    insmod /system/lib/modules/nls_utf8.ko;     \
    insmod /system/lib/modules/cifs.ko;         \
    $MOUNT_CMD
    "
    
    # Starting ADB...
    PORT=`getprop service.adb.tcp.port`
    setprop service.adb.tcp.port 5555
    adb kill-server
    adb start-server
    stop adbd
    start adbd
    adb connect localhost
    
    # Make sure we only use the first device (sometimes there is more than one)
    SERIAL=`adb devices | head -n2 | tail -n1 | cut -f1`
    if [ "$SERIAL" = "" ] ; then
        echo "ERROR: Could not find ADB device.";
    fi
    
    echo Mounting share via adb...
    adb -s $SERIAL shell su root -c "$COMMANDS"
    
    # If you started adb, then stop it here for security:
    adb disconnect localhost
    stop adbd
    setprop service.adb.tcp.port $PORT
    start adbd
    
    RESULT=`mount | grep $MOUNT_POINT`
    
    if [ "$RESULT" = "" ] ; then
        echo "Mounting failed..."
    else
        echo "Mounting sucess!"
    fi
    
    echo Done... You may close this script window.

    EDIT3: Added usbserial.ko, option.ko and usb_wwan.ko

    EDIT4: Some users have reported that the need to modify the script to get it working with their version of SU.

    EDIT5: I have uploaded modules for 4.2.2, kernel 3.4.5-gaf9c307 but I haven't actually tested them myself (still on 4.2.1). Apparently the adb loophole has also been patched but it is possible to reenable it by putting a RSA key onto the device. Check out this set of instructions here.

    EDIT6: I have updated to 4.2.2 on my Nexus 10 and can confirm the new modules work.

    You must setup the adbkey or you will get a "device: offline" message. By default adb when adb first runs it tries to create the keys in the $HOME dir which is /data/.android, but the data directory isn't accessible by the 'shell' user.

    I got it working simply by setting the HOME variable to /sdcard and restarting the adb server in the script then Android popped up a query (I have update the script above).

    IMPORTANT: The Android Media scanner recursively scans folders for media to add the the database so it shows up in programs like Google Music. On large shares this can be a long process and use heaps of battery life. To prevent this add a blank file with the name ".nomedia" to the root of your mount points (or each individual share if you aren't used 1 folder for all your mounts). This will stop music showing up in programs though.

    If you find that the device stops responding (the launcher might work but apps fail to load) or you get reboots (often after the previous bug) this is probably due to a bad wifi connection.
    2
    Got the adb script working

    For those having trouble with the adb script in POST #1 you may try this:

    Remove the word "root" from line: adb -s $SERIAL shell su root -c "$COMMANDS"
    I also changed the "mount" command by "busybox mount" (I didn't make the hardlink as recommended in some posts)

    That was driving me nuts. Everytime I executed the script I saw "SuperSU - Copyright [...] Chainfire" message until I removed the "root". Now it all works flawlessly. I guess this may be happening because of the superuser binary version I have installed.

    Merry Xmas.
    1
    Sorry for the noob ? ...

    What are the KO's do?
    What is the practical use of then.

    Sorry I did a little research on then but I could not find an answer in layman terms

    Thank you for allowing me to learn.;)

    Sent from my toroplus using xda premium

    http://en.wikipedia.org/wiki/Loadable_kernel_module
    1
    Quick question all - (sorry an Android Noob here who's spent way too many hours reading through XDA since the Nexus 10 Purchase! :)

    Mounting CIFs shares in this manner are you then seeing transfer speeds that the nexus 10 is capable of over Wifi? I've been trying to get the 80-90mbps through CIFs shares that I get from Iperf tests but all File Explorers only give me 20mbps which obviously isn't great for HD Video.

    Just wanted to throw it out there to see what kind of bandwidth people are getting using this solution. Cheers!

    The kernel module cifs is much faster!
    1
    Remove the word "root" from line: adb -s $SERIAL shell su root -c "$COMMANDS"
    I also changed the "mount" command by "busybox mount" (I didn't make the hardlink as recommended in some posts)

    That was driving me nuts. Everytime I executed the script I saw "SuperSU - Copyright [...] Chainfire" message until I removed the "root". Now it all works flawlessly. I guess this may be happening because of the superuser binary version I have installed.

    Merry Xmas.

    I spent HOURS messing with this.. Finally!! his worked for me.Thanks.
    I still have other issues.. but this got me closer to something that resembles working.