yashsingh1/xdaforums huggingface dataset:
[Magisk] 白い熊:
I've never used multi—user, but from what you describe I'd venture to say:

Copy the fbind folder from /storage/media/0 to /storage/media/1 or what have you as you've described, edit the conf file—as a minimum specify the proper internal storage and re-login—it should work…
[Magisk] Captain_Throwback:
Isn't the conf file in the module folder? If so, that'll break the binds for the primary user.
[Magisk] 白い熊:
No, the conf file is in the fbind folder on the internal card - that's why I say "copy it" - not "move it".
[Magisk] Captain_Throwback:
I must not be using the latest version, then, because I don't see any conf file to specify a different internal path. I tried installing the 8/30 version from the module repo but it failed to install in the Manager and in TWRP. How am I supposed to specify the change to the path?

EDIT: I see it now. Stupid XDA Labs...

EDIT 2: I'm not sure if this is a module issue, a Magisk issue, or an Android issue, but I'm pretty sure Magisk doesn't run any scripts when you initially switch users. So it may not be possible to bind mount folders for secondary users. I wasn't even able to grant SD Card access in Solid Explorer, so there may be some Multiuser restrictions in Android that don't make this feasible.
[Magisk] anaschillin:
Hi,

I have installed the 2017.8.30 from Magisk Repo, Running Fulmics ROM 3.5 with Asgard 5.7 Rom and I have BusyBox 1.27.1 by osm0sis. I tried to bind WhatsApp and it doesn't work. fbind -mb comamnd ran successfully and seems to have moved some of the WhatsApp data from internal to external (not all data got moved, think this might be related to Whats App already existing on SD-card previous to fbind.) But when I go into WhatsApp no files can be downloaded or displayed.

How do I fix this?

Regards
[Magisk] Captain_Throwback:
[MENTION=5228676]VR25[/MENTION]

Here's a recovery log from my flashing error of 8/30:

Installing zip file '/data/user/0/com.cgollner.flashify/app_tmpfiles/Magic_Folder_Binder_fbind-v2017.8.30.zip'
Checking for MD5 file...
Skipping MD5 check: no MD5 file found
I:Update binary zip
I:Zip does not contain SELinux file_contexts file in its root.
I:Legacy property environment initialized.
Segmentation fault
Archive: /data/user/0/com.cgollner.flashify/app_tmpfiles/Magic_Folder_Binder_fbind-v2017.8.30.zip
inflating: config.sh
**************************
Magic Folder Binder (fbind)
VR25 @ xdadevelopers
**************************
******************************
Powered by Magisk (@topjohnwu)
******************************
- Mounting /system, /vendor, /data, /cache
- Extracting module files
Archive: /data/user/0/com.cgollner.flashify/app_tmpfiles/Magic_Folder_Binder_fbind-v2017.8.30.zip
inflating: .gitignore
inflating: License.md
inflating: META-INF/com/google/android/update-binary
inflating: META-INF/com/google/android/updater-script
inflating: README.md
inflating: common/post-fs-data.sh
inflating: common/service.sh
inflating: common/system.prop
inflating: config.sh
inflating: core.sh
inflating: cryptsetup/arm/system/xbin/cryptsetup
inflating: fbind/config.txt
inflating: fbind/config_example.txt
inflating: fbind/info/changelog.txt
inflating: fbind/update_prep.sh
inflating: module.prop
inflating: system/xbin/fbind
inflating: META-INF/MANIFEST.MF
inflating: META-INF/CERT.SF
inflating: META-INF/CERT.RSA
- /data/magisk.img detected!
- Mounting /data/magisk.img to /magisk
- Copying files
mv: can't remove '/magisk/fbind/system': Is a directory
- Setting permissions
chown: /magisk/fbind/system/xbin/cryptsetup: No such file or directory
Updater process ended with ERROR: 1
I:Legacy property environment disabled.
I:Install took 1 second(s).
Error installing zip file '/data/user/0/com.cgollner.flashify/app_tmpfiles/Magic_Folder_Binder_fbind-v2017.8.30.zip'
Done processing script file

