yashsingh1/xdaforums huggingface dataset:
[Verizon Samsung Galaxy S 4] swc2001:
When or if you use the wipe version of MJ7 VIA ODIN.... would that not get rid of the custom flag? Just curious because if I ever turn the phone in I would like to be able to have it stock for real for real.....

Thanks in advance!
[Verizon Samsung Galaxy S 4] k1mu:
I've got a copy of the MK2 update, but I haven't had any problems with getting it OTA after MJ7 no-wipe.

Settings/More/About Phone/Software Update.

My software update history shows three successful updates to MK2 :)

"Check for new software update" on that screen causes an update check, which gives me "System update available".

However, my phone is NOT showing custom, thanks to Wanam. It's very possible that you aren't seeing the update if you're custom.

You can make it easier: flash MJ7 and don't root. Update to MK2 then root.
[Verizon Samsung Galaxy S 4] swc2001:
that's exactly what I tried to do..... the update check tried and tried until it finally said can't access the update system right now try again later..... I did this for over an hour. I just gave up and rooted MJ7 and put on the new safestrap 3.70...... am I really missing much by not having MK2? Or could I just stay here comfortably? I mean the main reason I even went to MJ7 was to get the Watch support and to get the OPEN GLES 3.0 SUPPORT. Just curious is all I dont want to miss out if its a good update.
[Verizon Samsung Galaxy S 4] k1mu:
Yup. You need to flash the stock ROM, then boot it. Give it about 10 minutes to scan for "suspicious" files, then reboot. After that, the "Custom" flag will be gone.

What happens is that there's a program that runs during boot that watches for any unexpected root programs. If they're found, the "Custom" flag gets set. When you install stock, none of that bad stuff happens, so another reboot lets the tracker see that you're clean so the flag gets cleared.

Triangle Away has methods to deal with this, including delaying root requests for a while after boot. I use wanam to just clear the flag.
[Verizon Samsung Galaxy S 4] swc2001:
Oh really so you can just use Triangle away? That would be Awesome.... I will give that a shot.
[Verizon Samsung Galaxy S 4] k1mu:
Be careful about Triangle Away - there are some things it uses that I think can trip the Knox Warranty Void flag!
[Verizon Samsung Galaxy S 4] swc2001:
Yeah I was just noticing my count was at 0 so I just uninstalled it. I think best to leave well enough alone. I don't mind the custom flag anyway..... just means I'm a Pirate... LOL. If I do ever need to return the phone I think I will just stick to our previous comments and Odin back to factory stock. thanks for the heads up.
[Verizon Samsung Galaxy S 4] CheriePie:
I had to factory reset my phone and re-root and this 2nd time around (and with a later version of the script), I too got the DEVICE NOT FOUND errors when trying to install busybox.

So after the phone restarted, I launched adb and ran the last few lines of the script manually:

[MENTION=4436650]files[/MENTION]\adb shell "su -c mount -o remount,rw /system"

[MENTION=4436650]files[/MENTION]\adb shell "su -c /system/xbin/busybox --install -s /system/xbin"

[MENTION=4436650]files[/MENTION]\adb shell "su -c mount -o remount,ro /system"

What I noticed by doing it this way is that adb prompted for superuser on my phone and I had to grant that before things could proceed. Once I did that, I was able to run the rest of the busybox commands without issue and busybox installed properly. So that seems to be the issue with the DEVICE NOT FOUND errors. Once adb has superuser permissions, then the busybox install will proceed fine.

I also noticed, this second time around, that Knox was disabled more thoroughly, and I didn't have to freeze those other entries in TiBU like I did last time. And now turning on Root in ES File Explorer worked fine.

