Patching sepolicy failed - SuperSU

Dear friends
Good evening
i have honor 4x indian version che1-l04 model
when i try to use supersu.zip systemless version i get patching sepolicy--failure abort:crying:
i have attached sepolicy from unpacked boot.img
please help me patch this file
or
run following code in adb shell on your rooted phone and send me sepolicy_out file
Code:
adb push sepolicy /data/local/tmp/sepolicy
adb shell su -c "supolicy --file /data/local/tmp/sepolicy /data/local/tmp/sepolicy_out"
adb shell su -c "chmod 0644 /data/local/tmp/sepolicy_out"
adb pull /data/local/tmp/sepolicy_out sepolicy_out
thanks a lot:good:

I also had a problem similar to this, I was implementing SuperSu by hand becuse my boot.img is quirky. At one point I had to patch the sepolicy file, so I did it via an emulator.
Check here for up to do it (Note: I used a 64 bit android Nexus Lollipop system image as the emulator).
http://forum.xda-developers.com/showpost.php?p=68764185&postcount=9

edit: Wrong topic

You can easily get a patched sepolicy file by downloading a custom kernel that already includes SuperSU. Then you can extract the sepolicy file from that kernel to place it into your system.

tuiyaan said:
Dear friends
Good evening
i have honor 4x indian version che1-l04 model
when i try to use supersu.zip systemless version i get patching sepolicy--failure abort:crying:
i have attached sepolicy from unpacked boot.img
please help me patch this file
or
run following code in adb shell on your rooted phone and send me sepolicy_out file
Code:
adb push sepolicy /data/local/tmp/sepolicy
adb shell su -c "supolicy --file /data/local/tmp/sepolicy /data/local/tmp/sepolicy_out"
adb shell su -c "chmod 0644 /data/local/tmp/sepolicy_out"
adb pull /data/local/tmp/sepolicy_out sepolicy_out
thanks a lot:good:
Click to expand...
Click to collapse
hey, i'm facing the same problem for my lenovo yoga book...can't flash su cause it fails patching sepolicy.
did you solve the problem? if yes, how did you do that?
thanks for your help.

danjac said:
hey, i'm facing the same problem for my lenovo yoga book...can't flash su cause it fails patching sepolicy.
did you solve the problem? if yes, how did you do that?
thanks for your help.
Click to expand...
Click to collapse
i tried magisk and phh su method.
https://forum.xda-developers.com/honor-4x/help/honor-4x-che1-l04-mm-6-0-1-emui-4-root-t3475854\
chain fire su is not working (both systemless and systemmode)

tuiyaan said:
i tried magisk and phh su method.
https://forum.xda-developers.com/honor-4x/help/honor-4x-che1-l04-mm-6-0-1-emui-4-root-t3475854\
chain fire su is not working (both systemless and systemmode)
Click to expand...
Click to collapse
great man!!!! it worked for me as well!
thanks a lot. would buy you a beer instantly!

danjac said:
great man!!!! it worked for me as well!
thanks a lot. would buy you a beer instantly!
Click to expand...
Click to collapse
Good to hear
Thanks for the offer
Cheers

Related

[HOWTO] Root any Atrix after .sbf flash

