yashsingh1/xdaforums huggingface dataset:
[Magisk] Hooin Kyoma:
Is this project discontinued? Last update almost a year ago.

Ok, I downloaded latest version (2019.1.23) and installed it on my Lineage OS 17.1 (Android 10) with Magisk v20.2, and... spent two days for manage it to work... Meh, it'd be better to not even start.

Fist of, it simply hasn't been installed properly on my system (no binaries, no scripts, only info/config examples), so I downloaded latest update-binary, saved it as is (without modifications), and manually converted config.sh to install.sh (using aka "legacy script" logic) (fix1-fix2) customize.sh (fix3).

Secondly, fstype binary doesn't detect FAT (vfat/exfat/sdfat) on my system, so I added extra check to part() function in core.sh: in case if fstype has not detected FS, let mount detect it automatically (omit -t).

Next, grep /storage/emulated /proc/mounts | grep -Eiq ' sdcardfs | fuse ' || exit 1 line in wait_until_true() function instanly exit script on boot, I guess it's because it starts too early on my system. So I replaced "exit" with waiting loop.

After all this modifications and countless hours of tries and errors I finally got what I wanted - move (bind) some internal folders to encrypted second partiton of my external SD card.

/data/adb/fbind/config.txt:

part -o umask=0 /dev/block/mmcblk1p2--L,MyLoNgPaSsWoRd /mnt/sdcrypt
extsd_path /mnt/sdcrypt
target DCIM
target Audio
target TitaniumBackup

I found using umask=0 on FAT is a most painless way to deal with apps permissions to use binded folders. Less secure though. I logically understand that fbind should take care of access to binded folders, but it looks like something changed lately in Android's storage "magic", which is not clear to me, so... umask=0. Tried other mountpoints like /mnt/media_rw/sdcrypt or /storage/sdcrypt, tried ext4 instead of exfat, but all that caused even more problems with permissions. I'd appreciate any advice about better mountpoint and options to use.

Got an infinite bootloop when I used to use FUSE (which is happen automatically when I add something like "intsd_path /storage/emulated/0" in config.txt), thanks god we have TWRP.

I attached modified zip-file in case if anyone interested (not sure If I had right to do this tho, I will remove it if OP or moderators ask), magisk-only.

DISCLAIMER: I'm very new to module coding and coding in general, I'm just an experienced Linux user, so I can't guarantee that my modifications are 100% correct and universal, test it on your own risk.

UPD: new "fix2" version with some fixes.

UPD2: new "fix3" version: magisk 20.4 support and others changes.

UPD3: new "fix4" version: small bugfixes and simplified code (info).
[Magisk] otyg:
Thanks, I'm not sure if VR25 abandoned it, such a awesome module I have been using it since it came out...even works on android 10 (with some mods), so I don't know why he hasn't updated it.

yeah something changed with Magisk 20.2+, it used to install ok on magisk 20.1 , your mod installs on the latest magisk so that's good, it almost worked for me (fixed the exit 1 code, but still failed to mount), I had to add a extra 'sleep 30' delay into service.sh above the "set -x" command- before it runs the main script, now it's working., I guess with android 10 the /proc/mounts doesn't become available until the system is booted? or just a race condition....., but anyways thanks for fixing it up for the latest magisk.
[Magisk] duromx:
Thanks for your fix. A few days ago magisk got updated and the module stopped working, I tried everything without success until I read your post.

I downloaded the zip, installed, and it's working again.

Thank you very much.
[Magisk] fred.lyon:
Thanks! For me also, your fix has reactivated fbind.

:good:
[Magisk] Hooin Kyoma:
I think I found a possible reason why script exits on boot in your system: in case if you're using ordinary SD card as external storage (most common case), in apply_config() function (called from service.sh) "$altExtsd || default_extsd" line will exit script if your SD card not ready/mounted yet. I don't know how to check external media mounting process status in Android, but here is kind of WORKAROUND: explicitly set "extsd_path /mnt/media_rw/<your_card_blkid>" in config.txt. And to be sure that external SD card and sdcardfs mounted before continue, I added wait_until_true is_mounted "$1" to extsd_path() function. This should allow to use this "workaround" without need to modify code and overall a better/more universal approach than just sleep 30 seconds. Need testing though.

