yashsingh1/xdaforums huggingface dataset:
[Android Software Development] hurray:
I just made a quick try from the new v2.7b:

********* start 20160608115927 **********
Detecting busybox
found in /system/xbin
Mount system RW
finished
Add permissions to apps
/system/etc/init.d/99_ExtSD_fix_v23[68]: /data/system/packages.xml: can't execute: Permission denied
finished
Write changes back to file
finished
Remove temporary file
finished
Adjust permissions
finished
Mount system RO
finished
********* end 20160608115928 **********

The system boots normally and it seems that there are no changes apllied.

The script is in /system/etc/init.d and the rights look correct: Permissions on "755" and owner at "UID:0 root" and "GID:0 root"

The file you want to modfiy is listed as:

/data/system/packages.xml Permissions "660", Owner "UID: 1000 system", "GID: 1000 system"

I hope that helps a little bit.
[Android Software Development] DarkSJ1998:
U should also delete the file placed in init.d

I had the same issue yesterday morning... I restored the packages.xml & deleted the init.d file and I successfully came out of the Boot loop :)
[Android Software Development] rufus.wilson:
Could you try the attached script and give me the log file written to /sdcard/ExtSD_Fix_check.log?
[Android Software Development] oberworld:
[MENTION=6935794]rufus.wilson[/MENTION] Of course i'll test in a while and send you log.

1. With 2.7b you don't need to change permissions, it's ok.

2. No, still not working.

3. Yes, the RW-bak file is created and the packages.xml is ok (no 0 byte file).

4. Flashed in clean install backup.

The permission denied error has nothing to do with the init.d file permissions.

So be patience i think the fix progress is good.

Regards.
[Android Software Development] oberworld:
[MENTION=6935794]rufus.wilson[/MENTION]

I'm unable to find log on sdcard, so i edited the line "lf=/sdcard/ExtSD_Fix_check.log" to "lf=/data/ExtSD_Fix_check.log"

Log file attached at end of post.

Thanks.
[Android Software Development] rufus.wilson:
It seems that I made a typo in the code... Could you try this one as well?
[Android Software Development] oberworld:
Testing in a while.

[MENTION=6935794]rufus.wilson[/MENTION]

Edit: New log file attached.
[Android Software Development] oberworld:
[MENTION=6935794]rufus.wilson[/MENTION]

I forgot to say my rom is pure AOSP 6.0 but i modified the boot.img to add init.d support .

So it's pure android, the rom doesn't have any manufacturer stuff, apps or frameworks.
[Android Software Development] vhick:
V2.7b is not working for me. Only script that manually installed in init.d with 755 permission is working.

Using DU in redmi 1s.
[Android Software Development] jembot:
Confirming this fix works on Samsung Galaxy Note 4 (SM-N910C) MM 6.0.1, Near Stock TW (eRobot v4.0).

This fix should also work on Stock Note 4 MM TW ROM.

Thanks!
[Android Software Development] Vishal Vignesh:
How did you test it....
[Android Software Development] jembot:
Are you serious? This is an ExtSD write fix, therefore, you try to copy/move files to your External SD--it should work without the need for explicitly enabling "Write Access" for ExtSD for every app that needs it.
[Android Software Development] Vishal Vignesh:
Test it this way..... If you use any downloaded like utorrent or ADM or even downloading using any browser... Try setting the download location as the external card in the root folder......

If it works it is a success.....
[Android Software Development] Tecalote:
Hello, I have a question - you say, the external SD in the root folder. There are different paths, which one is the right one: /mnt/ext_sdcard/ or /mnt/media_rw/2963-17F4/ or /storage/2963-17F4/

Thank you for answering :)
[Android Software Development] Vishal Vignesh:
The third one.... Of you are using cm file manager, open the sidebar, then SD card then in the root of storage or you can create a folder called downloads in SD card and select there.....

If it says not possible or grays it out, then sorry to say not a success.

---------- Post added at 06:37 PM ---------- Previous post was at 06:36 PM ----------

