[Samsung Galaxy J5 Guides, News, & Discussion] J5 Guy:
There is already guide how to root Galaxy J5 with SuperSU. In 2015 Chinese company CCMT bought SuperSU from Chainfire and the original code is no longer developed. In this tutorial you will learn how to root your device with topjohnwu's Magisk.

1. Install required software​

1.1. SD Card​

Make sure that external SD Card is inserted into your phone and has free space.

1.2. adb​

Download platform tools: https://developer.android.com/studio/releases/platform-tools

Extract it somewhere on your hard disk, then:

1. Open terminal

2. Navigate to extracted platform tools, e.g. cd C:\platform-tools

3. Make sure that adb works by typing adb help

1.3. ODIN​

There is no official download on Samsung site. There are many third-party websites with Odin download. I don't know which are legit and which may contain malware. It's up to you to find a trusted source and scan it on VirusTotal. Version 3.13.1 is to download from this thread:

Patched Odin 3.13.1

For those looking for a modified, modded, or patched odin that is a newer build than all the fake and renamed prince comsy 3.12.3 versions floating around. I patch recent Odin versions to offer similar functionality to the princecomsy; in that...

xdaforums.com

For Linux there is a tool Heimdall (not tested) and JOdin created by community:

https://xdaforums.com/t/utility-odin-for-linux-jodin3-casual.3777030/

1.4. TWRP Recovery​

For J500FN download latest tar from: https://eu.dl.twrp.me/j5nlte/

For other devices find there: https://twrp.me/Devices/Samsung/

Read FAQ before use: https://twrp.me/FAQ/

1.5. Magisk + Magisk Manager​

Download Magisk (.zip file) and Magisk Manager (.apk file) into external SD card.

Download file: https://github.com/topjohnwu/Magisk/releases

Installation manual: https://topjohnwu.github.io/Magisk/install.html

1.6. SmartSwitch for backup​

Download for Windows: https://www.samsung.com/us/support/owners/app/smart-switch

2. Make Backup (optional, recommended)​

On Windows:

1. Disconnect phone from PC.

2. Install Smart Switch.

3. Connect phone when prompted.

4. Make backup (you will need 8 GB free space on disk).

On Linux:

You may try running SmartSwitch on Wine or make image of whole internal memory:

adb pull /dev/block/mmcblk0 mmcblk0.img

3. Enable USB debugging​

In your phone:

1. Settings -> About device -> Software info -> Build number (tap it quickly 7 times)

2. Settings -> Developer options -> USB debugging (enable it)

3. Settings -> Developer options -> OEM unlock (enable it)

Note: If you disable OEM unlock, then you will brick your phone.

4. Install Magisk Manager​

Navigate to external SD card on your phone and install Magisk Manager from .apk file.

5. Open Odin and enter download mode​

1. Make sure that battery is fully charged. If no, charge your phone first.

2. Unplug phone from computer.

3. Open Odin program on your computer.

4. Turn off phone - hold power button (the one on right side) and tap Power off.

5. Press (starting in this sequence) and hold: Home + Volume down + Power.

6. Green screen should appear. Press Volume Up to dismiss warning.

7. Plug phone to computer.

8. In Odin you should see "Added!!!" in Log tab.

Note: If there is no "Added!!!" in Odin tab, then do not proceed and fix connection.

9. In Options tab turn off Auto Reboot

10. Click AP button and select previously downloaded .tar file.

11. Click Start

12. After you see green "Passed", unplug phone from PC and remove battery.

13. Insert battery again.

14. Press (in this sequence) and hold: Home + Volume up + Power

15. Now KNOX is over (0x1)

16. You should see TWRP. Allow modifying system partition by moving strap right.

17. Tap Install and find .zip file on your external SD card. Note that if you fail to install MagiskSU now, then during reboot original Samsung's recovery will be restored and you will need to flash TWRP again, starting from point 5.1.

18. Now you may plug phone to PC.

6. Install Magisk Manager​

1. Boot your phone to system.

2. Run Magisk Manager and check if your phone is rooted.

3. Check if you may access root from shell:

adb shell su root ls -al /data

4. Enable screen on your phone and gain root access to shell.

5. In terminal you should see /data directory listing.

7. We're done - what next?​

Now you have great power and great responsibility because you may easily destroy your system or even brick your phone.

Q: My bank app is not working or NFC doesn't work​

A: Magisk Manager allows to trick SafetyNet feature and hide the fact that your phone is rooted. If this doesn't help, you will need to repackage Magisk. That is also available from official Magisk Manager app.

Q: Why there is less and less free space after upgrading system apps?​

A: Look at mount points with disk usage by typing in adb

adb shell
su
df

You will get long output. I cutted less important lines and included the most important ones:

root@j5nlte:/ # df
Filesystem Size Used Free Blksize
/dev 681.7M 144.0K 681.5M 4.0K
/system 2.0G 1.4G 620.8M 4.0K
/data 4.7G 3.5G 1.2G 4.0K
/efs 9.8M 332.0K 9.4M 4.0K
/cache 192.8M 3.7M 189.2M 4.0K
/persist 3.9M 104.0K 3.8M 4.0K
/firmware 64.0M 11.5M 52.5M 16.0K
/mnt/media_rw/0000-0001 14.8G 11.2G 3.6G 32.0K

Notice that in above output /system is only 1.4 GB used because I removed many bloatware.

Answering the question, when you update system app, the original .apk remains on /system partition and the updated one is installed into /data partition. You will also notice that if you downgrade to original version in Application manager, then you free up space.

Q: Can I move updated app to /system?​

A: Yes, you may make any application a system app using Link2SD from Google Play. However, app will be reinstalled again and you will lose all settings, user data, etc.

Note: if you update app, it will be installed again in /data

Q: How to move app to /system without losing data?​

A: You may move app to /system and make symbolic link in /data:

su
mount -o rw,remount /system
mkdir /system/data-apps
mv /data/app/pl.blinkee.mobile-1 /system/data-apps
ln -s /system/data-apps/pl.blinkee.mobile-1 /system/app/pl.blinkee.mobile-1

Note: you must remount /system partition to read-write as in above example.

Note: you cannot make hard link between partitions so if you update app, it will override link in /data

Note: I will experiment with a cron job that pushes updated apps back to /system

Q: How to repartition internal memory?​

A: You can't from adb. The only way is Odin and modifying PIT via zip file. Try for your own responsibility: https://github.com/Lanchon/REPIT

Q: How to enable adoptable storage?​

A: Adoptable storage allows you to extend internal memory with external SD card. It's not possible without applying a patch. This will slightly decrease peformance. Refer to this thread for more details:

https://xdaforums.com/t/root-and-fi...h-optional-adaptable-storage-enabler.3691516/

Q: How to move app to external SD card?​

A: You may move apps to external SD card in Settings in Application Manager or in Link2SD. But after you update app, it will be installed in internal memory and you can't change this behavior in official ROM. Paid Link2SD version also moves and links data and dex files.