yashsingh1/xdaforums huggingface dataset:
[Verizon Samsung Galaxy S 4] k1mu:
That's strange. Can you try the following from "adb shell"?

ls -lZ /system/xbin/daemonsu*

lsattr /system/xbin/daemonsu

ls -lZ /system/xbin/su

lsattr /system/xbin/su

The code got root, managed to put the su binary in place, and was able to use it (apparently) to install busybox after a reboot.

But it couldn't get daemonsu installed, but perhaps it was already there from an earlier install?

Something's got daemonsu locked - perhaps set immutable so it can't be deleted. Or, a SEAndroid thing blocking writing that file.

(The rooting program already moves the file to daemonsu.old if it's already there before writing a new copy.)

Another thing to do is to use "adb shell" to log in to the phone (note: NOT Terminal Emulator), and try just "su". Does it give you a "#" prompt?

Can you then do root things like "mount -o remount,rw /system"?
[Verizon Samsung Galaxy S 4] AndroidCraig:
I'll give this a try when I get home this evening.

I tried this on a freshly wiped/Factory reset phone. So there could not be anything from an ealier install. I was rooted before I took the OTA upgrades to MI1 and MK2. but them I lost root. Wiped the phone and tried to root with Saferoot. That failed. I rewiped and tried vRoot Also to no luck. Then Re-wiped and tried Saferoot again (where I am now).
[Verizon Samsung Galaxy S 4] k1mu:
OK, so let me know when you try the commands above.

It may be that enabling SuperSU Survival Mode did something to prohibit writing a new daemonsu, but that doesn't seem to do anything bad for me.

I'm going to try re-rooting my MK2 phone with survival mode on to see if there's any problems there.
[Verizon Samsung Galaxy S 4] LightsPlease123:
I've never rooted a phone before but my main interest is in turning off some of the settings, not so much about upgrading the software. My baseband number and build number both end in MK9 so i assume that's what version I have? I'm on 4.3 with knox already. Will this solution allow me root access without tripping the knox warranty counter?

Thanks for your help!
[Verizon Samsung Galaxy S 4] AndroidCraig:
Here's the result of the commands in adb shell.

C:\Users\Craig\Downloads\saferoot\files>adbshell

'adbshell' is not recognized as an internal or external command,

operable program or batch file.

C:\Users\Craig\Downloads\saferoot\files>adb shell
shell@jfltevzw:/ $ ls -lZ /system/xbin/daemonsu*
ls -lZ /system/xbin/daemonsu*
-rwxr-xr-x root shell u:object_r:system_file:s0 daemonsu
shell@jfltevzw:/ $ lsattr /system/xbin/daemonsu
lsattr /system/xbin/daemonsu
-----i--A---- /system/xbin/daemonsu
shell@jfltevzw:/ $ ls -lZ /system/xbin/su
ls -lZ /system/xbin/su
-rwxr-xr-x root root u:object_r:system_file:s0 su
shell@jfltevzw:/ $ lsattr /system/xbin/su
lsattr /system/xbin/su
--------A---- /system/xbin/su
shell@jfltevzw:/ $ su
su
255|shell@jfltevzw:/ $

So no # when I tried SU.

What should I try next?
[Verizon Samsung Galaxy S 4] k1mu:
This is interesting - here's what this tells me:

That little "i" says that the daemonsu binary is marked as "immutable", i.e. can't be written, deleted, or otherwise changed.

I've verified that SuperSU doesn't do that, so it's not a normal thing.

I'll update the rooting program to clear that. Hope that'll fix it.
[Verizon Samsung Galaxy S 4] AndroidCraig:
Thanks. is there anything I can do to clear it in the mean time?
[Verizon Samsung Galaxy S 4] k1mu:
Try the fix in the OP and let us know if that works. :)
[Verizon Samsung Galaxy S 4] AndroidCraig:
Nope. Same issues. After the 1st reboot it doesn't find my phone unless I unplug and replug it in. Super user can't update and I get the same messages.

