[Verizon Samsung Galaxy S 4] k1mu:
Source code, Unrooting, and the Custom Flag

The source code for the exploit tool used for this rooting method is attached.

In addition, two common questions:

1. How do I unroot?

OK, so why are you so anxious to unroot just after rooting? :)

If you have used the current version of Saferoot to root your phone, then there's an unroot script installed to make this easy.

If you still have Saferoot unzipped, plug in your phone and use "unroot.bat" (Windows) or "unroot.sh" (Unix) to remove the changes that Saferoot made. Then, open SuperSU and instruct it to perform a "full unroot". After that, all changes that Saferoot have made to your device have been removed.

If you don't have the unroot.sh, then you can unroot manually as below.

There's two things you need to do to undo what this installer does. First, remove busybox. This will require adb shell or the use of Terminal Emulator to get a shell prompt. Execute the commands below at a shell prompt.

The "$" and "#" characters at the start of those lines are the system prompt. You don't type those.

Spacing, case, etc. matter. The letter after "type" in the "find" command is a lowercase L.

$ su

# mount -o remount,rw /system

# rm -f /system/etc/install-recovery-2.sh*

# rm -f /system/xbin/selinuxoff*

# find /system/xbin -type l | xargs rm

# rm /system/xbin/busybox

# mount -o remount,ro /system

# exit

$ exit

The easiest way to do this is to install the "Terminal Emulator" app from the Play Store. Or use "adb shell" to get a shell prompt.

You can cut and paste the following to make it easier.

It's very likely that the "/system/xbin/selinuxoff" and "/system/etc/install-recovery-2.sh" files won't be there.

Now, open SuperSU and use "Settings", "Full unroot". When that's done, everything that this installer has done has been reverted.

If you've installed xposed framework or wanam, you should remove those and reboot BEFORE doing the SuperSU unroot. Also, if you've installed Safestrap you'll need to boot into SS recovery, delete the custom ROM slots, then uninstall Safestrap recovery. Or, uninstall the Safestrap application. If you forget to do these before doing the SuperSU unroot, you'll need to re-root to do those.

If you need adb to access your phone, there's a copy in the "files" directory included with the installer. You'll need to open a command prompt and use cd to change to the files directory before trying to use that adb.

2. How do I get rid of the "Custom" padlock open screen at boot?

You get that because you're running custom software. Samsung has an application that runs at boot to look for modified system files; this app detects that the phone has been modified and sets that flag.

If you really need to get rid of that, you can do the unroot in #1 above, then reboot. Wait about 10 minutes or so, then reboot again. If you haven't changed any other system files, the custom flag should have been reset.

If that doesn't fix it, flash the stock no-wipe ROMs from this forum. Those will undo whatever you've changed and allow the phone to reset the custom flag.

If you want to keep root while getting rid of that "Custom" flag, then you can fake it. Install xposed framework (google for it), enable it, then reboot.

Then install Wanam Xposed, and enable that module in xposed.

In Wanam, choose "Security Hacks", "Fake system status".

That will keep the "Custom" flag from appearing. This is a cosmetic fix, but it does get rid of the "Custom" screen.