The third one.... If you are using cm file manager, open the sidebar, then SD card then in the root of storage or you can create a folder called downloads in SD card and select there.....

If it says not possible or grays it out, then sorry to say not a success.
[Android Software Development] hightension:
On 2.7 after reboot many apps disappear like WhatsApp Facebook Firefox. I had to reinstall them
[Android Software Development] Andycar:
Had this issue a while ago, when I was trying v.2.1b I think.

Looking into /data/system/uiderrors.txt I also found that system cannot write to packages.xml error. Maybe because of that.
[Android Software Development] madhero:
I have previously brought up this issue in thread. Even after replacing with the backup packages.xml the issue remains. Now I'm thinking of reflashing my rom to get rid of the issue.

Separate thread that the issue was also brought up in, but no fix.

http://xdaforums.com/showthread.php?t=3381044
[Android Software Development] Hemphiz:
Thanks for this. Working brilliantly on Ulefone Power 6.0
[Android Software Development] rufus.wilson:
Why do you need to manually install the file in init.d?
[Android Software Development] rufus.wilson:
How did you do that??

Which version?
[Android Software Development] rufus.wilson:
It may have been linked to permission/ownership problem on the platform file. I have changed them to be the same than the original file. It may be fixed now... I am about to release a new version with a lot more logging to help me understand what is going on and wrong (could not do it yesterday, XDA was inaccessible...)
[Android Software Development] vhick:
The script is originally made by [MENTION=4685728]futchy4u[/MENTION]

Not the one that came from the flash file.

It always work for me.

I experienced boot loop in v2.7b
[Android Software Development] rufus.wilson:
OK. Thanks

If you just use the script, you have bootloop?
[Android Software Development] :No-Frost::
I'm learning java... If possible, I will try to create an Xposed module with this fix, but it will take me some time
[Android Software Development] rufus.wilson:
It should not be too difficult as long as there are some event callbacks for app installation and/or updates. It would be nice if the inputs of the callback contain the name of the package, you would be able to only modify the XML using a suitable Java parser.
[Android Software Development] CyberCaptainKaz:
If I flash this zip can I move apps to sdcard??

Or does flashing this zip allows apps read sdcard? By that I mean say for eg. titanium backup can backup apps directly on sdcard.
[Android Software Development] vhick:
I didn't try it yet. I just try your flash file when you have a release. In my case, no zip file is work above v.1.9b in redmi 1s. Always on bootloop so I'm going back to [MENTION=4685728]futchy4u[/MENTION] script with 755 permissions. I will try the script coming from your zip file if ts working when manually put in init.d folder. I will give a feedback later.
[Android Software Development] rufus.wilson:
I have just uploaded a new version v2.8b. Thank you for testing!

Download latest - MD5 checksum​

When you report could you specify the version you use? The logs will be stored in:

during flashing: /data/ExtSD_Fix_RW_inst.log

during boot: /data/ExtSD_Fix_RW_initd.log
[Android Software Development] petrmelis:
Titanium Backup can backup apps directly on SDcard without this hack.
[Android Software Development] WILMANS2M:
yep but more tricky than just choosing internal or external

Envoyé de mon SM-G903F en utilisant Tapatalk
[Android Software Development] oberworld:
Previous versions detects busybox but not this one, here is the full copy of ExtSD_Fix_RW_initd.log:

********* 2016/06/09 **********
Detecting busybox
not found

I checked and busybox file still exist on \system\xbin\

Attached ExtSD_Fix_RW_inst.log at end of post

Regards.

EDIT:

i have modified your init.d file this way to make busybox work, i think it's correct:

#!/system/bin/sh

LF=/dev/null
LF=/data/ExtSD_Fix_RW_initd.log

rm "${LF}"
touch "${LF}"

exec >> "${LF}" 2>&1

echo "********* $(date -u +%Y/%m/%d %H:%M:%S) **********"

is_mounted() {
if [ ! -z "$2" ]; then
busybox cat /proc/mounts | grep $1 | grep $2, >/dev/null
else
busybox cat /proc/mounts | grep $1 >/dev/null
fi
return $?
}