One other thing I wanted to mention for those having issues with the script hanging. What I always do, before running any adb scripts, is to verify adb connectivity is working properly. Launch a command prompt with admin privileges (not sure if the admin is required but I've gotten used to doing it this way for other devices so I just always do it this way now). If you don't have the android sdk installed on your PC, navigate to the directory you unzipped this batch file to and run the following command:

files\adb devices

You should see output saying the daemon is started and then it should list your phone if it is indeed detected properly. If there are no devices in the list, then you don't have proper ADB connectivity and need to troubleshoot that before attempting to run the script.

If anyone wants to provide more detail for troubleshooting ADB connectivity, please do. It's late here and I need to get to bed. :)

ETA - and because I finished catching up here before heading off to bed, I see that k1mu has already discovered and addressed the problem with the superuser prompt for adb which I discovered on my own yesterday before his fix. :) Oh well, it's all good, and with the delays put in place in the new script, should now work properly without having to run the remaining busybox commands by hand later.

Thanks for all your hard work on this k1mu. You rock dude!
[Verizon Samsung Galaxy S 4] tshelby73:
This would be one of the first root methods I've used that includes busy box. I usually had to root then install busy box from play store. Since busy box is the issue can we just get the root method only.
[Verizon Samsung Galaxy S 4] k1mu:
It's actually rooted even if the busybox install fails.

What the script does is to temp-root the phone, then install everything needed to permanently root it. It then reboots, which is necessary to enable the root to take permanently.

At that point, it executes a few commands to set the permissions on the su programs so root checkers will recognize it, then installs busybox.

On a new phone where SuperSU hasn't been run, you've got to provide permission for the ADB shell to gain root, and you have 10 seconds (that's the default SuperSU timeout) to do that. Once you give permission, it stays in place so you can execute other commands.

The current script tries to give you extra time to permit the root permission by executing several commands that really don't do anything. Once that's done, it fixes the su permisisons then installs busybox.

Those first two commands happen quickly so they're pretty reliable. Unfortunately, the busybox install takes a bit more time, so it can find itself interrupted.

The final complication is that some phones, when they're first plugged in, bring up the ADB connection, then 30 seconds drop it for about 5 seconds. If the script is working during that brief drop, you'll get errors. However, only cosmetic things are affected by that.

TL;DR: It's ok. If it gets errors after the reboot, you're probably still rooted.
[Verizon Samsung Galaxy S 4] decaturbob:
I had the custom flag on boot screen after I odin'ed the MJ7 wipe tar and before I did saferoot. I suspected it was becasue I didn't uninstall safestrap 3.65 prior to odin install. I was expecting the full wipe tarball to clear everything out but looked like it didn't. I am rooted and I have 3.70 safestrap running with HD11 on slot one. Still have custom flag on samsung boot but info in phone indicated "official". Just a nuisance at this point
[Verizon Samsung Galaxy S 4] SolidSnakeUS:
Curious, since it's a Custom flag and not tripping the warranty flag, do you still need to unroot it if you want to use the warranty? Or since that flag wasn't tripped, it should be fine? Or any rooting of any kind will void the warranty? If you do you need to unroot, what would be the best way to do so with an MK2?
[Verizon Samsung Galaxy S 4] jco897j:
Replace any bloatware removal. Undo any root specific modifications. Use the unroot in superSU
[Verizon Samsung Galaxy S 4] SolidSnakeUS:
That simple eh? Thanks :).
[Verizon Samsung Galaxy S 4] WordsworthESP:
Glad you got it working, but you didn't have to factory reset to remove root. :)

I probably shouldn't have assumed it was Busybox not installing, but i can confirm that Knox blocks something before you give permission the script, as I had the shield icon the statusbar it said security had blocked something trying to access the device. I wish I'd thought to screenshot it or write it down, but it happened very quickly.

I also think we are getting different results because this is compatible with many device and firmware builds, so I'm sure that's causing some confusion.

Sent from my AT&T Samsung S4 (MK2)
[Verizon Samsung Galaxy S 4] ravennyc:
This is genius work!!!