See 2nd post for International users and Fastboot rooting.
For ATT users only:
What this is:
This is a full clean SBF of 2.3.4 or 1.8.3 WITH the BL unlock and rooting built in to /preinstall.
Flashable SBF: Full 2.3.4 with preinstall root and pudding bootloader unlock, full sbf
Flashable SBF: Full 1.8.3 with Bootloader unlock and preinstall root. It's over 9000 (600mb DL service sbf)
1. Flash with RSDLite 5.3.1 or sbf_flash
2. Root your phone from adb
Code:
adb shell
/preinstall/restoresu
3. If you don't have superuser.apk do this as well
Code:
/preinstall/restoresu all
Apparently I am a terrible scripter, so follow eval-s instructions from here:
type in adb ("adb shell") or terminal emulator, exactly:
Code:
/preinstall/dosu
/bin/mount -o remount,rw /system
cp /preinstall/su /system/bin/
chmod 6755 /system/bin/su
PATH=/system/bin:$PATH pm install /preinstall/Superuser.apk
The last step is optional (and next-to-last *should* be unnecessary), as you can install Superuser however you like. In fact, if you've installed it, simply typing "/preinstall/su" is another way to root, and you could then mount /system read-write and copy it into /system/bin.
Click to expand...
Click to collapse
4. Enjoy
Lastly, you can make your own preinstall pretty easily, include any kind of mod you want P_ROM etc. For instance when I reinstall I always want to install wget and crond, turn off tomoyo permissions and disable the usb plugin sound. You can put apps in /preinstall/app then make a md5sum file in /preinstall/md5 and apks will get loaded on reboot every time you flash. This is more of a fyi for those of you out there cooking up sbfs. you've got a huge partition to play with so I'm sure people out there can come up with creative ways of using it.
Hi guys.. here is a useful little /preinstall for you (attached)
Put phone in fastboot mode, then:
Code:
fastboot flash preinstall preinstall.img
fastboot reboot
(older versions maybe need "fastboot -i 0x22b8")
after fastboot & reboot, type in adb ("adb shell") or terminal emulator, exactly:
Code:
/preinstall/dosu
/bin/mount -o remount,rw /system
cp /preinstall/su /system/bin/
chmod 6755 /system/bin/su
PATH=/system/bin:$PATH pm install /preinstall/Superuser.apk
The last step is optional (and next-to-last *should* be unnecessary), as you can install Superuser however you like. In fact, if you've installed it, simply typing "/preinstall/su" is another way to root, and you could then mount /system read-write and copy it into /system/bin.
Many thanks to Brandon & The2d for brainstorming this out in a crazy "there's no way it could be possible" rooting session. There were a lot of harder ways... who knew we'd be so lucky! And thanks to Edgan for the great "dosu" =)
You can find fastboot here: http://forum.xda-developers.com/showthread.php?t=1138092
Woohoo! 10 char!
Love you long time! Congrats on figuring this out!
i just unlocked my phone and wanted to root, i installed the img but when i try to enter /preinstall/dosu it gives me file path not found. do i need to reboot or something after flashing the img?
Worked a treat with gingerbread! Thanks a lot guys!
For some reasons, could not adb to go, so had to do it with the terminal but it's all good!
neotekz said:
i just unlocked my phone and wanted to root, i installed the img but when i try to enter /preinstall/dosu it gives me file path not found. do i need to reboot or something after flashing the img?
Click to expand...
Click to collapse
I am having the same problem, path not found. What can i do?
bump
Anyone else figure out how to root? Is this only for gingerbread?
-eval, would we just push that SuperUser app to our phone through ADB if we already have Gingerbread on it? Or do we just flash that through fastboot?
airbillion said:
bump
Anyone else figure out how to root? Is this only for gingerbread?
Click to expand...
Click to collapse
This will work for any firmware version
neotekz said:
i just unlocked my phone and wanted to root, i installed the img but when i try to enter /preinstall/dosu it gives me file path not found. do i need to reboot or something after flashing the img?
Click to expand...
Click to collapse
Using linux?
Sent from my MB860 using XDA Premium App
LancerV said:
Using linux?
Sent from my MB860 using XDA Premium App
Click to expand...
Click to collapse
I used fastboot from windows.
eval- said:
Hi guys.. here is a useful little /preinstall for you:
http://www.multiupload.com/A9X3718TXK
Put phone in fastboot mode, then:
Code:
fastboot flash preinstall preinstall.img
(older versions maybe need "fastboot -i 0x22b8")
steps:
Code:
/preinstall/dosu
/bin/mount -o remount,rw /system
cp /preinstall/su /system/bin/
PATH=/system/bin:$PATH pm install /preinstall/Superuser.apk
http://forum.xda-developers.com/showthread.php?t=1138092
Click to expand...
Click to collapse
You still need to set the permissions on SU after you copy it from preinstall.
chmod 06755 /system/bin/su
rjohnstone said:
You still need to set the permissions on SU after you copy it from preinstall.
chmod 06755 /system/bin/su
Click to expand...
Click to collapse
In adb shell when I enter the 2nd command:
adb shell
$
cd /preinstall/dosu
cd: can't cd to /preinstall/dosu
this is my output.
airbillion said:
I used fastboot from windows.
Click to expand...
Click to collapse
You have to use the linux version
Sent from my MB860 using XDA Premium App
LancerV said:
You have to use the linux version
Sent from my MB860 using XDA Premium App
Click to expand...
Click to collapse
Ill give it a shot. thanks
airbillion said:
In adb shell when I enter the 2nd command:
adb shell
$
cd /preinstall/dosu
cd: can't cd to /preinstall/dosu
this is my output.
Click to expand...
Click to collapse
cd /preinstall
then...
dosu
HTH
the2dcour said:
cd /preinstall
then...
dosu
HTH
Click to expand...
Click to collapse
that is what I keep on trying, but it says:
can't dosu
airbillion said:
that is what I keep on trying, but it says:
can't dosu
Click to expand...
Click to collapse
might have to wait till tomorrow when I'm done with the sbf with a 1 command install then ^^;
this worked:
Code:
adb shell
cd /preinstall
su
/bin/mount -o remount,rw /system
cp /preinstall/su /system/bin/
reboot

[Q][Genymotion][Marshmallow] Installing Xposed in VM [Solved]