My splash screen shows the unlocked Custom setting is that a suspect? Can I reset it?

Should I factory reset again?
[Verizon Samsung Galaxy S 4] AndroidSmitty:
does this root method require the SD card to be a 64gig and formated in a certain filesystem? i have the 32gig SD card. i am running the 4.3 ota version of Android that was released by Verizon. my device is the Verizon Samsung Galaxy S4 and i think its called black mist or bliss, something like that anyways.
[Verizon Samsung Galaxy S 4] timberwolf60:
I had the same problem on my i9506 running 4.2.2. I can flash the rom by odin and can't root it by kingo root on my windows 7/32 and windows xp. Last I tried was removed the battery and inserted the usb jig to download mode. Flashed the firmware. After that I abled to root it.
[Verizon Samsung Galaxy S 4] tshelby73:
This root method doesn't use your memory card so it doesn't matter if you even have one inserted. I prefer exfat myself so I can load larger than 4gb files if course most files are not that big I was just messing around and ripped 7gig a1080p video to see if it would play.
[Verizon Samsung Galaxy S 4] k1mu:
Factory Reset isn't likely to help. I'd flash a full-wipe MJ7 (The "Emergency Recovery" ROM found in this forum.) That will remove the "Custom" until you re-root, (If the "custom" thing bugs you, read post #2.)
[Verizon Samsung Galaxy S 4] daniel4653:
worst case I try this method on my sprint gs4 and it doesn't work. it won't trip Knox at all correct?,
[Verizon Samsung Galaxy S 4] Nergal di Cuthah:
If by trip knox you mean the counter that voids warranties, it has already explained that pass or fail that counter will not be changed or touched so you are safe
[Verizon Samsung Galaxy S 4] daniel4653:
Thank you very much.
[Verizon Samsung Galaxy S 4] HydraS4:
Just rooted my Verizon GS4 MK2 using this. Thank you! Worked smoothly.
[Verizon Samsung Galaxy S 4] doncaruana:
Any thought to updating the version of SuperSu in the installation? The one in there now is 1.80. I posted the change log since 1.80 below for convenience. Would updating it maybe help some of the issues some people are seeing?

SuperSu recent change log:

10.01.2014 - v1.89 (non-Play for now ?)

- Add support for Samsung 4.4

- Update copyright notices to 2014

17.12.2013 - v1.86

- Fixed non-priv root on some SELinux/Enforcing devices

- Fixed crash on credit display on older devices

- Updated language files

15.12.2013 - v1.85

- Fix su to non-root user on 4.3+

- Fix su permission reset on 4.4 (will not be an issue until Samsung comes out with stock 4.4 ROMs)

- Fix am crash due to external storage not being defined

- App now offers to install backup script if ROM supports it

- Expand trust system setting to include all higher-than-shell users

- Added credits display

- Completely removed nag capability

- Lots of code changes
[Verizon Samsung Galaxy S 4] ahmadkamalrmc:
Thanks a million :good:

worked fine on N7100XXUEMKA
[Verizon Samsung Galaxy S 4] k1mu:
I think the kit in the OK has the latest 'su' binary, but it can't hurt to update to the latest SuperSU.

I'll post an update in a few minutes. Thanks!
[Verizon Samsung Galaxy S 4] rvyhmeister:
SuperSU issues with the process

I have an AT&T S4, with MK2... no errors, but when it comes to SuperSU, it gets to the point that it asks if I want to disable Knox or cancel... and then it immediately says "Failed to disable KNOX!"

Interestingly, when I connect via ADB to the shell, the prompt changes from

shell@jflteatt:/ $

to

255|shell@jflteatt:/ $

ls -l /system/bin/su

-rwsr-sr-x root root 46596 2014-01-12 22:37 su

Thanks for any assistance!
[Verizon Samsung Galaxy S 4] k1mu:
What happens if you try "su" at the shell prompt?

As far as disabling knox, what does

pm list packages -d

show?

What I'm doing to try to stop Knox is

pm disable com.sec.knox.seandroid

you could try that if it doesn't show up in the "pm list" above.

Unfortunately, the ATT S4 has a slightly different security policy from the VZ one from what I can tell. Trying to figure this out has been difficult without a phone to poke at.

You might ask about the Knox disable failure in the SuperSU thread and see what chainfire has to say.
[Verizon Samsung Galaxy S 4] kabalk:
Hello

This method works for the i9506?

I have read that there is a problem for this model.

I want to do Root , but I worry Knox Warranty.

Someone with i9506 could give me some indication?

Thanks and regards.

Thanks for the work, k1mu.
[Verizon Samsung Galaxy S 4] postal302:
I know this may be a bad question and I'll probably catch flak for asking but do you know if this might work on the Verizon S4 Mini (SCH-I435)? My brain is tired from hours of googling and XDA searching (plus my 12 month old had me up at 3:45 this morning) and I'm not turning up much. I want to root my wife's mini but definately don't want to use Kingo or any other questionable methods.

I don't have it in front of me, but I'm pretty sure it only has 4.2.2 installed on it (not 4.3 yet) and I don't know about knox.
[Verizon Samsung Galaxy S 4] k1mu:
It really depends on what kernel is installed on the I435. However, as I've said a lot in this thread, there's no risk to trying. If it fails, nothing will be damaged. For example, this works on the i545L as well as the i545.

What build is the i435 running, and what kernel revision?
[Verizon Samsung Galaxy S 4] k1mu:
I don't think anyone has reported on being able to root the i9506. What build and what kernel revision are you running?
[Verizon Samsung Galaxy S 4] postal302:
I like those odds!! I'll get my hands on it this evening when I get home and report back my findings.

Thanks for all the work on this and the fast replies!!
[Verizon Samsung Galaxy S 4] andQlimax:
[MENTION=3940199]k1mu[/MENTION] could this exploit works for Nexus 5 also (kernel 3.4.0)? It should be safe to try? at worst I will not get root I guess :)