set_perm() {
busybox chown $1.$2 $4
busybox chown $1:$2 $4
busybox chmod $3 $4
busybox chcon -h u:object_r:system_file:s0 $4
busybox chcon u:object_r:system_file:s0 $4
}

copy_perm() {
busybox chown --reference=$1 $2
busybox chown --reference=$1 $2
busybox chmod --reference=$1 $2
busybox chcon -h --reference=$1 $2
busybox chcon --reference=$1 $2
}

fpath_ori="/data/system/packages.xml"
fpath_bak="${fpath_ori}-RW.bak"
fpath_tmp="${fpath_ori}-RW.tmp"

# mounts system as rw
if (! is_mounted /system rw); then
echo "Mount system RW"
busybox mount -o rw,remount /system
echo "finished"
fi
if (! is_mounted /system rw); then
echo "Mount again system RW"
busybox mount -o rw,remount /system /system
echo "finished"
fi

echo "Add permissions to apps"
busybox awk -e '/<perms>/ {pMS=1;pES=1} ;
pMS && /WRITE_MEDIA_STORAGE/{pMS=0} ;
pMS && /<\/perms>/{print " <item name=\"android.permission.WRITE_MEDIA_STORAGE\" granted=\"true\" flags=\"0\" />";pMS=0;} 0 ;
pES && /WRITE_EXTERNAL_STORAGE/{pES=0} ;
pES && /<\/perms>/{print " <item name=\"android.permission.WRITE_EXTERNAL_STORAGE\" granted=\"true\" flags=\"0\" />";pES=0;} 1 ;'
"${fpath_ori}" > "${fpath_tmp}"
echo "finished"

# feeds back into the original file
echo "Write changes back to file"
busybox cat "${fpath_tmp}" > "${fpath_ori}"
echo "finished"

# removes temporary file
echo "Remove temporary file"
busybox rm "${fpath_tmp}"
echo "finished"

# changes permissions
echo "Adjust permissions"
copy_perm "${fpath_bak}" "${fpath_ori}"
echo "finished"

# mounts system as ro
if (! is_mounted /system ro); then
echo "Mount system RO"
busybox mount -o ro,remount /system /system
echo "finished"
fi
if (! is_mounted /system ro); then
echo "Mount again system RO"
busybox mount -o ro,remount /system
echo "finished"
fi

echo "********* $(date -u +%Y/%m/%d %H:%M:%S) **********"

but still having the same permission error, i have attached the log of the init.d file modified by me, maybe it helps to you.
[Android Software Development] vhick:
Yep, I exclude titanium backup in xinternalsd to avoid conflicts. The purpose of the hack it to aid some apps that didn't ask or no write permission at all in microsd. For example android download manager or shareit. Yes they allow to write in your microsd but in /storage/serial_number_of_sd/android/data where your files is temporary stored. When you uninstall your apps, these files is also deleted. Great example is xda labs. When you download an app from lab. It automatically stored in this directory. If there is no hack, it will stored in /storage/emulated/0.
[Android Software Development] sufie cruise:
I flashed it on redmi note 3 kenzo and now I'm unable to flash anything in twrp
[Android Software Development] rufus.wilson:
No worries...
[Android Software Development] rufus.wilson:
[MENTION=4982420]vinimdi[/MENTION], [MENTION=5499170]phoberus[/MENTION], [MENTION=4559392]SAM209[/MENTION], [MENTION=797430]satanas17[/MENTION], [MENTION=3215120]Graveen[/MENTION],

I have added support for Marshmallow now, see downloads page or OP.

If you could test and report it would be great.

Thanks!
[Android Software Development] satanas17:
;) wasn't so far from your project...wiill try try it...just few hours of sleeping ;)
[Android Software Development] ZeuBug:
Thanks a lot, but doesn't work on any CM13 based rom :( (CM13, AICP, CyanPop...)

But all it's ok on CM12.1. Hope it will work soon on CM13! :D
[Android Software Development] rufus.wilson:
Did you test the 1.7b version on Marshmallow?

I don't have it installed so I can't test myself...