Also I modified loop() function (for those who using file as storage instead of device): now it checks presense of /sbin/imgtool before run it (my system don't have it), if not present - use losetup/mount combo to mount file. And added FS type check, thus loop is not limited to ext4 anymore.

Added "fix2" version of modified module to my previous post.

Hope some day VR25 will find a time to sort out all this stuff and released new version =)

-------

Hmm, no, default_extsd should not trigger exit even if your SD card not available on boot, because it consist wait_until_true grep -q /mnt/media_rw /proc/mounts line, which is waiting until both /proc/mounts AND at least one of your external storages became mounted. So I don't know the reason. Need to see your log at least.

But fixes added in "fix2" are still usefull.
[Magisk] freeman_108:
Works with latest Magisk again Thanks.

Your version fix2 works with latest magisk thanks for your effort.
[Magisk] AllesMeins:
/system/bin/sh: fbind: not found

I've been using fbind for a long time but this time I can't get it to work. I recently wiped my phone and did a complete reinstall. And as usual I installed fbind (first per magisk, later I tried it per TWRP as well). There where no errors and the files in /data/adb/fbind where created as usual. I did an reboot but can't get fbind to run. It does nothing, doesn't create any logs, doesn't show up in logcat and if I call it from the terminal all I get is

So I'm guessing something didn't install correctly or is broken somewhere else. But I'm not experienced enough to fix it myself. Any help to track this down is appreciated

I'm using:

lineageOS 16.0 (Thats an Android 9)

fbind-2019.1.23

Magisk 20.3

Magisk Manager 7.5.1

TWRP 3.3.1.0

EDIT:

Found an extremly ugly hack to fix it for me. I read through the install-script and pushed the missing files from the zip to the right place myself. I was surprised but it seems to have worked:

Finaly set the proper rights
[Magisk] wilsonhlacerda:
https://xdaforums.com/apps/magisk/module-magic-charging-switch-cs-v2017-9-t3668427/post81561739
[Magisk] 0LDST4R:
I noticed this too in Magisk 20.3 when i setup a new system. My "workaround" is to flash Magisk 20.1, fbind is working there, then - with fbind installed - do the Update to Magisk 20.3.
[Magisk] android666:
I tried original and modded fbind, installed under Magisk 20.1 also 20.3 (upgraded/direct 20.3), fbind looks to be installed, but does not work with latest Android10 (Lineage17.1) on Sony Xperia Z1C. My ext4 SD is not recognized/mounted.
[Magisk] Hooin Kyoma:
I use my fixed version of fbind (that you can get here) with Magisk 20.3 and latest Lineage 17.1 on my Xperia Z3C without any problems. But I had problems with permissions using ext4, so I switched to exfat. If you use my fixed version, you can attach fbind's config (/data/adb/fbind/config.txt) and log (/data/adb/fbind/logs/fbind-boot-*.log), I will try to manage what's happening. I'm not a developer though.
[Magisk] android666:
Sony X Z1C - Fbind ext4 (LOS17.1)

Thank you for reviewing and advice how to fix my troubles ...
[Magisk] Hooin Kyoma:
Your config is wrong! Read carefully CONFIG SYNTAX section of the first post.

For example, if your SD have only one ext4 partition, your config should look like:

part -o nodev,noexec,nosuid,noatime /dev/block/mmcblk1p1 /mnt/sdcard
extsd_path /mnt/sdcard
target Viber

(this is an example to bind internal Viber directory to same folder on external EXT4 partition)

And I'd recommend to use exfat as a file system on SD partitions, because of problems with permissions. But it's only my experience, may be you will lucky with ext4.
[Magisk] sieger007:
I have ext4 already with data on it and a hardcore Linux.ext4 fan .