I know nexus are easy to root, and i perfectly know how, but lazy to loose data with bootloader unlocking :D

I'm willing to try if there are no particularly contraindications (except for the part of the script which disable knox which I will remove)

thanks

EDIT: the experiment failed, it didn't work on my nexus 5, nothing bad happened anyway :)
[Verizon Samsung Galaxy S 4] postal302:
So now that I'm hands on with the phone here's the info:

Build: JDQ39.I535VRUAMK5

Kernel: 3.4.0

I might get time to do it tonight, well see what happens.
[Verizon Samsung Galaxy S 4] bgmg:
Ted, great thread...I have a couple of constructive suggestions

Hey Ted. Thanks for the help rooting. This is a great thread. Here's a couple of constructive suggestions for your awesome thread. In step 4 change "Tools" to "Files". The folder name is "Files" not "Tools".

On step 5 when I executed the install.bat it hung. I had turn the "Alllow USB debugging?" off and back on again, and then run the install.bat again, and then it worked perfectly. So, this may be something you want to add to step five if a person gets hung like I did.

I also think it would be good to instruct your users to go slow and and be patent after executing the install.bat to make sure they read all the instructions and questions that come up after executing the install.bat. It's easy to think it's finished and get ahead of it by removing the phone early and not wait for the next prompt or even to answer the prompts wrong. As I recall, there were several questions and instructions that come up after executing the install.bat, I kept thinking it was finished and almost unplugged the phone early a couple of times, when suddenly more instructions came up about SuperU and other things.

All that being said, this is a awesome thread and you provided great support. Thanks Bro.
[Verizon Samsung Galaxy S 4] k1mu:
On behalf of Ted (whoever that is?), thanks. :)