Took around 4 minutes to root my S4 I337 that was upgraded to 4.3 OTA by AT&T. Note: I had rooted it while on 4.2.2. Then after the OTA of 4.3 I lost root. Thanks to this method, I am back!! It doesn't matter that I cannot load other ROMs. Just having root allows us to do quite a lot. Cheers!
[Verizon Samsung Galaxy S 4] zipkicker:
i run the batch file after extracting the zip and all i get is the error

'findstr' is not recognized as an external or internal command, operable batch file or program

< was unexpected at this time

any help?
[Verizon Samsung Galaxy S 4] jball:
There is a working version of Safestrap for 4.3 MK2

SAFESTRAPPED ATT MK2 I337 S4
[Verizon Samsung Galaxy S 4] zmedhaug:
Link please
[Verizon Samsung Galaxy S 4] jball:
I didn't have the link handy but it only took me 10 minutes to remember/find it for you.its in the last couple pages of the MF3 Safestrap thread

http://goo.im/devs/Hashcode/jflteatt/safestrap/Safestrap-JFLTEATT-3.70-B01.apk

I recommend you to read up on how this "beta" version is

work/not working for different individuals.

We don't want another brick.

SAFESTRAPPED ATT MK2 I337 S4
[Verizon Samsung Galaxy S 4] zaid.oj:
am getting an error "this device is not supported"

i have the latest official OXA open Europe build I9300XXUGMK6

recently clean flashed! followed the instructions!

how did you make it work on your s3?!
[Verizon Samsung Galaxy S 4] k1mu:
What version of Windows are you using? findstr is available from Windows XP onwards (at least).

You should have a file called findstr.exe in c:\Windows\system32\. If that's there, then this is a path problem.

To fix that, open the install.bat with notepad and add the following line:

set PATH=%SystemRoot%\system32;%PATH%

just after the "@echo off" line at the top of the script. If that fixes it for you, let me know.
[Verizon Samsung Galaxy S 4] Spike96:
I have an S4 on ME7 right now, but I want to be able to install 4.3 roms with safestrap, and it is my understanding that you can only do that with an S4 on MJ7.

Can you currently safestrap with MK2?
[Verizon Samsung Galaxy S 4] roote223:
Does this work on the T-Mobile GS4 on 4.3?
[Verizon Samsung Galaxy S 4] k1mu:
Yes, safestrap is currently working on MJ7 and MK2.
[Verizon Samsung Galaxy S 4] Spike96:
Just OTA updated to MJ7. Should I stay on MJ7 and Safestrap, or update to MK2?

Or does it not matter?
[Verizon Samsung Galaxy S 4] k1mu:
It doesn't matter. Either one can run 4.3 ROMs with Safestrap.
[Verizon Samsung Galaxy S 4] k1mu:
Today's update disables SEAndroid / SELinux during the rooting process. Hopefully this will make it more reliable.
[Verizon Samsung Galaxy S 4] michaelg117:
If you have already rooted during this process is there a way to disable it?
[Verizon Samsung Galaxy S 4] Tomsgt:
Just made this video on how to root the Galaxy S4 using safe root which is really easy thanks thought you may want to add the video to the OP to help the Noobs out :)

Build MK2 or MJ7 Root video
[Verizon Samsung Galaxy S 4] orly_mihai:
This root work only for verizon phones?I have a note 3 international version n9005 with mk2 firmware version.Will work?
[Verizon Samsung Galaxy S 4] WordsworthESP:
From what I know it's for the S4, but no, it's not just for Verizon.

Sent from my AT&T Samsung S4 (MK2)
[Verizon Samsung Galaxy S 4] k1mu:
It's the same build so should have the same kernel. It can't hurt to try it.
[Verizon Samsung Galaxy S 4] k1mu:
I have a utility to do this, but it's not ready for prime time.

You would use adb to push this to /data/local/tmp, chmod it 755, then run it. Doesn't require root on the i545 MJ7/MK2.

It does require root on other phones, but if you can send me the output from running it, I can add info on those devices so they don't need root, either.