Howz this goin with ext4 any FB ?
[Magisk] The_Walking_Playground:
Hi,

Is there a version of this updated zip for the latest Magisk Canary? The existing one fails to install.

TWP
[Magisk] zdoe:
i tried the [MENTION=4703148]Hooin Kyoma[/MENTION] version. the sd card would not mount at all, and the system wanted to format it. and uninstall efforts or restoring twrp-backups would not work and eventually boot-looped the phone.

haven't had time to play with it since, but yes, i depend on fbind and would like it to work.

xiaomi a2 lite, android 9.
[Magisk] android666:
Big thanks for help "Hooin Kyoma", but at this moment I can not continue on Android10 due to: I need phone for daily bussiness, be in touch, use several bussines appl. need more time when i'm not oncall duty.... Curious that on Android9 I did not modified anything, running on default FBind and all worked fine. I'll test ASAP, when I get little time space (run A9 twrp backup, twrp A10 restore, test -> decide continue with A10 or go back to A9).
[Magisk] pR0Ps:
Just tested this on an Xperia XZ1C running LineageOS 17.1 and can confirm it works. Thanks!

Would you be willing to submit a PR to https://github.com/VR-25/fbind with your changes?
[Magisk] chevi7:
Hi. I have mounted to link my Whatsapp Vídeo folder to my SD.

My config.txt:

from_to "WhatsApp/Media/WhatsApp Video" ".fbind/WhatsApp/Media/WhatsApp Video"

Everything all rights but when I try to download a vídeo in Whatsapp, the file doesn't write on SD.

May be I have to give permissions in any folder?

Thanks
[Magisk] Alonso_Quixana:
fbind / MediaScanner

Hi.

I own a Samsung Galaxy S2 mini with Marshmallow 6.0.1. Ever since I use fbind, i have severe problems with it. The mounted folders keep disappearing after a few days. Only a reboot brings them back.

Now I *think* I've found out the reason: one of my folders on the external card contains several Gigabyte of map tiles for navigation, and I mount that to an internal folder (because the app using those is incapable of dealing with the new security restrictions for the external SD enforced in Marshmallow and up). Whenever the MediaScanner / MediaProvider / whatever (I don't exactly know how Android works internally) comes along and tries to 'index' this folder, the mounts break, probably due to the huge amount of files (causes the used space of MediaProvider grow to over one Gigabyte, for which my internal memory is not enough, too).

QUESTION: to solve this, can ANYONE please tell me how to PREVENT MediaScanner / MediaProvider to access this directory? Note: putting .nomedia files in the folders (as it is suggested everywhere on the internet) does *NOT* *NOT* *NOT* seem to solve it, that only seems to prevent the images from appearing in the gallery, but indexing is still done). Does anyone maybe have a patched MediaScanner that really does completely ignore directories that the user does not want to be scanned/indexed, and can tell me how to replace the 'original' app?

When I disable MediaProvider, I also can't use my Ringtones etc. anymore, so that is alas not an option.

Thanks...
[Magisk] sieger007:
For reasons I am still seeking ( & anyone do chip in ! ) you have to

bind mount

entire Whatsapp folder and cant nit pick a subfolder . Most likely this maybe related to the location of temp space where the apps keeps video fragments before the entire file is D/L'ed
[Magisk] chevi7:
In my case it does not matter. I tried it with the entire WhatsApp folder and the result was the same. The new images or videos that enter the phone are not downloaded, and they are always blurred, because they have not been downloaded.

I'm sure I have to give some kind of permission to the SD folder for everything to work, but I don't know how to do it.

Do you mean that after doing the whole process I have to enter this command in the terminal?

bind mount

Is supposed fbind already mount the symbolic link right?
[Magisk] samhhmobil:
Hi everybody,