Thanks
[Android Software Development] satanas17:
Sorry being a little late ;) Downloading right now...Could you give me an idea to test it as right as it need it ?
[Android Software Development] rufus.wilson:
I am sorry but I don't understand what you mean.
[Android Software Development] ZeuBug:
Yes, sure, I have tested 1.7b on CM13 and other variants. It doesnt' work, not able to write on sd card...
[Android Software Development] rufus.wilson:
Could you compare the /system/etc/permissions/platform.xml file and the backed up one?

Just to check that it is doing what it is supposed to do.
[Android Software Development] abhatia1435:
Flashed it in Xperia M CM13 and it did nothing. In the recovery it said Unsupported API version 23.
[Android Software Development] rufus.wilson:
[MENTION=797430]satanas17[/MENTION], [MENTION=591032]ZeuBug[/MENTION], [MENTION=6096609]abhatia1435[/MENTION],

I just uploaded a new version (v1.8b). There was a bug in the API detection...

Sorry for that. Thanks for reporting if it does work this time.
[Android Software Development] abhatia1435:
Succesfully flashed this time. But not working again. The permissions have been added but write issue still there.
[Android Software Development] rufus.wilson:
That's what I thought... Anyway thanks!
[Android Software Development] abhatia1435:
So.. No way to fix it?
[Android Software Development] ZeuBug:
I agree. But it's better now, we can use file manager like Solid Explorer. :)

Waiting for a final version with all access :)

Thanks again rufus.wilson :)
[Android Software Development] abhatia1435:
I don't think so Solid Explorer has anything to do with this mod. I am using Solid Explorer without this mod and it just works fine because the developer of SE fixed permissions to make it usable on MM. The apps which don't work are ADM(Advanced Download Manager),App Backup and Restore, Titanium Backup. I tested all of 'em. None of them worked.
[Android Software Development] rufus.wilson:
Does the zip help for Marshmallow at all?

I still thinks that some devs have updated their code to ask very politely to use this permission as the documentation recommends and some have not which explains why it does not necessarily work. If it is as I think, there is nothing I can do to help unfortunately and you should contact the devs to ask them to update.
[Android Software Development] abhatia1435:
I saw someone's post in OPX's CM13 thread. How can this trick work for him? Anyway, thanks for your effort :)
[Android Software Development] rufus.wilson:
Yes, I saw the same. That was the reason why I integrated the support for Marshmallow. I can not find anything on the web to solve the problem for M. So I'll leave it as it is until someone brings a new answer.

Maybe a test would be to develop one app where it asks politely the permission as per the new way for "difficult" permissions and another app where the permission required is just defined in the manifest file. And test both with and without the patch.
[Android Software Development] Phuclun510:
I'm unable to backup to SD Card using TB too.

So i will subscribe to this thread to find the solution

You have my support devs :D
[Android Software Development] petrmelis:
Hmm interesting. Can you share a link to app with this issues? And what conflicts did you have with TB without the hack? I'm probably lucky one because i dont have any problem with any app to save to any folder i created on ext. SD card without a problem including TB, PlayerPro, FV-5 camera etc.
[Android Software Development] dacorsa:
I can't see microSD in any app, how can I solve ?

Thanks

Inviato dal mio SM-G910F con Rom ALEXNDR DPB1

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

Admin Note: this thread has a dedicated questions and answers section which you can access here -->.

Inviato dal mio SM-G910F con Rom ALEXNDR DPB1
[Android Software Development] vhick:
Like I said, android download manager and shareit. You must save a file other than android/data in externalsd. May I also note that this is applicable in marshmallow because in marshmallow, you cannot save external files when you set your microsd card to portable.
[Android Software Development] oberworld:
I think that everybody must to know that this is a WIP (work in progress) and YOU MUST DO A RECOVERY BACKUP OF YOUR ROM before trying nothing.

If something wents wrong or not working, you always can restore your phone and nothing happened.

There are many posts here asking for help because phone not working correctly.

Guys don't install this untill you know what are you doing please.