I'm using a Beta version of Magisk Manager, but only this module is giving me an error.
[Magisk] 白い熊:
I think it has to do with the fact that you're installing the zip via Flashify - it segfaults in the beginning, don't know what's going on there, than it fails moving the files during installation - the install script seems fine to me. You should try installing via TWRP and then use Magisk 13.3, not beta to see if it behaves differently.

---------- Post added at 07:03 AM ---------- Previous post was at 07:00 AM ----------

Check the error log for mount errors - it'll say what went wrong. Also, in Marshmallow - don't know what your ROM base is, you need the “Marshmallow SD Fix” Xposed module to make individual apps be able to read the mounts - as per my post in this thread some time ago...
[Magisk] anaschillin:
Hi where is the mount log? I am Nougat 7.0base
[Magisk] 白い熊:
In the fbind folder on the internal memory card.

---------- Post added at 07:14 AM ---------- Previous post was at 07:14 AM ----------

Might be the same for Nougat as for MM - don't know - post the log, we'll see there...
[Magisk] Captain_Throwback:
Like I posted before, I already tried in TWRP and it also fails. That means the version of Magisk shouldn't be the issue. The seg fault also isn't an issue and is expected.
[Magisk] anaschillin:
Attached the log.
[Magisk] 白い熊:
It's mounted all right—no problems there.

I'd recommend:

— unmount everything in the terminal: “fbind -u”

— move the rest of the files that didn't get moved by hand from /data/media/0/WhatsApp to /mnt/media_rw/352E-1A09/.fbind/WhatsApp

— Install the “Marshmallow SD Fix” Xposed module

— Reboot

— In the “Marshmallow SD Fix” select WhatsApp and enable it

— Reboot

I think there's a significant possibility it'll work then :eek:)
[Magisk] VR25:
1. No, files are shown as if they were on both sides (duplicates), but in actuality, they're present in the extsd only. Just before the bug you reported, though -- that wasn't the case.

2. Not sure what you mean by "migrate data" in this context. Re-creating the source folders automatically, based on the existing data in the extsd -- is that it?

3. It's safer & more noob friendly there. Array implementation is possible, but not globally (it'd create a mess in certain cases & originate new bugs). It's better suited for the simpler sub-engines such as "target" & some of the cleanup functions (I'll actually implement that into these).

4. About "obb"... I rather keep that a secret. :rolleyes:

5. My bad... I may've picked the wrong names to describe those. By nasty files/folders, I mean those which are created & recreated undesirably and in unwanted places (similar to a virulent behavior).

Right. I just felt a bit busy & lazy at that time... :p

Now I'm sure I misunderstood part of what you actually would like to achieve ( ...or I've been a bit headless these days). So, this time, I'm asking for extra details, and if possible, a direct collaboration -- hands into code... (or feet, if you prefer!). ;)
[Magisk] VR25:
[MENTION=1162986]Captain_Throwback[/MENTION], I'll test multi-user support in the upcoming versions. As stated by [MENTION=4237286]白い熊[/MENTION], it should already be working, though (with alternate intsd path set). Anyway, as you suggested, that may not be an issue with the module.

The segfault is odd...

have you checked to make sure the zip archive is not corrupted?

Now, to the second part of the error... that really shouldn't have happened.

It points to lines 149-152 in the update binary.

[ -f /data/_f ] && rm /data/_f || mv $INSTALLER/system $MODPATH
if [ ! -f /data/_f ] && [ "$ARCH" = "arm" -o "$ARCH" = "arm64" ]; then
[b]mv $INSTALLER/cryptsetup/arm/system $MODPATH[/b]
fi

Changing LN151 to "mv $INSTALLER/cryptsetup/arm/system/xbin/cryptsetup $MODPATH/system/xbin" would/may solve the mv error, but again -- that can't be the real issue here.
[Magisk] Captain_Throwback:
I'll make the change to the update binary and see what happens. I've downloaded the zip multiple times so I don't believe it is corrupt. The segfault might seem odd, but per [MENTION=4470081]topjohnwu[/MENTION], it is expected.
[Magisk] SONiX-GERMANY:
Few days ago i switched from iSu ( great app ) to Magisk and found your module, great work. I'm familar with foldermount, link2sd and so on, but i'm not a pro. Everything went fine, config, move, mounts ( from_to command ). Now i'm a little bit unsure, what exactly does the "target" command do? I'd add the following line to my config.txt:

target Android/data

to link the whole folder from int to ext.

Thanks in advance!

ROM:

SGS4 lineage-14.1-20170901-UNOFFICIAL-jfltexx with 16GB extSD

LOS devices: Xperia Z, Xperia Z2, SGS4
[Magisk] Captain_Throwback:
[MENTION=5228676]VR25[/MENTION]

Changing that line got the zip flashing in recovery. It doesn't flash in the latest Beta of Magisk Manager, but [MENTION=4470081]topjohnwu[/MENTION] indicated it may be a compatibility issue (?).
[Magisk] Mx WaR HaBiB:
[MENTION=5228676]VR25[/MENTION] I already reviewed it ... and it works correctly, thank you very much for creating the module. :D

in every reboot I have to bind the folders :confused:

that is not clear to me

Thanks again.
[Magisk] VR25:
I see...

Try the following:

1. Backup your config.txt file

2. Remove "fbind/update_prep.sh" scrip from the zip

3. Go for another try

I'm aware that Magisk Manager crashes with certain commands/operations, especially the more complex/resources intensive type. Not sure why that is.

Sourcing files can be a problem at times, handling data stored somewhere other than the sdcard or internal storage may break things. Oftentimes even a mere exit code 1 causes Magisk Manager to FC.
[Magisk] VR25:
"target" is intended for binding default, non-media containing folders. What do I mean by "default folders?" Well these are directories whose paths are the same on both storages (i.e., intsd/Android/data & extsd/Android/data, intsd/data & extsd/data, intsd/projects & extsd/projects). You really wouldn't want to change the locations of any of these -- and since they aren't media folders, you don't need a hidden(dot) folder to avoid duplicates. Therefore, to make things easier, you use "target" to bind these whitout specifying the destination. "target Android/data/AppFolder" binds intsd/Android/data/AppFolder to extsd/Android/data/AppFolder. In simpler words -- same path (Android/data/AppFolder), only one argument needed (target Android/data/AppFolder. Hope that helps! ;)

You're welcome!

Bindings are automatic once you define them in the config.txt file.
[Magisk] anaschillin:
Problem is Xposed is not available for Nougat yet, There is nothing similar out for Magisk. Seems like the link is created but for some reason WhatApp cannot write to it. Almost a permission issue. I tried SD Write Access Enabler Nougat module for Magisk but that doesn't seen to work either
[Magisk] Nightwing0815:
oookay, here we go... :)

to 1: sad... would be better, when the empty ones are removed, if possible?

to 2: migrate / merge: copy folder x from intsd to extsd AND DO NOT OVERWRITE EXISTING DATA

to 3: kk, sounds understandeable :P

to 4: i begin to understand... kinda illegally for some games etc... noticed!

to 5: kk, noticed.

i have a different problem, something's not working at all...

is this pre-alpha, isn't it? :p:p

my cfg:

from_to -e Download Download
from_to -e MagiskManager MagiskManager
from_to -e WhatsApp WhatsApp

target TWRP/BACKUPS

kill -i Podcasts
kill -i com.cmcm.whatscalllite
kill -i Documents
kill -i Movies
kill -i Music
kill -i Android/data/.um
kill -i _nero_sync
kill -i com.emoji.keyboard.touchpal.oem_ACache
kill -b

eeh, TARGET does mean what exactly? :confused:

and heres the debug:

Mon Sep 4 23:43:49 CEST 2017

>>> update_cfg()
- No updates found.