I'm in trouble installing fbind to an XPERIA-XA2 (pioneer). When running LOS 16.0 the installation with magisk 20.1 was very easy, and it's up and running as it should. Even after the update to magisk 20.3 it worked as it should.

Now I try to migrate to LOS 17.1, and it's impossible to install fbind. Even I'm running it with magisk 20.1 (for safety reason). I tried to install fbind-2019.1.23.zip, then I changed it to _MAGISK__fbind-2019.1.23-fix2.zip from #1663 , neither the original one nor the fix2 does install the necessary files, even if it looks so in TWRP-install. But there is no folder fbind in /system/etc, there is no fbind in /system/xbin, and I cannot create fbind/. in /system/etc (yes, I am root in the shell).

Thanks for any suggestion,

samhhmobil

PS

So the main XA2 will stay in LOS16 until I got fbind working in LOS17.1...

-----------------------------------------------------------------------------------------

EDIT: Problem solved!

It was my fault, to follow the "fix1" and "fix2" Versions above. There's something strange in it.

A clean new install of LOS 17.1, with nano Gapps, and Magisk 20.1(!!!) and at last the original fbind-2019.1.23, ... and -- TADAAA -- it works as it should.

My next step is now upgrading magisk at least to 20.3, better 20.4, and let's see again.

EDIT2:

Update to Magisk 20.3 and fbind even works flawlessly.

Great!

EDIT3;

Update to Magisk 20.4 (actual one)... and... fbind cannot mount any SDcard-folder. Grrrrrrr.....

If someone has any idea how to fix that, it would be great.

----------------------------------------------------------------------------------------------

EDIT4:

I downgraded Magisk to 20.3, and "fbind" is working again flawlessly.

So... my workaround is now to stay with Magisk 20.3 finally, as long as it will work with LOS17.1.
[Magisk] sieger007:
mount -t sdcardfs -o rw, nodev, nosuid, uid=1023,gid=1023,mask=7 /src-path /your-mount-pt
[Magisk] niask:
Hello. I've got a Xiaomi Redmi 6 Pro on a xiaomi.eu firmware (Android 8.1) and I can't make it work. Apps don't have write permissions on sdcard (exFat file system). I tried like this:

part -o nodev,noexec,nosuid,noatime /dev/block/mmcblk1p1 /mnt/sdcard_ext
intsd_path=/storage/emulated/0
extsd_path=/mnt/sdcard_ext
bind_mount $extsd/.DCIM $intsd/DCIM
bind_mount $extsd/.DCIM/Camera $intsd/DCIM/Camera

No luck.

And like this (EAD2-FAA6 is default mount name of my SD):

intsd_path=/storage/emulated/0
extsd_path=/storage/EAD2-FAA6
bind_mount $extsd/.DCIM $intsd/DCIM
bind_mount $extsd/.DCIM/Camera $intsd/DCIM/Camera

Still no luck. What do I do wrong?
[Magisk] Spatry:
Hacky way to install on Magisk...

Fbind WILL NOT install on Magisk 20.4 and I CANNOT LIVE WITHOUT IT!

So I ended up wiping my tablet and reinstalling the stock rom with TWRP recovery.

No unlocked bootloader on my ONN 8". Just used SPFlash tools. Immediately afterwards, I

rebooted into recovery and flashed Magisk-v19.3.zip from their github page. After a restart

and going through the setup sequence WITHOUT internet connection, I opened the Magisk

software (left menu) and manually installed fbind-2019.1.23.zip once done, I ignored the reboot

message and THEN CONNECTED to the internet. On to the main magisk screen for updates to

the manager, then the main binary. Once done, reboot and SUCCESS! fbind appears to work

as expected.

I probably could have saved some trouble if there were a tutorial on installing magisk modules

without the manager or even instructions on repairing the zip files so they will load on new

magisk installations. Anyway... this procedure worked for me and so I thought I would share

my solve... If anyone knows an easier way, please feel free to shed some light on this. Cheers!
[Magisk] samhhmobil:
fbind installs flawlessly with Magisk 20.1.