Regards to all.
[Android Software Development] WILMANS2M:
well MM too is a WIP...

Envoyé de mon SM-G903F en utilisant Tapatalk
[Android Software Development] rufus.wilson:
Could you try to put the attached script in there? There was a typo in the tested paths for busybox and I corrected another problem.
[Android Software Development] oberworld:
[MENTION=6935794]rufus.wilson[/MENTION]

Still not working, same than before pop up window "restore to factory" and apps lost data and some apps doesn't open.

Same permission error than before: /data/system/packages.xml: can't execute: Permission denied

********* 2016/06/09 **********
Detecting busybox
Mount system RW
finished
Mount again system RW
finished
Add permissions to apps
/system/etc/init.d/99_ExtSD_fix_v23[65]: /data/system/packages.xml: can't execute: Permission denied
finished
Write changes back to file
finished
Remove temporary file
finished
Adjust permissions
chown: unknown user/group root:root
chown: unknown user/group root:root
chcon: applet not found
chcon: applet not found
finished
********* 2016/06/09 **********

And this:

chown: unknown user/group root:root

chown: unknown user/group root:root

chcon: applet not found

Thanks for keep hard working on this.
[Android Software Development] Athanatos81:
S5 Neo (903F), Android 6.0.1 (BPE1)

I installed v2.8b and I think it works. I can create/delete files with file explorer in extsd, no errors so far.

Foldermount now works with MM, but it's probably because of new compatible version. (?)

Any suggestions how to test, if I really have full write access?
[Android Software Development] KbaB.BroS:
You could try doing the same things again but with the zip not flashed
[Android Software Development] oberworld:
Post here the ExtSD_Fix_RW_initd.log file that you can find on /data/ folder with a root explorer.
[Android Software Development] Athanatos81:
Hm, the following phrase is the sole content:

********** 2016/06/09 **********
Detecting busybox
not found

busybox is installed for sure.
[Android Software Development] oberworld:
[MENTION=6935794]rufus.wilson[/MENTION]

I managed to avoid the "/data/system/packages.xml: can't execute: Permission denied" error and chown & chcon erros.

I did some changes in your code:

#!/system/bin/sh

LF=/dev/null
LF=/data/ExtSD_Fix_RW_initd.log

rm "${LF}"
touch "${LF}"

exec >> "${LF}" 2>&1

echo "********* $(date -u +%Y/%m/%d %H:%M:%S) **********"

echo "Detecting busybox"
BBbin=""
for bd in "/sbin/" "/vendor/bin/" "/system/sbin/" "/system/bin/" "/system/xbin/"
do
if [ -f "${bd}busybox" ]; then
BBbin=${bd}busybox
fi
done
if [ "${BBbin}" = "" ]; then
echo " not found"
return
fi

is_mounted() {
if [ ! -z "$2" ]; then
"${BBbin}" cat /proc/mounts | grep $1 | grep $2, >/dev/null
else
"${BBbin}" cat /proc/mounts | grep $1 >/dev/null
fi
return $?
}

fpath_ori="/data/system/packages.xml"
fpath_bak="${fpath_ori}-RW.bak"
fpath_tmp="${fpath_ori}-RW.tmp"

# mounts system as rw
if (! is_mounted /system rw); then
echo "Mount system RW"
"${BBbin}" mount -o rw,remount /system
echo "finished"
fi
if (! is_mounted /system rw); then
echo "Mount again system RW"
"${BBbin}" mount -o rw,remount /system /system
echo "finished"
fi

# changes permissions
echo "Adjust permissions"
chmod 0755 "${fpath_bak}" "${fpath_ori}"
echo "finished"

echo "Add permissions to apps"
"${BBbin}" awk '/<perms>/ {pMS=1;pES=1} ;
pMS && /WRITE_MEDIA_STORAGE/{pMS=0} ;
pMS && /<\/perms>/{print " <item name=\"android.permission.WRITE_MEDIA_STORAGE\" granted=\"true\" flags=\"0\" />";pMS=0;} 0 ;
pES && /WRITE_EXTERNAL_STORAGE/{pES=0} ;
pES && /<\/perms>/{print " <item name=\"android.permission.WRITE_EXTERNAL_STORAGE\" granted=\"true\" flags=\"0\" />";pES=0;} 1 ;'
"${fpath_ori}" > "${fpath_tmp}"
echo "finished"