Has anybody worked out how to create a Genymotion Xposed testing device?
What I've already achieved:
- Grant Root access to Xposed
- Flash ARM zip
The problem is: Genymotion runs on x86, not ARM. So flashing the ARM zip just breaks the VM.
But flashing the x86 zip just gives the Error "Failed to flash file".
(Yes, I'm using Genyflash)
I also tried it with and without arm translation, no changes.
I simply have no idea what else I could try. Is it currently possible at all?
LM13 said:
Has anybody worked out how to create a Genymotion Xposed testing device?
What I've already achieved:
- Grant Root access to Xposed
- Flash ARM zip
The problem is: Genymotion runs on x86, not ARM. So flashing the ARM zip just breaks the VM.
But flashing the x86 zip just gives the Error "Failed to flash file".
(Yes, I'm using Genyflash)
I also tried it with and without arm translation, no changes.
I simply have no idea what else I could try. Is it currently possible at all?
Click to expand...
Click to collapse
I found that the flash-script.sh inside the xposed-v78-sdk23-x86.zip file is somehow not successfully executed by Genymotion. I've manually patched it.
getting root on Marshmallow
Hi,
How did You get root on Marshmallow?
Sergiusz
sbrzezin said:
Hi,
How did You get root on Marshmallow?
Sergiusz
Click to expand...
Click to collapse
Yes, the latest Genymotion version already come with rooted MM image
itandy said:
Yes, the latest Genymotion version already come with rooted MM image
Click to expand...
Click to collapse
I installed Custom Phone and Google Nexus 7 and none of them has root. Should I do any special setup or did I install wrong device? I use Genymotion 2.6.0 free version.
Sergiusz
sbrzezin said:
I installed Custom Phone and Google Nexus 7 and none of them has root. Should I do any special setup or did I install wrong device? I use Genymotion 2.6.0 free version.
Sergiusz
Click to expand...
Click to collapse
The ROM should be rooted already. su command is available and when you use ADB, it's already a rooted shell.
itandy said:
The ROM should be rooted already. su command is available and when you use ADB, it's already a rooted shell.
Click to expand...
Click to collapse
I got answer from Genymotion team:
"I just got an update from the Dev Team : it appears that in 6.0 the SuperUser Android App hasn't been yet implemented.
This feature will be implemented in the future, and I have linked your request to the task.
When it will be completed and released, you will be automatically notified."
Sergiusz
sbrzezin said:
I got answer from Genymotion team:
"I just got an update from the Dev Team : it appears that in 6.0 the SuperUser Android App hasn't been yet implemented.
This feature will be implemented in the future, and I have linked your request to the task.
When it will be completed and released, you will be automatically notified."
Sergiusz
Click to expand...
Click to collapse
So I managed to make some progress on this. I got the latest v84 xposed working in the newest Genymotion 2.6.0 with a Nexus 5X image by doing the following:
Code:
git clone https://github.com/rovo89/GenyFlash
cd GenyFlash && ./install.sh
adb push xposed-v84-sdk23-x86.zip /sdcard
adb shell flash-archive.sh /sdcard/xposed-v84-sdk23-x86.zip
Reboot Genymotion VM and then drag XposedInstaller_3.0_alpha4.apk to Genymotion vm...profit!
As stated above, the Genymotion images are rooted but a lot of root apps ask for permission and the prompt to grant/deny root wasn't working for me rendering the apps limited in use. I downloaded the newest SuperSU BETA, at the time of this post, BETA-SuperSU-v2.71-20160331103524. I extracted it and then issues the following commands from terminal:
Code:
adb shell mount -o remount,rw /system
adb install common/Superuser.apk
adb push x86/su /system/bin/su
adb shell chmod 0755 /system/bin/su
adb push x86/su /system/xbin/su
adb shell chmod 0755 /system/xbin/su
adb shell su --install
adb shell "su --daemon&"
adb shell setenforce 0
adb shell mount -o remount,ro /system
The problem was issuing the "su" commands resulted in: "error: only position independent executables (PIE) are supported." Countless time spent google searching didn't turn up any leads, but then I happened to notice in the x86/su directory a file called su.pie...pie = position independent executable derp. So I reran the following:
Code:
adb shell mount -o remount,rw /system
adb push x86/su.pie /system/bin/su
adb shell chmod 0755 /system/bin/su
adb push x86/su.pie /system/xbin/su
adb shell chmod 0755 /system/xbin/su
adb shell su --install
adb shell "su --daemon&"
adb shell setenforce 0
adb shell mount -o remount,ro /system
Rebooted my Genymotion vm and BAM root access prompts!!!!! Hope this helps others and good luck.
Worked for me
123SIT said:
So I managed to make some progress on this. I got the latest v84 xposed working in the newest Genymotion 2.6.0 with a Nexus 5X image by doing the following:
Code:
git clone https://github.com/rovo89/GenyFlash
cd GenyFlash && ./install.sh
adb push xposed-v84-sdk23-x86.zip /sdcard
adb shell flash-archive.sh /sdcard/xposed-v84-sdk23-x86.zip
Reboot Genymotion VM and then drag XposedInstaller_3.0_alpha4.apk to Genymotion vm...profit!
As stated above, the Genymotion images are rooted but a lot of root apps ask for permission and the prompt to grant/deny root wasn't working for me rendering the apps limited in use. I downloaded the newest SuperSU BETA, at the time of this post, BETA-SuperSU-v2.71-20160331103524. I extracted it and then issues the following commands from terminal:
Code:
adb shell mount -o remount,rw /system
adb install common/Superuser.apk
adb push x86/su /system/bin/su
adb shell chmod 0755 /system/bin/su
adb push x86/su /system/xbin/su
adb shell chmod 0755 /system/xbin/su
adb shell su --install
adb shell "su --daemon&"
adb shell setenforce 0
adb shell mount -o remount,ro /system
The problem was issuing the "su" commands resulted in: "error: only position independent executables (PIE) are supported." Countless time spent google searching didn't turn up any leads, but then I happened to notice in the x86/su directory a file called su.pie...pie = position independent executable derp. So I reran the following:
Code:
adb shell mount -o remount,rw /system
adb push x86/su.pie /system/bin/su
adb shell chmod 0755 /system/bin/su
adb push x86/su.pie /system/xbin/su
adb shell chmod 0755 /system/xbin/su
adb shell su --install
adb shell "su --daemon&"
adb shell setenforce 0
adb shell mount -o remount,ro /system
Rebooted my Genymotion vm and BAM root access prompts!!!!! Hope this helps others and good luck.
Click to expand...
Click to collapse
Worked for me on the Google Nexus 9 API 23
gamerkcw123 said:
Worked for me on the Google Nexus 9 API 23
Click to expand...
Click to collapse
Hell yeah! I was beginning to think I was the only one who wanted this...and then there were two lol
123SIT said:
Hell yeah! I was beginning to think I was the only one who wanted this...and then there were two lol
Click to expand...
Click to collapse
the Supersu.apk still won't update the su binary. Do you know of a way to get that to work? If not I don't care I have supersu granting root. LOL
gamerkcw123 said:
the Supersu.apk still won't update the su binary. Do you know of a way to get that to work? If not I don't care I have supersu granting root. LOL
Click to expand...
Click to collapse
If I remember correctly I have that same issue but if you use the newest supersu zip you should be able to update it manually via the provided steps.
I think GenyFlash shouldn't be needed anymore... just drag and drop the x86 zip and the installer APK on the Genymotion window and reboot. The only thing that isn't working are the reboot buttons in the installer.
123SIT said:
If I remember correctly I have that same issue but if you use the newest supersu zip you should be able to update it manually via the provided steps.
Click to expand...
Click to collapse
I got it to work. This is what I did. I fallowed your steps to get SuperSU working, and granting
apps permission. Then I removed the APK and installed the APK from the 2.46 update. Then I updated SuperSU.apk from the play store. Success the binary updated successfully.
Step 1: fallowed your steps with the Bata.
Step 2: once I confirmed superSU is working, I remove the APK.
Step 3: I use the SuperSU APK in the 2.46 update.
Step 4: I use adb to push the APK in the 2.46 update to /system/app, and chmod it to 755.
Step 5: I reboot and go to the play store and update SuperSU.
Success!!!!!!!
this was again on the Genymotion Google Nexus 9 6.0 API.
rovo89 said:
I think GenyFlash shouldn't be needed anymore... just drag and drop the x86 zip and the installer APK on the Genymotion window and reboot. The only thing that isn't working are the reboot buttons in the installer.
Click to expand...
Click to collapse
You know, I don't think I ever actually tried it without. May have saved me some time lol
123SIT said:
So I managed to make some progress on this. I got the latest v84 xposed working in the newest Genymotion 2.6.0 with a Nexus 5X image by doing the following:
Code:
git clone https://github.com/rovo89/GenyFlash
cd GenyFlash && ./install.sh
adb push xposed-v84-sdk23-x86.zip /sdcard
adb shell flash-archive.sh /sdcard/xposed-v84-sdk23-x86.zip
Reboot Genymotion VM and then drag XposedInstaller_3.0_alpha4.apk to Genymotion vm...profit!
As stated above, the Genymotion images are rooted but a lot of root apps ask for permission and the prompt to grant/deny root wasn't working for me rendering the apps limited in use. I downloaded the newest SuperSU BETA, at the time of this post, BETA-SuperSU-v2.71-20160331103524. I extracted it and then issues the following commands from terminal:
Code:
adb shell mount -o remount,rw /system
adb install common/Superuser.apk
adb push x86/su /system/bin/su
adb shell chmod 0755 /system/bin/su
adb push x86/su /system/xbin/su
adb shell chmod 0755 /system/xbin/su
adb shell su --install
adb shell "su --daemon&"
adb shell setenforce 0
adb shell mount -o remount,ro /system
The problem was issuing the "su" commands resulted in: "error: only position independent executables (PIE) are supported." Countless time spent google searching didn't turn up any leads, but then I happened to notice in the x86/su directory a file called su.pie...pie = position independent executable derp. So I reran the following:
Code:
adb shell mount -o remount,rw /system
adb push x86/su.pie /system/bin/su
adb shell chmod 0755 /system/bin/su
adb push x86/su.pie /system/xbin/su
adb shell chmod 0755 /system/xbin/su
adb shell su --install
adb shell "su --daemon&"
adb shell setenforce 0
adb shell mount -o remount,ro /system
Rebooted my Genymotion vm and BAM root access prompts!!!!! Hope this helps others and good luck.
Click to expand...
Click to collapse
It's worked on Galaxy S6 6.0.0 API23, Genymotion 2.7.2! Thanks you so much!

[G920A/G925A/G928A] Kernel auto Root Android 5.1.1 Galaxy S6/S6e/S6e+ AT&T

Kernel support auto Root Android 5.1.1
Galaxy S6 AT&T G920A, Galaxy S6 edge AT&T G925A & Galaxy S6 edge+ G928A AT&T​
Download Kernel Root G920A Android 5.1.1
File: G920A_Kernel_Root_5.1.1_SamFirm.NET.tar.md5
MD5: FCAA9182 - 7015BA72 - AD583332 - D34CAD87
Download Kernel Root G925A Android 5.1.1
File: G925A_Kernel_Root_5.1.1_SamFirm.NET.tar.md5
MD5: CA8612FB - 7F8A6EFC - A540E84E - 29200775
Download Kernel Root G928A Android 5.1.1
File: G928A_Kernel_Root_5.1.1_SamFirm.NET.tar.md5
MD5: BA904163 - 18B28E36 - F3C29CFD - B6BA2E92
How to Root G920A Android 5.11. & Root G925A Android 5.1.1:
- Download Kernel support Root Android 5.1.1 for G920A or G925A
- On your phoen, into Download mode
- Connect to PC
- Open Odin 3.10.7, click AP & choose Kernel file
- Click Start to flash Kernel
- Reboot, your devices have Root access now !
How to use ?
Use adb shell or Terminal command for mount and modified system,... without su binary !!!
Example:
Code:
adb root
adb shell
mount -o remount,rw /system
rm -fR /system/app/*Knox*
...
tried this method and the phone hangs on boot. i was able to flash the kernel but nothing else.
Anybody else try this ?
Could you please assist in finding a stock image to unbrick our phones? Instructions would be appreciated too. Thanks!
Hold volume down plus power and home key. Get into download mode and flash stock Odin files located in the general section. I'll just wait till s6 gets marshmallow.
Anybody found some more progress with this in other locations ?
This doesn't work.
Capt said:
This doesn't work.
Click to expand...
Click to collapse
Try use adb shell mount and edit system
adb root
adb shell
mount -o remount,rw /system
Manh_IT said:
Try use adb shell mount and edit system
adb root
adb shell
mount -o remount,rw /system
Click to expand...
Click to collapse
Still doesn't work.
already a thread on these files. this is not root and really shouldnt be flashed as they do nothing for our 920A s6. unless a dev can use these to get full root then these will not benifit anyone right now thats needs root for root apps or anything else really.
Worked for me. I have adb root but can't do much. I tried to perform a manual install of supersu, but no luck in getting it working fully.
From a directory that has the arm64 and common files from SuperSU zip flle I tried the following:
Code:
adb shell mount -o rw,remount /
adb shell mount -o rw,remount /system
adb shell mkdir /system/bin/.ext
adb shell chmod 0777 /system/bin/.ext
adb push arm64\su /system/bin/.ext/.su
adb shell chmod 06755 /system/bin/.ext/.su
adb push arm64\su /system/xbin/su
adb shell chmod 06755 /system/xbin/su
adb push arm64\su /system/xbin/daemonsu
adb shell chmod 06755 /system/xbin/daemonsu
adb shell mkdir /system/app/SuperSU
adb shell chmod 0755 /system/app/SuperSU
adb push common\superuser.apk /system/app/SuperSU/SuperSU.apk
adb shell chmod 0644 system/app/SuperSU/SuperSU.apk
adb shell adb shell SYSTEMLIB=/system/lib64
adb shell LD_LIBRARY_PATH=$SYSTEMLIB /system/xbin/su --install
adb shell /system/xbin/su --install
adb shell rm /system/bin/app_process
adb shell ln /system/xbin/daemonsu /system/bin/app_process
adb shell rm -r /data/dalvik-cache
adb reboot
i am a user of S6 active,does the thread work on mine?please~
通过我的 SM-G890A 上的 Tapatalk发言
G890A is private still.
Apexseal said:
G890A is private still.
Click to expand...
Click to collapse
oh,it is disappointing
通过我的 Nexus 4 上的 Tapatalk发言
Succeed after installing kingroot. Trying to figure out how to make Supersu work.
dreamyy5 said:
Succeed after installing kingroot. Trying to figure out how to make Supersu work.
Click to expand...
Click to collapse
This image is a copy from the OP, beware this could soft brick your phone. Test this method with caution.
metalcated said:
This image is a copy from the OP, beware this could soft brick your phone. Test this method with caution.
Click to expand...
Click to collapse
I also tried to push the files to following place, supersu still cannot work properly. Couldn't figure out why.
/system/etc/init.d/99SuperSUDaemon
/system/etc/install-recovery.sh
/system/bin/install-recovery.sh
/system/xbin/supolicy
/system/lib64/libsupol.so
Can get it working on first boot. But retaining it is an issue. Still need more time. Anyone else who's good here can PM me and I'll provide my steps. Please only someone who's familiar with rooting on a technical level. ROM devs etc. Thanks
So what I have figured at this point is that SeLinux needs to be set to permissive from kernel cmdline and unfortunately without an unlocked BL or a Kernel that is flashable that already has Selinux set to permissive, I am stuck running this manually through adb shell each boot and the boot itself takes about 5 minutes before adb responds again. I can provide this method but its not 100% working obviously due to lacking the ability to run kernel cmdline. I am open to suggestions.
Root method Q&A = http://forum.xda-developers.com/att-galaxy-s6/general/root-5-1-1-qa-oj7-root-snag-t3334546

Patching Sepolicy with Supolicy Tool, modifed file not produced.

I am in the position of having to manually apply the defult sepolicy patch, init,?*init_shell?* and?*recovery?*permissive, and as the title states when using the supolicy tool to modify my supplieded sepolicy it is not being produced and on closer inspection throwing an error. I have attached both the images and the sepolicy file I am trying to applie these change to.
Have I been doing something wrong or is the file corrupted??
If you need more info just ask
Note: when I first tried it inside an adb shell it reported a segumentation fault, but I was unable to reproduce that condition to be provided with as a screen shot.
{
"lightbox_close": "Close",
"lightbox_next": "Next",
"lightbox_previous": "Previous",
"lightbox_error": "The requested content cannot be loaded. Please try again later.",
"lightbox_start_slideshow": "Start slideshow",
"lightbox_stop_slideshow": "Stop slideshow",
"lightbox_full_screen": "Full screen",
"lightbox_thumbnails": "Thumbnails",
"lightbox_download": "Download",
"lightbox_share": "Share",
"lightbox_zoom": "Zoom",
"lightbox_new_window": "New window",
"lightbox_toggle_sidebar": "Toggle sidebar"
}
EDIT: I at least can say that the possibility of a corrupt file is now smaller becuse I am able to run dumpav and dump its contents to a txt file and then do afb pull back to pc. So amyone know any way to applie the defult P atchs needed to sysyemless root?
@Chainfire Since this is your binary files, you should know the most about it.
Commands to gain application root on emulator
Code:
adb shell df #Check Available Space
adb shell mount -o remount,rw /system
adb push su /system/bin/su
adb shell chmod 0755 /system/bin/su
adb push su /system/xbin/su
adb shell chmod 0755 /system/xbin/su
adb shell su --install
adb shell "su --daemon&"
adb install superuser.apk
adb install rootcheck.apk
I then proceed to patch the sepolicy file with the following commands
Code:
adb push sepolicy /data/local/tmp/sepolicy
adb shell su -c "supolicy --file /data/local/tmp/sepolicy /data/local/tmp/sepolicy_out" #There is no sepolicy_out file
adb shell su -c "chmod 0644 /data/local/tmp/sepolicy_out"
adb pull /data/local/tmp/sepolicy_out sepolicy_out
So what am I able to do?
Are you able to
A) Help me debug the problem
Or
B) Patch the sepolicy file and post the output back to me/here
Matt07211 said:
...
Click to expand...
Click to collapse
Works fine on my device... could be an x86 specific issue? Unfortunately I don't have any x86 devices to test with.
Thanks for that. Yes, I am trying to patch the policy for my armv8 (arm64) cpu device (just realised, but would trying to patch the sepolicy from one architecture using the supolicy for a different architecture have new the problem?, if so I feel dumb). And since I didn't have a spare device devce that met the requirements, I resorted to use the already setup emulator in my Windows installation.
I had proceeded to root and run the supolicy tool for which nothing out-putted (tried different directorys), I then created a new sub-directory, test, in /data/local/tmp and chmod it with read and write permissions. I tried again and failed, I then ran a dumpav in the sepolicy I was trying to patch and outputted it to /data/local/tmp/test/dumpav.txt which worked.
I am just wondering why it didn't work for me .
Thanks again for the sepolic_out file, I really do apperciate it.
Ah you're saying the segmentation fault occurred on the emulator? That's interesting. Might be reproducable on my end.
Note: look at my first image with cms in the foreground and near the bottom of the command window you should see the segfault message, around second last command or so.
To reproduce that segfault (hopefully):
1) https://software.intel.com/en-us/android/articles/android-44-kitkat-x86-emulator-system-image Download the system image from here (had to direct download instead of sdk as internet was running through profile and ask wouldn't work through it)
2) used the 2.78 SuperSu zip and run above commands to gain root
3) run above commands to try and modify sepolicy (it doesn't produce anything)
4) start an adb shell and then run the commands inside the shell. Know the outputs shown was segfault the first time running the commands, every time afterwards it would show the error in the above screenshots
If you figure out what cause the segfault can you please tell me ?
Matt07211 said:
Note: look at my first image with cms in the foreground and near the bottom of the command window you should see the segfault message, around second last command or so.
To reproduce that segfault (hopefully):
1) https://software.intel.com/en-us/android/articles/android-44-kitkat-x86-emulator-system-image Download the system image from here (had to direct download instead of sdk as internet was running through profile and ask wouldn't work through it)
2) used the 2.78 SuperSu zip and run above commands to gain root
3) run above commands to try and modify sepolicy (it doesn't produce anything)
4) start an adb shell and then run the commands inside the shell. Know the outputs shown was segfault the first time running the commands, every time afterwards it would show the error in the above screenshots
If you figure out what cause the segfault can you please tell me ?
Click to expand...
Click to collapse
Before I go do all this, can you make sure the issue persists with the v2.78 SR1 version from the BETA thread ? Some issues with supolicy were fixed in that release.
Started with a fresh emulator and the newest SuperSu and ran these commands to gain root (I am placing everything as described in update-binary in the right places just to eliminate one thing, missing dependencies)
Code:
adb shell df
adb shell mount -o remount,rw /system
adb push Superuser.apk /system/app/Superuser.apk
adb shell chmod 0644 /system/app/Superuser.apk
adb push install-recovery.sh /system/etc/install-recovery.sh
adb shell ln -s /system/etc/install-recovery.sh /system/bin/install-recovery.sh
adb shell chmod 0755 /system/etc/install-recovery.sh
adb push su /system/xbin/su
adb shell chmod 0755 /system/xbin/su
adb push su /system/bin/.ext/.su
adb shell chmod 0755 /system/bin/.ext/.su
adb push su /system/xbin/daemonsu
adb shell chmod 0755 /system/xbin/daemonsu
adb push su /system/xbin/sugote
adb shell chmod 0755 /system/xbin/sugote
adb push supolicy /system/xbin/supolicy
adb shell chmod 0755 /system/xbin/supolicy
adb push libsupol.so /system/lib/libsupol.so
adb shell chmod 0644 /system/lib/libsupol.so
adb push 99SuperSUDaemon /system/etc/init.d/99SuperSUDaemon
adb shell chmod 0755 /system/etc/init.d/99SuperSUDaemon
adb shell su --install
adb shell "su --daemon&"
adb install superuser.apk
adb install rootcheck.apk
No everything should be in place, and we now can eliminate one thing (supolicy not finding needed dependencies)
Opened up SuperSu and let it install/update binary (succesful)
I then proceeded to patch the sepolicy file like so
Code:
adb push sepolicy /data/local/tmp/sepolicy
adb shell su -c "supolicy --file /data/local/tmp/sepolicy /data/local/tmp/sepolicy_out"
I then did "ls" in the directory and no file out-putted. So I went into a shell and ran
Code:
supolicy --file /data/local/tmp/sepolicy /data/local/tmp/sepolicy_out
And it throw the error shown in the image below. First time running that command in shell it says stopped, but the second time it says stopped as well as segfault.
Keep in mind I am trying to patch a sepolicy file that originates from an armv8 cpu (arm64) on an x86 Intel emulator.
Any more info needed? I am happy to help @Chainfire
So, I think it has something to do with your emulator image (perhaps its too old ?)
I took SuperSU's ZIP file and extracted it, changed to that folder, then:
(note that my adb shell to my emulator image has # root by default)
Code:
adb push c:\download\sepolicy /data/local/tmp/sepolicy
adb push x86\. /data/local/tmp/.
adb shell
cd /data/local/tmp
chmod 0755 supolicy
LD_LIBRARY_PATH=/data/local/tmp:$LD_LIBRARY_PATH ./supolicy --file sepolicy sepolicy_out
exit
Resulting in:
Code:
supolicy v2.78 (ndk:x86) - Copyright (C) 2014-2016 - Chainfire
Patching policy [sepolicy] --> [sepolicy_out] ...
- Success
So, I'm really not sure what might be going on with your setup, but I don't think its SuperSU itself, but rather the emulator.
Note that to use supolicy --file, you only need supolicy and libsupol.so, you don't even need root.
Chainfire said:
So, I think it has something to do with your emulator image (perhaps its too old ?)
I took SuperSU's ZIP file and extracted it, changed to that folder, then:
(note that my adb shell to my emulator image has # root by default)
Resulting in:
So, I'm really not sure what might be going on with your setup, but I don't think its SuperSU itself, but rather the emulator.
Note that to use supolicy --file, you only need supolicy and libsupol.so, you don't even need root.
Click to expand...
Click to collapse
Hmm, I really don't know what is wrong, I will try exactly what you have done later today, to see If can reproduce the output. If it doesn't work then we can pin it down to the emulator itself. What emulator image did you use?
I also realise that so emulator are rooted in the sense that web shell has root acess, just wasn't sure what dependices supolicy had at the time.
Matt07211 said:
Hmm, I really don't know what is wrong, I will try exactly what you have done later today, to see If can reproduce the output. If it doesn't work then we can pin it down to the emulator itself. What emulator image did you use?
I also realise that so emulator are rooted in the sense that web shell has root acess, just wasn't sure what dependices supolicy had at the time.
Click to expand...
Click to collapse
I created an API 22 Google Nexus x86_64 AVD in Android Studio
I should be able to try that in about 20-30 mins after I download it, I was using api level 19, Intel's emulator image.
I ran these commands on the Intel api 19 x86 emulator image.
Code:
adb push libsupol.so /system/lib/libsupol.so
adb shell chmod 0644 /system/lib/libsupol.so
adb push /system/xbin/supolicy
adb shell chmod 0755 /system/xbin/supolicy
adb push supolicy /data/local/tmp/supolicy
adb shell chmod 0755 /data/local/tmp/supolicy
adb push sepolicy /data/local/tmp/sepolicy
adb shell
cd /data/local/tmp
chmod 0755 supolicy
LD_LIBRARY_PATH=/data/local/tmp:$LD_LIBRARY_PATH ./supolicy --file sepolicy sepolicy_out
and it results in the error(shown in screenshot)
Code:
libsepol.policydb_read: policydb magic number 0x464c457f does not match expected magic number 0xf97cff8c or 0xf97cff8d
-Failure!
I then tried it on the Intel x86_64 api 22 emulator image (running the same commands as the first one, resulting in a succes, with the file being outputted as the sepolicy_out.
So as you have stated @Chainfire , it looks like a problem with the emulator itself, and most likely not the supolicy tool.
Chainfire said:
So, I think it has something to do with your emulator image (perhaps its too old ?)
I took SuperSU's ZIP file and extracted it, changed to that folder, then:
(note that my adb shell to my emulator image has # root by default)
Code:
adb push c:\download\sepolicy /data/local/tmp/sepolicy
adb push x86\. /data/local/tmp/.
adb shell
cd /data/local/tmp
chmod 0755 supolicy
LD_LIBRARY_PATH=/data/local/tmp:$LD_LIBRARY_PATH ./supolicy --file sepolicy sepolicy_out
exit
Resulting in:
Code:
supolicy v2.78 (ndk:x86) - Copyright (C) 2014-2016 - Chainfire
Patching policy [sepolicy] --> [sepolicy_out] ...
- Success
So, I'm really not sure what might be going on with your setup, but I don't think its SuperSU itself, but rather the emulator.
Note that to use supolicy --file, you only need supolicy and libsupol.so, you don't even need root.
Click to expand...
Click to collapse
@Chainfire, I'm trying to patch sepolicy for a Samsung device running Nougat, so that Supersu can be installed in system mode. Could you confirm if the --sdk=24 parameter is required?
adb shell su -c "supolicy --file /data/local/tmp/sepolicy /data/local/tmp/sepolicy_out --sdk=24"
Thanks, appreciate your time.
ashyx said:
@Chainfire, I'm trying to patch sepolicy for a Samsung device running Nougat, so that Supersu can be installed in system mode. Could you confirm if the --sdk=24 parameter is required?
adb shell su -c "supolicy --file /data/local/tmp/sepolicy /data/local/tmp/sepolicy_out --sdk=24"
Thanks, appreciate your time.
Click to expand...
Click to collapse
Yes it is.
System mode hasn't been tested at all on 7.0 though. I'm not sure anybody has been able to get it to work at this point.
If you do, let me know and with the steps
Chainfire said:
Yes it is.
System mode hasn't been tested at all on 7.0 though. I'm not sure anybody has been able to get it to work at this point.
If you do, let me know and with the steps
Click to expand...
Click to collapse
Hmm wasn't aware of the lack of support for system mode in nougat, any plans to implement?
It seems system mode root renders the device unbootable according to reports from my tester.
Question, if I modify the supersu script to mount su.img from /system am I likely to hit issues?
Seems a strange query I know.
Reason is we have a Samsung device that for some reason will not boot from a source built custom Nougat kernel. Not sure if this is related to AVB yet or something else.
However we can get a half assed TWRP to boot with the stock kernel.
Only problem is, no matter what, only /system can be mounted and accessed with write permission due to permission denied issues with the rest of partitions. Pretty sure this is an SELinux issue.
Meaning systemless root cannot be installed as normal. No access to /data or /cache.
I can patch the boot.img ramdisk manually for systemless, but for root to work I would need to push su.img to system and mount it from there.
Is it possible to still mount su.img from system if I modify the ramdisk init as required?
The other avenue is to flash su.img to /data or /cache via ODIN.
If it was flashed to /cache would supersu automatically pick up its location and copy it to /data or would a flag need to be set?
Just trying to keep my options open here.
ashyx said:
Hmm wasn't aware of the lack of support for system mode in nougat, any plans to implement?
It seems system mode root renders the device unbootable according to reports from my tester.
Click to expand...
Click to collapse
It is on my list of things to test/fix, but that list is long and full of terrors.
Question, if I modify the supersu script to mount su.img from /system am I likely to hit issues?
Is it possible to still mount su.img from system if I modify the ramdisk init as required?
Click to expand...
Click to collapse
I think that could work, yes.
The other avenue is to flash su.img to /data or /cache via ODIN.
If it was flashed to /cache would supersu automatically pick up its location and copy it to /data or would a flag need to be set?
Just trying to keep my options open here.
Click to expand...
Click to collapse
SuperSU should pick it up from /cache. Alternatively, try SuperSU's FRP mode, which stores a copy of the needed files in the boot-image and re-creates /data/su.img as needed.
Chainfire said:
It is on my list of things to test/fix, but that list is long and full of terrors.
I think that could work, yes.
SuperSU should pick it up from /cache. Alternatively, try SuperSU's FRP mode, which stores a copy of the needed files in the boot-image and re-creates /data/su.img as needed.
Click to expand...
Click to collapse
Thanks, great info as always. Finally managed to root the damn thing by adding a short script to the init which copies su.img to cache.
However FRP mode sounds like a more elegant solution if I can work out how to implement it in the Ramdisk.
Much appreciate your input.
ashyx said:
So, I think it has something to do with your emulator image (perhaps its too old ?)
...
Could you confirm if the --sdk=24 parameter is required?
adb shell su -c "supolicy --file /data/local/tmp/sepolicy /data/local/tmp/sepolicy_out --sdk=24"
Thanks, appreciate your time.
Click to expand...
Click to collapse
Yea believe it was segfaulting due to the Android version, I think I was using KitKat and it wasn't working, bumped up to lollipop and above and it worked fine
Oh, the SDK parameter, never heard of it, what does it do? Geuss I'll Google that then.
ashyx said:
Thanks, great info as always. Finally managed to root the damn thing by adding a short script to the init which copies su.img to cache.
However FRP mode sounds like a more elegant solution if I can work out how to implement it in the Ramdisk.
Much appreciate your input.
Click to expand...
Click to collapse
I did the same thing for my device, add a little script to move it to data. Had no other way to get it to a locked down device without TWRP. Hehe. Good job
Can you please tell me how to manually patch init by supersu ?
I've googled a lot, but haven't found a way to manually patch init by supersu.
My model is Honor v10, there isn't a custom recovery, so i have to make a boot.img with supersu inside to get root.

Help w a twrp convert/ port and chmod

Edit* ok two things I have finally managed to get rooted on an Android TV amlogic device running Android 10 with magisk! But problem 1: it detects an old su binary that came pre-installed and hidden by chmod permissions in this user debug firmware I am running so you had root ADB shell. Now magisk wants me to remove the other su binary I chmodded to 777 in /system/xbin/su that came w debug build. How to chmod hide from execute or detection or remove that? And problem #2: have a twrpof a different device but with the same motherboard but it's a .zip with no recover.img fastboot boot recovery.img, to boot to twrp..how to compile the zip to a twrp img or finish porting my own?

Categories

Resources