fbind.works(!) flawlessly with Magisk 20.3.

fbind does not work with Magisk 20.4 (even if it was installed with Magisk 20.1).

So your guide is;

(1) Install Magisk 20.1, reboot and check that it's working.

(2) Install fbind, reboot and check that it's working.

(3) Upgrade Magisk to 20.3, and you'll see that fbind is working flawlessly.

samhhmobil

PS

A fix for fbind to install/work with Magisk 20.4 or newer would be great, of course...
[Magisk] bnwg:
I think the sequence is

- install Magisk (v19 per his case) from recovery

- boot up the device after flashing Magisk

- after booted up goes to Magisk without network connection

- manual install fbind

- no reboot after manual install fbind

- connect internet and finish Magisk setup and upgrade

- reboot and profit
[Magisk] The_Walking_Playground:
Hi,

It should be trivial to put the latest fbind version from the thread into the newest Magisk module template format, and adjust any paths to wherever they may need to point in the latest version. I can try to do this later today, if no one else figures it out before then.

TWP
[Magisk] zdoe:
does fbind work on android 10?

have come to rely on fbind.

maybe this has been answered already, but... does fbind work at all on android 10? somebody have experience on this? i have no problem with using magisk 20.1. if that's what it takes.
[Magisk] The_Walking_Playground:
Hi,

It probably depends on the device, but it works fine for me on Android 10.

TWP
[Magisk] zdoe:
fbind on android 10

cool. thanks.
[Magisk] samhhmobil:
Yes, it works with LineageOS 17.1 (Android 10). I have it running on two Sony Xperia XA2 (H3113 and H4113).

As I wrote before: (1.) install Magisk 20.1 in TWRP, (2.) install fbind in TWRP, (3.) upgrade to Magisk 20.3 in TWRP. If you do it in this order, it works.

samhhmobil
[Magisk] theredbaron1834:
Looking into upgrading my xa2 to 10, but I "need" fbind. Not only do I get confirmation it works on 10, but on my device. Guess I'll start backing up to upgrade.

Also, I saw a post talking about an updated binary, were would I get it, and where would I place it? Will this let me update magisk to current, or stop at 20.3 still?
[Magisk] samhhmobil:
You can use the original fbind 2019.1.23! It's working on my XA2.

With the "updated" binary I did run into trouble, I was unable to install it. I tried it unsuccessfully.

And, yes, install fbind with Magisk 20.1. After successful install you may upgrade Magisk to 20.3. But with 20.4 fbind did not work anymore.

samhhmobil
[Magisk] zdoe:
fbind and android 10

thanks, [MENTION=8300892]samhhmobil[/MENTION]. now i need to get my apps over to 10. i had trouble downgrading magisk. all the uninstall utilities result in a bootloop, and installing the old one over new results in nothing.
[Magisk] theredbaron1834:
I had the same issue with bootloops. Nothing I could do fixed it, outside of the newest Magisk.l which for some reason let me boot.

Which meant no fbind. Yesterday was a hell of a day getting my phone back in working order, ended up having to write a script that runs at boot to do what fbind does. Not as pretty, but does work, and I am on the latest android now.
[Magisk] zdoe:
maybe you could share your script here, just in case...
[Magisk] theredbaron1834:
Its not exactly portable, but a walkthrough of sorts might help others.