I've tweaked the OP based on your comments. The "files" vs "tools" oops was a good catch. ::good:
[Verizon Samsung Galaxy S 4] daniel4653:
Well I can confirm that this method does in fact work for the Sprint Galaxy S4. Thank you.
[Verizon Samsung Galaxy S 4] Mauri65:
Same SU issues as others here

Hello,

I am having the same issues described by a couple of posters before me.

I updated from rooted MF3 to MK2 through OTA, with Survival mode enabled. SU is obviously still there but as I click on the icon, it asks me to update the binary. I tell to install the binary in normal way, but the KNOX warning shows up. Choosing to disable KNOX also fails, while choosing to NOT disable it produces a message of failed installation. So I tried this saferoot, and while it says that I got root, it stops at the daemonsu denied permission.

What also puzzles me is that Android Explorer works, unlike all the application in the phone that require root.

Root Checker says I am not rooted.

Typing SU at $ prompt on Terminal Emulator yields a "must be suid to work properly" and no # sign.

What is left to do now, Best Buy/Samsung to reflash a stock 4.3 MK2?

Thank you so much for your help.
[Verizon Samsung Galaxy S 4] postal302:
This worked like a dream on the S4 mini!! The only part I was unsure about was when Super SU was installing and asked if I wanted it to try to disable knox. I got nervous about the words "try to disable" and "knox" in the same sentence so I chose no. The rest of the process went smooth as silk and the phone is successfully rooted!

I can confirm this working for the Verizon Galaxy S4 Mini SCH-I435!

You do awesome work here k1mu! Huge thank you!
[Verizon Samsung Galaxy S 4] pGuerrerox:
nice guide. easy to follow!

you guys are the best!

next step unlock this damn phone!
[Verizon Samsung Galaxy S 4] Nergal di Cuthah:
ImHO i'd unroot from within SU and try the script again, survival mode wouldn't have survived some of your ota. You may even have to run an odin nowipe (or maybe full wipe i'm still a bit new to all this). But it sounds from the reply to othe posters that something was left behind from old root. also check that you have the latest script as I thought the OP was adding a pre cleanup.

From what I've read root checker isn't always correct (though I may be wrong there) but the other stuff you said coincides with the assessment that root is not achieved

Edit:what device are you? I don't remember mf3. Are you an AT&T S4?

I this what you were trying? http://xdaforums.com/showthread.php?t=2387577
[Verizon Samsung Galaxy S 4] guut13:
Thank you. Great instructions and your install script worked perfectly.
[Verizon Samsung Galaxy S 4] k1mu:
What phone are you doing this on, ATT Galaxy S4?

I've asked several ATT users questions to help get to the cause of this. Unfortunately, I haven't gotten any answers, so I'm still casting about in the dark trying to discover the cause.

I think what's going on is that your SEAndroid policy has been updated to disallow creating a setuid root "su" program.

Or, it may be that the way SuperSU is expecting to start the daemonsu program at boot isn't in place.

If you're willing to try another revision of the rooting script and program, and can capture the output from the script, please let me know. I'll try adding a bit more diagnostic info to the output to see if I can discover what's going on.
[Verizon Samsung Galaxy S 4] Mauri65:
I apologize. Yes, ATT S4, i337. I am more than willing to try to unroot since I am in a sort of limbo. I used the last version of saferoot which should include a pre-cleanup. Something was definitely left behind from the old MF3 root, since I got the "Custom" logo right from the OTA to MK2. Is it possible to unroot if I cannot access SU menu?

I am more than willing to contribute to the solution to this issue, provided I will not mess up the phone too much :). I assume that, worst case, not much will change from current situation.

Again, thank you guys for your time!
[Verizon Samsung Galaxy S 4] k1mu:
The changes that I've made are trying to just add more attempts to override whatever's blocking the SuperSU install, so not likely to mess you up.