# feeds back into the original file
echo "Write changes back to file"
"${BBbin}" cat "${fpath_tmp}" > "${fpath_ori}"
echo "finished"

# removes temporary file
echo "Remove temporary file"
"${BBbin}" rm "${fpath_tmp}"
echo "finished"

# mounts system as ro
if (! is_mounted /system ro); then
echo "Mount system RO"
"${BBbin}" mount -o ro,remount /system /system
echo "finished"
fi
if (! is_mounted /system ro); then
echo "Mount again system RO"
"${BBbin}" mount -o ro,remount /system
echo "finished"
fi

echo "********* $(date -u +%Y/%m/%d %H:%M:%S) **********"

But now i have this error on my log file:

********* 2016/06/09 **********
Detecting busybox
Mount system RW
finished
Mount again system RW
finished
Adjust permissions
finished
Add permissions to apps
/data/system/packages.xml[1]: syntax error: 'newline' unexpected
finished
Write changes back to file
finished
Remove temporary file
finished
********* 2016/06/09 **********

I think if you find the systax error this scrip will work.

Always trying in clean rom.

I hope this helps.

to [MENTION=4592965]Athanatos81[/MENTION]

---------- Post added at 10:31 PM ---------- Previous post was at 10:28 PM ----------

v2.8b it's not working like i say here: http://xdaforums.com/showpost.php?p=67243120&postcount=578
[Android Software Development] rufus.wilson:
Could you try the file attached? There was a problem with the syntax. I don't understand why we have to change the permissions before changing the file.
[Android Software Development] oberworld:
I'll try in a few minutes, but after some testing i think this method will never work.
[Android Software Development] rufus.wilson:
OK. Why do you think so?
[Android Software Development] rufus.wilson:
If I understand correctly, you are saying that even with the init.d script working it will never work. Is that correct?
[Android Software Development] oberworld:
That's what I think, but maybe i'm wrong, see my testing.

I'll try your file wait a bit.

---------- Post added at 02:32 AM ---------- Previous post was at 02:27 AM ----------

Here you have the log file:

********* 2016/06/10 **********

- Detecting busybox

- Mount system RW

- Mount again system RW

ls: /data/system/packages.xml*: No such file or directory

- Add permissions to apps

- Write changes back to file

- Remove temporary file

- Adjust permissions

chown: unknown user/group root:root

chown: unknown user/group root:root

chcon: applet not found

chcon: applet not found

********* 2016/06/10 **********
[Android Software Development] rufus.wilson:
Cool! It seems to work! Do you see the permissions added into the file? What are the file permissions and ownership of /data/system/packages.xml?
[Android Software Development] oberworld:
I have modified the file again it the script sems to work without errors, but now i have to do testing to see if the file is restored.

My modification it's attached at end of post.

My log:

********* 2016/06/10 **********

Detecting busybox

Mount system RW

finished

Mount again system RW

finished

Adjust permissions

finished

Add permissions to apps

Write changes back to file

finished

Remove temporary file

finished

********* 2016/06/10 **********

I'm on AOSP rom, maybe wor for CM or another custom roms.

I'll test now.
[Android Software Development] oberworld:
Permissions are 0660 by default.

Propietary: system

Group: system
[Android Software Development] oberworld:
Tested my mod that have no errors on log, like i told you original values are restored on boot or install an app. Nothing changes.

Maybe it's a issue for AOSP only, and maybe it will work on other roms.

Attachhed the file for who want to test it, all credits to [MENTION=6935794]rufus.wilson[/MENTION].
[Android Software Development] rufus.wilson:
That makes sense, the script may not be run by "system".

Could you try this one? It should work out of the box. I am saving the permissions of the file and setting it back afterward.

There was a copy and paste error in the script. Sorry for that.