Starting from Android with magisk. You need the magisk module "exSDCard access enabler", which gives you a rw mount to use as a bind. Next you need an script boot launcher, as lineage has removed init.d support. After a lot of trouble I found I like "init.d light", which is in the fdroid repos [here](https://f-droid.org/en/packages/x1125io.initdlight/). The next part sucks, but for a autolaunched script to boot, you need to go into magisk settings and change" mount namespace mode" to global. This isn't ideal, security issues and all that. However, this is really all I use root for atm, and the only for it to work I can find without using adb every boot, so I am ok with it.

Now everything is ready for a script. Each phone will be different based on your sd card and wants. However, it will be something like "mount --rbind /mnt/media_rw/XXXXXXXX/Games/ /mnt/runtime/default/emulated/0/Games", with XXXXXXXX is unique to your sd card.

You just get all the mounts you want in a empty file, it "might" need to have the ext of .sh. then copy it to wherever init.d light says (it depends on the phone).

The big issue I have found is it takes about 20 sec after boot to have them mounted. However, it seems to work fine, even have Android bindmounted with no issue so far.
[Magisk] zdoe:
downgrade trouble

well, thanks. as i'm a linux noob, i'm not quite ready to write a script, but yes, i can see this points the right guy to the right direction. since then i've tried a fresh install, but i'm having a load of trouble getting my apps over. twrp backups don't work consistently either. starting to suspect there's something wrong with my phone.
[Magisk] theredbaron1834:
I haven't been able to get twrp backup to work since android 9, so I can't help you there, but if you want help with the scripting, you can PM me and I will walk you though it too.
[Magisk] zdoe:
currently i'm with an unbootable phone. but good to know i'm not the only one with twrp trouble. is there alternatives? on my old android 7 it seemed to work no prob.
[Magisk] theredbaron1834:
For backups, nothing I found works well. I gave up and just reset up every thing. Titanium backup is good for alot of people, but I didn't like it.
[Magisk] zdoe:
for me TiBu works in conjunction of being able to backup the whole system with twrp (RIP). but for example its update.zip function has never worked for me and the ui is unupdated.

now on some stock OS after a factory reset. but fdisk doesn't install. what if i copy its directories from the old phone?
[Magisk] theredbaron1834:
Yeah, don't think that will work.
[Magisk] zdoe:
fdisk alternative

i'm now on stock android 9. fdisk doesn't install, even though i have 20.1 magisk. dunno what to do. apps2sd provided me with binds to internal>external folders without coding myself. on an old version they stick thru reboots, on the latest one they don't.
[Magisk] theredbaron1834:
In magisk manager, install "ExSDCard Access Enabler", reboot, then give me the output of "ls /mnt/media_rw/" as well as the folders you want bind mounted, and I will do get a script done for you. Or at least try :).
[Magisk] zdoe:
very kind of you. but can't install exSDcard access enabler - all the magisk modules fail the same way - "updater process ended with ERROR: 1."

maybe fdisk would also install if magisk would start to play ball...
[Magisk] theredbaron1834:
O, crap, yeah, that's not something I can help with. Sorry.
[Magisk] Androdd:
It works!

First of all I'd like to thank VR25 for the tremendously useful amount of work he has done on this module, then I'll say that I went through similar troubles with Magisk and fbind versions until your quick guide above reassured me, so I thank you too. Now to the point: I was finally able to make fbind work on the following HW/SW platform:

Phone: Samsung Galaxy A5 2015 (SM-A500FU or a5ulte)

System: Android Marshmallow (6.0.1)

Custom Recovery: TWRP 3.1.1-0

Root: Magisk 20.1

fbind: 2019.1.23

I confess that I fiddled quite for a while with the command line options without really understanding all the subtleties, until I finally managed to get the stuff working: I followed the configuration sample, made use exclusively of the wizard, and contented myself with the following very simple config file:

from_to "DCIM" ".fbind/DCIM"

from_to "Download" ".fbind/Download"

from_to "Pictures" ".fbind/Pictures"

from_to "Studio" ".fbind/Studio"

The main difficulty was to understand what to move, where and when, especially with WhasApp, moving which to the SD card was my main goal: I am not sure whether "fbind -M" has problems with this version or it was me who was not employing it timely, but in the end some good ol' "mv" here and there saved the day and now I enjoy a lot more space on the internal memory of this ol'boy :)

Next step will be evacuate as much stuff as possible from the internal memory of my woman's overbloated SM-J730F which is still under warranty :p