SD Card Information
/dev/block/vold/public:179,65 /mnt/media_rw/9C33-6BBD texfat rw,dirsync,nosuid,nodev,noexec,relatime,uid=1023,gid=1023,umask=0007,allow_utime=0020,codepage=437,iocharset=utf8,min_prealloc_size=64k,max_prealloc_size=122591k,writeback_boundary=4M,readahead=4M,fail_safe,discard,hidden=show,errors=continue 0 0
/dev/fuse /mnt/runtime/default/9C33-6BBD fuse rw,nosuid,nodev,noexec,noatime,user_id=1023,group_id=1023,default_permissions,allow_other 0 0
/dev/fuse /storage/9C33-6BBD fuse rw,nosuid,nodev,noexec,noatime,user_id=1023,group_id=1023,default_permissions,allow_other 0 0
/dev/fuse /mnt/runtime/read/9C33-6BBD fuse rw,nosuid,nodev,noexec,noatime,user_id=1023,group_id=1023,default_permissions,allow_other 0 0
/dev/fuse /mnt/runtime/write/9C33-6BBD fuse rw,nosuid,nodev,noexec,noatime,user_id=1023,group_id=1023,default_permissions,allow_other 0 0

>>> bind_folders()
mkdir: 'Download': Read-only file system
mkdir: 'Download': Read-only file system
mount: 'Download'->'Download': No such file or directory
mkdir: 'MagiskManager': Read-only file system
mkdir: 'MagiskManager': Read-only file system
mount: 'MagiskManager'->'MagiskManager': No such file or directory
mkdir: 'WhatsApp': Read-only file system
mkdir: 'WhatsApp': Read-only file system
mount: 'WhatsApp'->'WhatsApp': No such file or directory
[/data/media/0/TWRP/BACKUPS] <--> [/mnt/media_rw/9C33-6BBD/TWRP/BACKUPS]
mount: '/mnt/media_rw/9C33-6BBD/TWRP/BACKUPS'->'/data/media/0/TWRP/BACKUPS': No such file or directory
- Done!

>>> cleanup()
Stubborn folder [/data/media/0/com.emoji.keyboard.touchpal.oem_ACache]
Nasty [Android] folders
- Done!

i don't really know, whats the matter...

ToM
[Magisk] SONiX-GERMANY:
What an explicit explanation! I'm clear now, many thanks!
[Magisk] jeviooro:
Hi, I'm new here and after reading all the thread I have doubts. I use Open Camera for photos and save them in the SD, I have android 7.1.2. I have managed to do it but the directory in the internal memory still keeps the images, can this directory be deleted? Thank you
[Magisk] Captain_Throwback:
The Manager doesn't crash/force close - the zip just fails to install. With the update_prep.sh in the zip and without it, the zip just fails to install.
[Magisk] VR25:
Have you read the README's debugging section? That might shed some light onto your issue.

1. That's how folder binding is supposed to work. It's as if both directories (source & destination) shared the same files. The opposite isn't a bond.

fbind has a function to swap storages and another to disable the intsd & replace it by extsd (external becomes internal & the original internal is disabled). That's all work in progress, though (2. as well).

Back to 1., the way android mounts intsd & extsd has changed significantly since Lollipop -- hence the delay in figuring out how to fully bypass the limitations imposed by these changes.

About version status...

Alpha was tested in-house only, a LONG time ago...

Beta was the one being discussed here until recently.

So, current_status=stable (with some, but properly documented experimental features -- like the ones above).

Now, jumping into your problem...

You're not supposed to use "from_to -e for that." It has a totally different purpose! Check the README and/or config_example.txt (intsd/fbind/info) The latter is great for lazy folks! :p

Assuming you've already moved the files (either manually or with "fbind -mb"), you should find the answer on point 1 above.
[Magisk] VR25:
I've been working on it for a while. Will push a new version soon.
[Magisk] VR25:
[MENTION=4237286]白い熊[/MENTION] , there was an error in the kill switch preventing "from_to -e" cleanup.

Also, I've properly implemented cryptsetup now. Can't test it myself at this time, though.
[Magisk] Nightwing0815:
hmm, okay... a little bit stupid, i think...

okay, glad you recognized my sense of humor :P