Please download the "saferoot-test.zip" attachment from post #2 in this thread and give it a try. This version of the rooting program is more aggressive about getting an old "daemonsu" out of the way, and tries a new scheme for blocking Knox.

I'm also verifying that the initialization file that runs daemonsu is still in place. There's extra output that will help with answering some of my questions about what's going on.

Maybe this will work better, but in any case, please capture the full log from the attempt even if it works - on the command prompt window that opens when you run the "install.bat", click on the icon in the upper right corner of the window (icon "C:\"), choose "Edit", then "mark". Now use the scrollbar to view the top of the log, click and hold the mouse while dragging to the bottom of the window to select, then hit "Enter". (or icon click, Edit, Copy.) That will copy the text to the paste buffer, so you can paste it into a reply.
[Verizon Samsung Galaxy S 4] Mauri65:
Here it is. I launch the install as admin. At "Press any key to continue" phone displays the Google message "offering" to monitor potentially harmful apps :). I chose to dismiss.

--- 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...

[*] Displaying initial status

-rwsr-sr-x root root 104500 2014-01-12 17:01 daemonsu

[*] Starting rooting program.

ro.build.product=jflteatt

ro.build.id=JSS15J

Succeeded in getroot!

Remount success!

Found flash_recovery line!

service flash_recovery /system/etc/install-recovery.sh

class main

oneshot

service racoon /system/bin/racoon

Copying files..

Error opening /system/xbin/daemonsu for write: Permission denied

Done.. reboot to enable root!

[*] Removing temporary files...

[*] Displaying root status

-rwsr-sr-x root root 104500 2014-01-12 17:01 daemonsu

-rwsr-sr-x root root 104800 2014-01-14 21:59 super

lsattr: reading /system/xbin/su: Permission denied

-----i--A---- /system/xbin/daemonsu

--------A---- /system/xbin/super

[*] Trying to disable Knox...

And here the phone show notification that an application is trying to install bla bla bla...it looks the shield of Knox...
[Verizon Samsung Galaxy S 4] k1mu:
No need to run as administrator, but that's not important.

Before saferoot tries to root your phone, you already have a "daemonsu" program that's already ready to go. There's no "su" program, though.

You may be able to get root using "daemonsu" from an adb shell.

While trying to gain root:

This means that the "install-recovery.sh" that runs the daemonsu at boot is going to be run. That's good, since that's necessary for a 4.3 system.

OK, that's not good. Something is locking that down, but what?

Before reboot, you've got a daemonsu which is usable, but the normal "su" program has been tampered with by something on your phone.

Something locked down /system/bin/daemonsu with the "immutable" flag, which is that "i" in the listing above- that keeps it from being deleted, written, renamed, etc. This is not good.

And? Where's the rest of the output? What happened when you rebooted, and what was displayed? Apparently the attempt to disable Knox failed.

If you've rebooted, try using "adb shell" to connect and type "super" (without the quotes) at the prompt. Does that get you root ("#" prompt?).

Unfortunately, since you didn't complete the rooting sequence so you haven't given me the information I need. There were several probes of the phone post-reboot that would give further information.

At this point, you've got a rogue daemonsu installed that's not allowing anything else to override it. The rooting program is coded to work around that, but it's not working even though it's running as root. It may be that you'll have to install a factory full wipe ROM to remove that vestige of an earlier rooting attempt, but it may be the case that ATT added that to their ROM to block SuperSU. I've no idea at this point. I'm thinking about removing the KNOXAgent.apk, but that may or may not fix it. Or, it'd require two root attempts before it would work. There's not enough information to tell yet.
[Verizon Samsung Galaxy S 4] Sniper_5:
Laptop can't seem to find ADB most times. I used [MENTION=302893]adb[/MENTION] shell and managed to get it running, had to copy and paste the text from the file as running it resulted in it opening the cmd prompt instead and throwing an immediate "not found ". Once run everything comes up as file not found and fails. Then reboots the device. Apparently I need sleep and a lot more reading. Any insight is appreciated.
[Verizon Samsung Galaxy S 4] k1mu:
I just updated the OP with a new version of the batch file and to include adb.exe with the zip. That way folks don't need to install ADB just to run this rooting tool.

