Post Reply Subscribe to Thread Email Thread

[KERNEL] [15/01/31][5.0.2/3G+WIFI][Fix for empty directories after mount] [V16]

19th January 2013, 11:56 AM   |  #1  
vorcers's Avatar
OP Senior Member
Thanks Meter: 116
146 posts
Join Date:Joined: May 2012
Hey Guys,

mkasick released in his thread a fix for the mounting problems in Android >= 4.2.

Description of the issue:
Originally Posted by mkasick

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.

As I said - mkasick released a solution - so I compiled my own kernel. Now we can again easy mount cifs and others! All old apps should work. Only limitation: the mount point needs to be outside of /storage (and also /mnt/sdcard/). Fix for this: Mount within /data/media/0 -- android will redirect the mount so you can access the mounted-files from this folders.

The kernel is a "stock kernel" and also includes:
  • mkasick Patch
  • Built-In cifs, md4, utf8
  • kexec hardboot patch (The full patch, allows boot as host and as guest)
  • As Modules: .ko: nfs, snd-usb-audio and all of its devices
  • [Since V16/Android 5.0.2] Fix for baseband_xmm_power wakelock on tilapia (see Hints and Bugs since V16 / Android 5.0 / Lollipop ; for Android 4.4.4 see this post)

mkasick recommends in his thread to patch dalavik, but for the stock-roms it is easier to patch the kernel.