Does not change anything, the missing -e parameter. whatsapp folder are now on int AND ext, but not all files are transfered...

That's weird... i think, an init.d script with a symlink should work better, for what i need?

ToM
[Magisk] Mx WaR HaBiB:
[MENTION=5228676]VR25[/MENTION] good day, you could support me in explaining what difference there is in linking two folders:

1.- from_to Android/OBB/Gamexx Games/Gamexx

and

2.- obbf Gamexx Games/Gamexx

link a game folder as the first example but when I enter the game does not allow me to play it until I download it again OBB data :( as I had already moved with "fbind -mb"

thanks for your time. :fingers-crossed:
[Magisk] 白い熊:
You have the permissions issue on mounted folders — as discussed above. On MM this is solved via the “Marshmallow SD Fix” Xposed module. On Nougat there currently isn't a stable official version of Xposed, so either there is some app that fixes it, or else no solution so far.

What's happening with you is that the game is redownloading the data to the non—bindmounted directory, so if you unmount it, you'll see the data is there again, so you're not achieving any space savings by moving the data…
[Magisk] Mx WaR HaBiB:
Thanks for your answer, you tell me that I can have xposed with Magisk :confused:

I understand that you can not, if this can be done you could tell me how?

because that module I suppose that it is only in xposed.

Thanks again for your time. :cowboy:
[Magisk] VR25:
[MENTION=1162986]Captain_Throwback[/MENTION], I figured the combination of Magisk v13.6+ & template v4 is the culprit. Tested template v3; it still works fine (if not better), even in the latest Magisk Manager. Will downgrade the template and call it a day.
[Magisk] Captain_Throwback:
You might want to check the Magisk release thread before calling it a day; the template has been updated, hopefully with better support for whatever the issue was in the current version. Your module won't be supported on the old template version. If this issue persists then you should definitely bring it up with [MENTION=4470081]topjohnwu[/MENTION] rather than just reverting.
[Magisk] 白い熊:
Yes, on MM this is easy—I have it set up, no issues. If you read the Magisk forum somewhere there is a link to Xposed Magisk module, with explanation how to set it up…
[Magisk] 白い熊:
[MENTION=5228676]VR25[/MENTION], I looked into the permissions thing and why the mounts can't be accessed. On MM you need to add “<item name="android.permission.WRITE_MEDIA_STORAGE" granted="true" flags="0" \/>” to the <perms> section for each app in /data/system/packages.xml

That's what “Marshmallow SD Fix” does I've determined.

I'd guess on Nougat the same or similar conf file is used.

So my idea was to add a let's say “perms” variable to fbind.conf with the package name as the parameter.

You'd then iterate through these, modifying and storing the packages.xml to a temp location and then bindmounting it over /data/system/packages.xml

So, to test, I tried a dirty script:

APPTERM='<package name="'$1'"'

FIRST=`cat packages.xml | sed ':a;N;$!ba;s/\n/XXXXX/g' | sed "s/\(.*$APPTERM\).*/\1/"`

SECOND=`cat packages.xml | sed ':a;N;$!ba;s/\n/XXXXX/g' | sed "s/.*$APPTERM\(.*\)/\1/" | sed 's/\(<\/perms>.*\)/<item name="android.permission.WRITE_MEDIA_STORAGE" granted="true" flags="0" \/>XXXXX\1/'`

FULL="$FIRST""$SECOND"

FILE=`echo "$FULL" | sed "s/XXXXX/\\\n/g"`

echo $FILE

If you copy the packages.xml to the PC and run the script with:

./test.sh com.spotify.music

it works properly and adds the needed line to Spotify permissions. The problem is that, since it's so dastardly, and ineffective it'd run forever on the slow phone, doesn't work — you'd need to run an intelligent field substitution via awk maybe, or even Perl etc.

Then the question is whether fbind would mount the file fast enough on boot, so that the permissions would be read.

Maybe I could test it with an “-e” mount with a hand edited test version of the packages file.

Think you can rewrite the substitution script? I've never really used awk, Perl also not much, so it'd be slow before I get it — but via this we could remove the access permissions problems for everyone on MM and Nougat.

And I could finally look at the “rogue” files exception thing…
[Magisk] 白い熊:
[MENTION=5228676]VR25[/MENTION], so I looked at in and it seems awk is the right tool for this—it's good for structured data.

But I have to learn awk programming for this, so it'll take a couple of days, since I've no time now, unless you can do it easily…
[Magisk] VR25:
Correct. I've actually figured out what was ringing the bell the wrong way & bashed that idea right away. It's not a final solution, just a workaround (but a fully working one). I'll take a look at topjohnwu's latest goodies once I get some spare free time. Check out the new version below.

Nice job in figuring that out (as always) :highfive:

I've been busy lately too, but I'll see what can be done.

Just passed by to push this...

# v2017.9.9

- Massive overall optimizations

- Fixed permission issues when creating folders in extsd_path (not altpart) with Linux filesystem.

- Optimized "move_data" function.

- Fixed update binary errors (actually, these weren't errors at all, but fully working code misleadingly reported by Magisk v13.6+ as "bad").

- Fully implemented fbind -dd & -r options. Run "fbind" for info on what these do.

- Array style cleanup function

- Non-existing intsd folders are now created automatically as well (very helpful across internal storage wipes -- assuming a config.txt backup exists).

Will update the repo soon.
[Magisk] koko115:
2017.9.9 no work on my s8+

2017.9.5 works ok
[Magisk] 白い熊:
Yep, there seems to be an unfinished loop again happening in 2017.9.9.
[Magisk] 白い熊:
[MENTION=5228676]VR25[/MENTION], you should upgrade to v4. Stable Magisk is at v14 now, and your latest working version 9.5. fails on flash while chmodding the files—it still works, but wrong permissions might cause some unforeseen problems.
[Magisk] Captain_Throwback:
The new template for v14 is v1400.
[Magisk] tau.gi.mo:
I installed 2017.9.9 through MagiskManager, it crashed on setting permissions. But the module was available in MagiskManager, after a reboot I edited the files on internal storage and tried to run the fbind -mb with terminal emulator but it shows error that the sh does not exist. What is wrong? Do I have to set some permissions manually?

Enviado desde mi Redmi Note 2 mediante Tapatalk
[Magisk] 白い熊:
Sorry about the mistake, I meant v1400.

[MENTION=5228676]VR25[/MENTION], I'm testing cryptsetup behavior now - all against v9.5. The cryptsetup binary isn't copied on install from the arm subdir to fbind/system/xbin/ - don't know if that's due to the fail on install due to the old template, shouldn't be though, since it first copies the files, then changes permissions. Copied it manually now and will test further.

---------- Post added at 11:40 PM ---------- Previous post was at 11:30 PM ----------

line 523 of core.sh should be:

PARTITION=$(echo $1 | sed 's/.*\///')

You've got a wrong sed command in the script, which makes the sed fail...

---------- Post added at 11:44 PM ---------- Previous post was at 11:40 PM ----------

Very strange - I rezipped the module with the two changes above, using its template and it installs without failing on chmodding. ???

---------- Post added 9th September 2017 at 12:06 AM ---------- Previous post was 8th September 2017 at 11:44 PM ----------

The cryptsetup binary in your module differs from the static one I posted - it fails with an illegal instuction...
[Magisk] 白い熊:
Unbelievable! On my system I have Toybox utils by default, I didn't install it, linked to /system/bin - thus sed and stuff defaults to these and Toybox is messed up - it doesn't carry out proper substitution - thus line 523 should be:

PARTITION=$(echo $1 | /system/xbin/sed 's/.*\///')

this is the same for all other sed commands, affects also e2fsck which I had to manually prefix with xbin.

to make it default to Magisk installed Busybox - this should be a recommendation - maybe also a config item, so that all Busybox utils are prefixed with the proper Busybox location.

---------- Post added at 01:48 AM ---------- Previous post was at 01:47 AM ----------

I don't have any additional script - I'm fixing [MENTION=5228676]VR25[/MENTION] 's script now, it's almost fully working.