The problem with trying this using terminal emulator is that apparently SELinux permissions are blocking that user from writing to /data/local/tmp and that's a crucial part of this rooting method. So, running it from Terminal is out. Hopefully the current install.bat will work for everyone without anything special. Terminal users are blocked from running anything from removable media, so we can't use the exFAT-formatted sdcard method that ME7 used.

I've added a few more setup hints in the OP - how to get the drivers and how to enable USB debugging.
[Verizon Samsung Galaxy S 4] k1mu:
Sweet. That's great news.

As far as the custom screen, you don't need to worry about that. It's either rooted and custom or not rooted.

If you ever need to fix that (for warranty return, etc.) just flash a no-wipe Factory Stock ROM using ODIN.
[Verizon Samsung Galaxy S 4] k1mu:
There's no way to install a custom recovery on anything later than MDK unless and until someone finds a way to unlock the bootloader.
[Verizon Samsung Galaxy S 4] k1mu:
I included adb in the .zip this morning - re-download and give it another try.
[Verizon Samsung Galaxy S 4] Craleb:
OK so this morning I switched computers and ran the new install.bat with the adb.exe in the /files

AND IT WORKED!

i opened superSU and it said how would you like to install binary i chose "normal"

it did that then it said "samsung knox detected. Knock may limit root access. would you like to try and disable"

i clocked yes

"Success knox disabled. it is recommended that you restart your device"

restart

BOOM DONE

THANKS SO MUCH!!!!

Edit: and Knox is still 0x0

[MENTION=4939386]Surge1223[/MENTION] and [MENTION=3940199]k1mu[/MENTION] for real thank you guys.:thumbup: I live for rooting and flashing but I am too stupid to do it myself so I am soooo so thankful for people like you! You make xda xda a better place! I'm sure if anyone can figure out how to safestrap or Completely flash this beast it will be one of you. And I'll be here to test it. :thumbup:
[Verizon Samsung Galaxy S 4] maniaryan:
Gonna give it a go on a Mac probably today after class, awesome job guys! Can't wait!
[Verizon Samsung Galaxy S 4] ravi_mytouch:
Will this work on ATT MJ6

Great Great Job and Many thanks for the excellent work!!!

Please let me know if this works on ATT S4 (i337) on MJ6.

I appreciate so much, the alternative you have provided.

I was fence sitting on whether to use the Chinese methods.
[Verizon Samsung Galaxy S 4] Swimboy46163:
Mac using Windows virtual machine right?
[Verizon Samsung Galaxy S 4] tyson10:
how does 1 go about checking the knox counter?
[Verizon Samsung Galaxy S 4] Cares:
Question before I go through all of this. If I gain root access, will I be able to freeze/uninstall system apps despite not having S-OFF or a custom recovery? Will Adblock and also Tether work if I just have root?
[Verizon Samsung Galaxy S 4] maniaryan:
Yup! Or I might try my roomates pc, I'll let ya know.
[Verizon Samsung Galaxy S 4] dgutierrez04:
To answer ur question. Yes you will be able to freeze/uninstall system apps. But if u uninstall systems apps if samsung sends another update it u will need KIES to update ur phone which u will lose root. Is better to just freezing the apps in my opinion. Adblock will work. And getting with tethering I have wifi tethering router http://play.google.com/store/apps/details?id=net.snclab.wifitetherrouter is only for 1.95 in the playstore it works wonders. But that app is for rooted phones. Which u will have if u root.
[Verizon Samsung Galaxy S 4] Craleb:
Boot into download mode and it will show knox status.

Volume down+home+power button