I'll probably eventually incorporate this into the saferoot installer so it's available after rooting, but first it needs to be made more bulletproof.

The link above is to the source respository. The program itself is here.

Edit: You need to run this program every boot to keep SELinux disabled. It's not a permanent fix.
[Verizon Samsung Galaxy S 4] orly_mihai:
I tryed,it's not working,say the device is not supported.
[Verizon Samsung Galaxy S 4] k1mu:
What other error did you get before the "This device is not supported" message?

What kernel version is your phone using?
[Verizon Samsung Galaxy S 4] Surge1223:
Their kernel size is too large, the getroot.c script has to be edited for the Note 3 probably have to change the kernel size and/or start address as is mentioned in the memo.txt from source. We just started working on it yesterday, I'll send you more details in a bit. Although im talking about the VZW Note 3, just assuming the international N3 prob has the same issue.
[Verizon Samsung Galaxy S 4] orly_mihai:
This is what i use is the uk official N9005XXUDMK2_N9005OXADMK2_N9005XXUDMJ7.

Surge1223 can you make one for me?Please?
[Verizon Samsung Galaxy S 4] Surge1223:
Its still in development.
[Verizon Samsung Galaxy S 4] orly_mihai:
Ok.Then i wait to be ready

Thanks.
[Verizon Samsung Galaxy S 4] zaid.oj:
am getting an error "this device is not supported"

i have the latest official OXA open Europe build I9300XXUGMK6

Here is a screenshot

Sorry to post again but no one answered me!
[Verizon Samsung Galaxy S 4] k1mu:
OK. As an alternative, if someone has a rooted Note 3, I can pre-load the right kernel routine addresses into it and avoid the scan.
[Verizon Samsung Galaxy S 4] k1mu:
The "setsockopt() failed: bad address" probably indicates that the build you're using doesn't have the vulnerability that the rooting program at the core of this uses. It's also possible that the kernel address range is incorrect for your kernel.
[Verizon Samsung Galaxy S 4] zaid.oj:
dose this mean that there is no hope to root my build in this method?

or do i keep hoping that you can make it!! :D
[Verizon Samsung Galaxy S 4] k1mu:
Most likely, this root tool won't work for your build.

It's now been verified that Samsung is rolling out OTAs the patch the bug that this uses.
[Verizon Samsung Galaxy S 4] zaid.oj:
Bad news indeed, then no more rooting I guess!

Thanks anyhow man! :sly::)
[Verizon Samsung Galaxy S 4] NyekonX:
Sadly I'm getting this >

su isn't in /system/bin so it can't complete the rest of the script. I do get an selinux (Knox?) warning though "An application attempted to access system on your device without authorization..."

I remember seeing my phone say that it updated a security policy a few days after I did the OTA update. I tried to factory restoring to see if it would remove that update, but it didn't seem to do anything :\
[Verizon Samsung Galaxy S 4] WordsworthESP:
I'm sure my post addressing this has gotten buried, but I'd recommend trying it again and make sure to keep your device awake from the moment you start running the .bat file. That was the only way I get the request permission prompt. Let me know if this helps.

Already? Jeez, I suppose they have spies everywhere. :P

Sent from my Samsung S4 (MK2)
[Verizon Samsung Galaxy S 4] k1mu:
That output says that getroot was able to obtain root and it looks like the files installed correctly.

For some reason the post-reboot stuff failed.

The "su" program is put into /system/xbin/su, not /system/bin/su. It may be that your phone doesn't have /system/xbin on the search path.

Do you have SuperSU on your phone? If so, what happens if you open it? I think you're rooted with just busybox missing, but you can install that separately. Another thing to try is to open a terminal emulator and type "/system/xbin/su" at the shell prompt.
[Verizon Samsung Galaxy S 4] k1mu:
I've just updated the OP with a version that installs an additional program that sets SELinux into permissive mode on boot.

For people who have already rooted, just re-root. After it's done, you should find SELinux in permissive mode.
[Verizon Samsung Galaxy S 4] tshelby73:
Works Great thanks, now set to permissive. Busybox worked fine too. I think most problems people were having has to do with the way S4 handles debugging. I always use my ADB fastboot folder from my galaxy nexus days to verify device before using your tool and it works fine every time. I did have an issue the very first time getting the popup on the phone until I did adb devices the first time.
[Verizon Samsung Galaxy S 4] decaturbob:
looked like all went well with the reinstall here too. good job
[Verizon Samsung Galaxy S 4] Sir_Eagle:
If we used vroot before would there be any benefit in unrooting and using this method?
[Verizon Samsung Galaxy S 4] decaturbob:
drat, I just checked. I'm still in enforcing mode so something didn't go exactly right....I'll rerun and look again

---------- Post added at 08:28 PM ---------- Previous post was at 08:21 PM ----------

I didn't have a real big command window open and missed the following on the bat execution:

/system/bin/sh: /data/local/tmp/getroot: can't execute: Permission denied

removing temporary files

I got excited that busybox installed

I am rooted...then checked the permission statues, still in enforcement mode
[Verizon Samsung Galaxy S 4] k1mu:
Have you rebooted since the installer completed?

Do you have a file called "/system/etc/install-recovery-2.sh" ? The new installer should have added that.

The other thing to try is to use "adb shell" to get a shell prompt, use "su" to get root, then "/system/xbin/selinuxoff".

Does that get you to permissive mode?
[Verizon Samsung Galaxy S 4] decaturbob:
I'll try that in the morning..phone rebooted up fine after both trys tonight. I'll check for the file and see if I can manually do it thru the shell. Thanks for all the assistance
[Verizon Samsung Galaxy S 4] SolidSnakeUS:
For the MK2 build, what is the name of the Verizon OTA update program, so I can freeze it?
[Verizon Samsung Galaxy S 4] thatdudepoops:
This is all that happen for me after a hang at pushing files. ..any suggestions?

Can't imagine it being a driver problem I have all samsung and adb drivers installed.
[Verizon Samsung Galaxy S 4] Surge1223:
One thing that id try if getroot doesnt run is to open terminal emulator and type the following in terminal

cd /data/local/tmp && ./getroot

that worked for me when I got permission denied errors
[Verizon Samsung Galaxy S 4] customize lord:
Will these methods work with the Verizon s4 running mj7?
[Verizon Samsung Galaxy S 4] SolidSnakeUS:
It should. For me to make sure, I just updated my phone again to MK2 and did it there. Really that simple. Kinda crazy how easy it was. So damn good.
[Verizon Samsung Galaxy S 4] orly_mihai:
I get this error on my note 3.

--- Samsung Galaxy S4 Android 4.3 Root ---

--- Based on the CVE-2013-6282 exploit by cubeundcube ---

Testing adb usability

Plug in your phone and Press any key to continue . . .

Waiting for your phone to appear

Your phone is detected and ready for rooting.

Sending files to your device...

1736 KB/s (17804 bytes in 0.010s)

2619 KB/s (104800 bytes in 0.039s)

2480 KB/s (2139595 bytes in 0.842s)

2397 KB/s (1109128 bytes in 0.451s)

122 KB/s (629 bytes in 0.005s)

Starting rooting program.

ro.build.product=hlte

ro.build.id=JSS15J

setsockopt() failed: Bad address.

this device is not supported.

kallsyms_addresses search failed.

Removing temporary files...

Rebooting... Please wait.

Waiting for device to re-appear...

Wait until your phone reboots, then unlock it and Press any key to continue . .

.

On your phone, give SuperSU permission for ADB shell to run

/system/bin/sh: su: not found

/system/bin/sh: su: not found

/system/bin/sh: su: not found

/system/bin/sh: su: not found

/system/bin/sh: su: not found

Installing busybox

/system/bin/sh: su: not found

/system/bin/sh: su: not found

/system/bin/sh: su: not found

/system/bin/sh: su: not found

/system/bin/sh: su: not found

--- All Finished ---

Press any key to continue . . .
[Verizon Samsung Galaxy S 4] WordsworthESP:
At the risk of sounding idiotic, do you recommend those of us who've already rooted successfully/having no issues reroot as well?

Sent from my Samsung S4 (MK2)
[Verizon Samsung Galaxy S 4] k1mu:
That setsockopt() failed: Bad address line, followed by "this device is not supported" means that your kernel has been patched to fix the vulnerability that this rooting tool uses.

Surge and I have been discussing this - he's looked at the kernel source code for the Note 3 and has verified that it's been patched.

You can't root the Note 3 using this tool.
[Verizon Samsung Galaxy S 4] k1mu:
If it's all working, it's not really going to buy you anything. I'd leave well enough alone.
[Verizon Samsung Galaxy S 4] tshelby73:
I'm on s4 but couldn't they Odin. Wouldn't that remove the patches?
[Verizon Samsung Galaxy S 4] decaturbob:
I have "/system/etc/install-recovery-2.sh". I did the adb shell su command and it came back "......selinuxoff not found"
[Verizon Samsung Galaxy S 4] gherman222:
Worked like a charm on my VZW SG3! I had to toggle back and forth between camera and media connection, but it works... and I've successfully installed AdFree (I hate ads!) and used Rom Toolbox to freeze all the bloat. Thanks to these great devs. Merry Christmas to everyone!
[Verizon Samsung Galaxy S 4] k1mu:
That's because the permissions are wrong. I've fixed the OP, but you can correct it using a root-aware file manager.

/system/xbin/selinuxoff should have permissions 755. (-rwxr-xr-x).
[Verizon Samsung Galaxy S 4] decaturbob:
apparently I don't have /system/xbin/selinuxoff in that folder
[Verizon Samsung Galaxy S 4] thajacka:
i get this far and it is unable to disable knox. any ideas?
[Verizon Samsung Galaxy S 4] NyekonX:
WordsworthESP: Nope it didn't help, I would only get a connection request from adb (Allow USB Debugging) when it does it's initial connection, which I would click okay to. Then again when it reboots, which I click okay as well. Then errors at the end happen.

ki1mu: Root Checker is returning a fail and anything I run asking for root gets blocked by KNOX. SuperSU is there and so is su in /system/xbin, I should of find /system/* | grep su at least to see if su was anywhere else. Running /system/xbin/su or just su from TE and the response is >

"su: must be suid to work properly"

From adb shell it says su can't be found even if I try hitting it with an absolute path.

SuperSU runs, but say's it binary needs to be updated. I choose continue, no TWRP or CWM so i choose normal, then it complains about KNOX - trying to disable it fails.

I saw that you just posted a new zip in the OP too, i tried that to no avail. Was hoping selinux going permissive would fix this ;D

Anyhow, thanks to you both for the help! It's appreciated. OH on a side note, I didn't really look into the .bat file - but is there any difference in them procedure wise? I've been using the.sh file as I'm on Fedora. I'ma try to look at it on my break.
[Verizon Samsung Galaxy S 4] k1mu:
When you say it "complains about Knox" is it offering to disable it, or is it saying that Knox is blocking installation of the updated SU binary?

One thing to try is to use "adb shell" to log in and try "su". Does that work?

For a phone running 4.3 with SELinux enforcing, SuperSU uses a script in /system/etc/install-recovery.sh to start up daemonsu in the background. Is that script there, and is the /system/xbin/daemonsu in place? That's usually enough to get you rooted to the point where the post-boot commands can run to setuid the su and daemonsu programs.

Sorry, lots of questions. Unfortunately, I'm probably going to have to clean off my phone (re-enable Knox), re-flash it with MJ7, etc. to test this.