Known Bugs:
  • Since Android 5.0.X/V16: SELinux is now blocking the access of cifs/nfs even in read. Also nfs isn't loaded at boot time anymore. For more information look below.
  • Since Android 4.4.X: There is a known bug with mounting cifs (you can't write). The solution is (try at your own risk) here. If you want to do this workaround at boot-time, you can flash the zip linked here.
  • With SuperSU >= 1.50 && < 1.65 the mounted folders are empty. Please update! (For more Info see hide-box "SuperSU Information" below)

Hints and Bugs since V16 / Android 5.0 / Lollipop:

SELinux, cifs and nfs

SELinux is since Android 5.0 "more" enforced. Because of that, even the read on nfs / cifs isn't working anymore without disabling selinux by "setenforce permissive" as root. Be careful, disabling selinux is an security hole. USB is still working with selinux at enforcing.

Because of the same reason the nfs and sound modules are not loaded at boot anymore. Because I don't want to mess around with selinux at boot time, you can modprobe them yourself, if you need it. Run the following commands as root to use nfs / sound modules (a installed busybox is required):

Activate sound modules:
busybox modprobe snd-usb-audio
Activate NFS File System:
busybox modprobe nfs
Workaround for baseband_xmm_power wakelock

Some people have massive issues with tegra3 + cellular devices with the baseband_xmm_power wakelock. The wakelock drains all the battery. With V16 I included a possible fix for this. The fix is based on the work of jfmcbrayer and Sgt. Meow. By default, the fix isn't active and the kernel uses the stock behaviour.

If you want to disable the wakelock entirely, you can flash this zip: CWM_activate_baseband_xmm_power_wakelock_workaroun

I used this this workaround for some time with Android 4.4.4 and I had no issues. Well, I did not test the mobile data... Please tell me, if something isn't working (And the workaround is active). I just wanted to get rid of that battery drain. I was on flight mode all time.


The workaround is enabled by echoing a number into a baseband_xmm_power module parameters:
echo 0 > /sys/module/baseband_xmm_power/parameters/bb_timeout
Possible Values:
< 0 - disable workaround, stock behaviour [Default (-1)]
= 0 - disable the baseband_xmm_power wakelock completely
> 0 - how long the wakelock can stay active, every time the wakelock is triggered, in 10ths of a second. Meaning: Value 5 = 500 ms, 10 = 1 second, 20 = 2 seconds....

You find the patch I used in the actual Patchset. (Included since Android 5.0.2)


(Kernels since v8 are only tested by me for the 3G version (tilapia) - but should also work with wifi (grouper).)

The flash of the kernel shouldn't break anything, but I recommend to backup your system.

Download-Links for grouper and tilapia:
In V11 the kernel modules are placed in /data instead of /system. If you are upgrade from < V11 and you want to delete the modules in /system, you can delete the folder "/system/vorcers_kernelmodules" manually, or you use this CWM-Zip to delete.

Download-Links only for grouper: (try on tilapia at your own risk)
Integration wishes for new kernelmodules to support new hardware are always welcome (you will get .ko's for my kernel)

Have a lot of fun!

Sources: (Mount fix) (Hardboot patch)


Android 5.0.2: g6ff7a51-v16 (2015/01/31)
- Switched to g1e42d16 / android-tegra3-grouper-3.1-lollipop-release
- Added Workaround for the baseband_xmm_power wakelock on tilapia (Please see "Hints and Bugs since V16 / Android 5.0 / Lollipop" for more information)
- NFS and Sound Modules are not loaded anymore by default but can loaded manual via "busybox modprobe nfs" / "busybox modprobe snd-usb-audio".

Android 4.4.4: g1e42d16-v13 (2014/06/06)
- Switched to g1e42d16 / android-tegra3-grouper-3.1-kitkat-mr2

Android 4.4.3: g4776c68-v12 (2014/06/03)
- Updated Grouper and Tilapia ramdisks for Android 4.4.3.

Android 4.4.2: g4776c68-v11 (2014/01/11)
- To save space in /system, the kernel-modules had been moved from /system/vorcers_kernelmodules to /data/vorcers_kernelmodules.
If you want to delete the modules in /system, you can use this zip:
- Nothing else is new

Android 4.4.2: g4776c68-v10 (2013/12/11)
- Updated Kernel Config and Ramdisks. (Both changed in Android 4.4.2/KOT49H)

Android 4.4: g4776c68-v9 (2013/12/10)
- Created separate files for grouper and tilapia (their ramdisk differ, kernel not)

Android 4.4: g4776c68-v8 (2013/12/07)
- Switched to Android 4.4: g4776c68 ; KRT16O (?) ; android-tegra3-grouper-3.1-kitkat-mr1 KRT16S is gee1a0b2 / (?)(?) android-tegra3-grouper-3.1-kitkat-mr0 (?)(?)

Android 4.3: g1e8b3d8-v7 (2013/09/01)
- Modules Support for Android 4.3
- Packed all modules inside zip...
- I go back to the old version scheme and only count up the numbers...

Android 4.3: g1e8b3d8-v6 (2013/07/29)
- Forgot somehow UTF8
- Really added /proc/config.gz

Android 4.3: g1e8b3d8-v5-km-v4 (2013/07/25)
- Switched to Android 4.3: g1e8b3d8 ; jwr66v ; android-tegra3-grouper-3.1-jb-mr2
- This kernel has also: /proc/config.gz and an loadable module support (Stock has not)
- I also provided the patchset I used for Android 4.3

Android 4.2.2: g05b777c-v4-km-v2 (2013/02/19)
v4-Kernel (
- Switched to different version schema: boot-grouper-vorcers-<android-kernel-hash>-v<count of changes of kernel (overall)> ; For the kernelmodules it is: kernelmodules-vorcers-<android-kernel-hash>-v<count of changes of kernel-modules (overall)>. This means for you: if the number is higher, there is something new Version-Number at Changelog: <android-kernel-hash>-v<count of changes of kernel (overall)> -km-v<count of changes of kernel-modules (overall)>
- Added init.d (/system/etc/init.d/) support to the kernel/init.rc. If the directory exists, the scripts inside the directory get run via "run-parts" from busybox. This means: The script need to be runable (+x) and mustn't have an file-extension.
- Removed the mount of /mounts out of init.rc (is now in an script called by init.rc)
v2-Kernelmodules (
- Made a CWM flashable package which autoloads the modules in my kernel.

Android 4.2.1: v3 - : (2013/02/15)
- Switched to Android 4.2.2 - Kernel, jdq39, g05b777c, android-tegra3-grouper-3.1-jb-mr1.1
- Added Modules for OTG-USB-Sound (see kernelmodules*.zip)
Android 4.2.0: v2 (2013/01/19)
- I added a tmpfs mount for /mounts, so you don't need to do "mount -o remount rw /" and create your inital-mountpoint yourself. /mounts is writeable by all apps. (done in init.rc)
Android 4.2.0: v1 (2013/01/19)
- inital release

SuperSU Information:

Information for SuperSU Users

It seemed that SuperSU >= 1.50 && < 1.65 doesn't work correctly with this kernel. Well, the Version 1.65 seems to work again (The folders where empty after mount). The SuperSU Version 1.45 worked the best. If you want to use 1.45, you can download the old Flashable-Version here:

As I said, the version 1.65 seems to work again. It maybe can happen, that the folders gets empty, after some time. This has been noticed with Version 1.60. But 1.65 not (yet).

If you still have problems with the empty folders on my kernel, you should try superuser by koush.

koush's superuser is opensource and is the same as in cyanogenmod. And with that, the mount-technique is working without bugs:

Some gimmick: One"click"mount-Shell-Script

Because I want to get rid of stickmount, I written a little shell-script to mount all connected devices. It is very similar to stickmount, but it supports: ext, fat32, ntfs. Well, ntfs only, if you provide the path to an ntfs-3g binary. (In the variable NTFS_BINARY) I used in the script the paragon-ntfs binary. Just install the Paragon-App.

Download V2.2:
Download V3:

glimmling created a tasker apk for this script. I but it still bases on v11 of the script.
  • from v3 on, ocm needs -m parameter. If you want the old behavior, use "-m auto"
  • from v3 on, ocm also mounts /dev/block/sdX partitons (e.g. /dev/block/sda), but only if my script can use a busybox with blkid with TYPE output. (I provided one)
  • I added in v3 an fstab-like future usable with -f <file> see my example.
  • Please be careful with the new v3. I works, but I would call it "beta"...
  • You can't run ocm >= v3 inside /mnt/sdcard. All files (except for ocm.fstab and ocm-library) need the x right. Copy the files too /data/local/, "chmod 777 *" them and run ocm from /data/local.
example for ocm.fstab.
<device> <mountpoint> <fs-type> <options>
It is is very importent that the options seperated by one space!
// username cifs username=<username>,password=password,ro nfs nfs nolock,ro
/dev/sda1 sda1 ntfs

Thanks to:
mkasick - for the patch
farhanito - for the basic code in the .zip
glimmling - for the tasker apk's running the One"click"mount-Shell-Script
jfmcbrayer / Sgt. Meow - for the baseband_xmm_power wakelock workaround
Last edited by vorcers; 1st March 2015 at 06:43 PM. Reason: fix v16 tilapia link
The Following 21 Users Say Thank You to vorcers For This Useful Post: [ View ]
19th January 2013, 04:07 PM   |  #2  
glimmling's Avatar
Senior Member
Thanks Meter: 83
217 posts
Join Date:Joined: Jan 2011
Hi and thanks for this!

I'm a Linux noob and have some questions.
If I understand it correctly, I don't need Stickmount anymore with your kernel. Do I need to mount an usb stick in the terminal or is there a way to automate this with tasker for example?
What is the correct mount command syntax?

The old way to mount a network share with cifs manager in 4.1.2 I used this guide with external modules:

Can you please show an example configuration for Cifs Manager, when I use your kernel?

Many thanks!
19th January 2013, 04:25 PM   |  #3  
vorcers's Avatar
OP Senior Member
Thanks Meter: 116
146 posts
Join Date:Joined: May 2012
You still can use stickmount. You will see no difference, because stickmount uses the old "debuggerd" method. (Well, I did not test stickmount with the new fix, but it should work...)

For cifs:
I already included cifs in my kernel. You don't need to load them anymore. You can now easy use cifs manager, if you are mounting under /mounts (with the v2 of my kernel)

Here an screenshot of an configuration I use with CifsManager:

It is only important, to use a path in /mounts/. As I tested, CifsManager automatically creates the mount-point inside /mounts/.

It is possible, that applications which doesn't support browsing in file system, can't access /mounts. But some provide an option to the start directory or something like that (OfficeSuite for example) the directory just need to be set to /mounts. This is the reason, why stickmount uses an mountpoint inside /mnt/sdcard ... I am using OI Filemanager. It is a quite nice application. It also supports starting apps with the selected file.

I hope, I could help you.
Attached Thumbnails
Click image for larger version

Name:	Screenshot_2013-01-19-17-20-27.jpg
Views:	31360
Size:	20.8 KB
ID:	1658503  
Last edited by vorcers; 19th January 2013 at 04:36 PM.
The Following 2 Users Say Thank You to vorcers For This Useful Post: [ View ]
19th January 2013, 04:58 PM   |  #4  
glimmling's Avatar
Senior Member
Thanks Meter: 83
217 posts
Join Date:Joined: Jan 2011
AW: [KERNEL][WIFI][4.2.X] Included "Fix for empty app-mounted directories"
Thank you.
Cifs is working for me now, but I want to get rid of stickmount.
Since android 4.2.x I always get empty folders with stickmount, even with the latest version. I want to replace it with a new method. But I don't know the mount command and the device name to mount a standard usb-stick.

mount [devicename?] /mounts/usb ???

EDIT: I replaced stickmount with usb otg helper Now I can see the files of a mounted usb-stick in every app, no more empty folders.

Gesendet von meinem Nexus 7 mit Tapatalk 2
Last edited by glimmling; 19th January 2013 at 06:54 PM.
19th January 2013, 07:10 PM   |  #5  
vorcers's Avatar
OP Senior Member
Thanks Meter: 116
146 posts
Join Date:Joined: May 2012
Ah. I forgot USB-OTG helper. Well, with this app, the mounting of devices already worked without the fix. It also uses the "debuggerd" workaround like stickmount. You will need the kernel-fix only for mounting cifs.

I stay at my new oneclickmount-shellscript, because I want to know what the applications do ^^ I don't trust stickmount and usb-otg-helper...
The Following User Says Thank You to vorcers For This Useful Post: [ View ]
19th January 2013, 07:21 PM   |  #6  
glimmling's Avatar
Senior Member
Thanks Meter: 83
217 posts
Join Date:Joined: Jan 2011
AW: [KERNEL][WIFI][4.2.X] Included "Fix for empty app-mounted directories"
Can you please share your script?

Gesendet von meinem Nexus 7 mit Tapatalk 2
19th January 2013, 07:55 PM   |  #7  
vorcers's Avatar
OP Senior Member
Thanks Meter: 116
146 posts
Join Date:Joined: May 2012
Look in the first post, I attached it there
The Following 2 Users Say Thank You to vorcers For This Useful Post: [ View ]
20th January 2013, 01:55 AM   |  #8  
farhanito's Avatar
Senior Member
Flag Jakarta
Thanks Meter: 225
873 posts
Join Date:Joined: Aug 2010
Re: [KERNEL][WIFI][4.2.X] Included "Fix for empty app-mounted directories"
Thanks vorcers,

Here is flashable zip of v2
Md5= 0394f49ae911ec7a2d7cf845c5916fb6

Hope you can figure out the /storage problem
Every other kernel should implement this fix

Sent from my Nexus 7 using Tapatalk 2
Last edited by farhanito; 20th January 2013 at 01:58 AM.
20th January 2013, 03:26 AM   |  #9  
Senior Member
Thanks Meter: 9
130 posts
Join Date:Joined: Oct 2010
This is a great! Question, since the mount point needs to be outside of /storage and /mnt/sdcard does that mean I can not use this to mount app data? ex. gameloft, etc (using Directory Bind)
Last edited by Doncabezon; 20th January 2013 at 03:30 AM. Reason: more info
20th January 2013, 10:24 AM   |  #10  
Senior Member
Thanks Meter: 1,564
3,831 posts
Join Date:Joined: Dec 2010
It would be really awesome if a fix or hack to this issue (empty directories if app is not launched before mounting) could be found without requiring a kernel patch.

I tried the debuggerd method supposedly used by StickMount and found that it didn't work: app still sees empty mount if its process is started after mount.

Btw, app sees mounts if its process is started before because mounts are propagated in that case. They are just not inherited on process creation due to how zygote spawn app processes and initializes their mounts.

I never understood how hacking debuggerd could work to fix this issue as this is not much different to me than running a shell script invoking adb shell in loopback mode (requires root), since debuggerd and adbd run with identical priviledges:

setprop service.adb.tcp.port 5555
stop adbd
start adbd
adb connect localhost
adb shell mount ....
I've found a workaround that involves hijaking the obb directory by mounting whatever you want over /mnt/shell/emulated/obb. This directory is systematically bind mounted by the Zygote process in <external storage root>/Android/obb (see source code) when it spawns an app's process

Unfortunately this hack is not very usable because it has the side effect that any app expecting its data in the obb directory will not find it. And you can only mount one filesystem here.

Conclusion: with the new 4.2 multiuser support, Google made miserable all apps dealing with mounting.
Last edited by bubbleguuum; 20th January 2013 at 10:31 AM.

Post Reply Subscribe to Thread

4.2, fix, kernel, mount, nexus 7
Previous Thread Next Thread
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes