How to Install TWRP, LineageOS 16.0 and Root Samsung Tab S2 9.7 (2016) SM-T813
How to Install TWRP, LineageOS 16.0 and Root Samsung Tab S2 9.7 (2016) SM-T813
Preparation:
1. Fresh install of Windows 7 x64 with all the correct chipset and other drivers installed. (I tried this in Windows 10 x64 and Centos 8.0 Linux and FWUL Linux v4.0 and all 3 failed for me, so ONLY a fresh install of Windows 7 x64 worked for me).
2. Install Samsung Drivers on the Windows 7 x64 PC (Samsung-Usb-Driver-v1.5.63.0).
3. Download Odin (Odin3 v3.13.1).
4. Copy your LineageOS ROM (lineage-16.0 nightly.zip), TWRP Recovery (twrp-3.3.1-0-gts210vewifi.img.tar and also twrp-3.3.1-BETA07-gts210vewifi.img by Akipe from XDA-Developers) and Magisk (Magisk-v20.1.zip and also MagiskManager-v7.4.0.apk) and GAPPS (MindTheGapps-9.0.0-arm64-20190615_031441.zip) files on a micro SD card.
Actual installation of TWRP, LineageOS 16.0 and Rooting using Magisk:
1. Connect the USB cable to the PC ONLY first. Then on the tablet go into Download mode by first switching off the tablet, then when off, press Power, Volume UP and Home buttons. Then you will have to press the volume up key to accept the warning. When it says 'Downloading', THEN connect the USB cable into the tablet.
2. Flash TWRP recovery using Odin (Odin3 v3.13.1). Make sure to select 'AP' and choose the TWRP image (twrp-3.3.1-0-gts210vewifi.img.tar), and in options, do NOT select 'Auto Reboot', instead ONLY select 'F.Reset Time' Click on 'Start', to start flashing and read the log until it says 'success'. Once done installing successfully, disconnect the USB cable, DO NOT reboot back into System
3. After TWRP flashing is finished in Odin, DO NOT reboot back into System - Press Power, Volume DOWN and Home buttons, when the screen goes black, then immediately change to Power, Volume UP and Home, then it will go into TWRP Recovery again.
4. Make sure to go to Wipe, Advanced Wipe and wipe ALL partitions (EXCEPT micro SD and USB OTG) for a clean install, but ALSO go back to wipe the '/Data' partition to F2FS by going into 'Advance Wipe' and selecting 'Data', then say 'Change File System', then select F2FS. If you don't format to F2FS, you will keep getting a Failed to mount '/Data' error and the tablet will go into a reboot loop to reset the encryption because it cannot mount '/Data'. This is important.
5. After wiping all the partitions, Reboot back into recovery (DO NOT reboot back into system yet) go back to TWRP home screen and select 'Install' then 'Select Storage' and select the micro SD, then select the other TWRP file by Akipe (twrp-3.3.1-BETA07-gts210vewifi.img) this has some improvements as mentioned earlier in this post by Akipe himself (Thanks Akipe

). Then again reboot back into recovery (NOT System) and it should be 'twrp-3.3.1-BETA07-Akipe'.
6. When In recovery again select 'Install' then 'Select Storage' and select the micro SD, then select first the 'lineage-16.0 nightly.zip' then add 'Magisk-v20.1.zip' then flash. This should flash successfully, if there are no ERRORS, you can reboot back into the system and continue to set up the tablet. If there are errors about 'Failed to mount '/Data'' then you need to repeat step 4 above making sure 'Data' partition is formatted to F2FS.
7. If LineageOS boots up successfully, Reboot back into recovery and 'Install', 'Select Storage' then select the Gapps file (MindTheGapps-9.0.0-arm64-20190615_031441.zip) and flash it, then reboot back into the System.
8. You should be OK to start using Google Play to install the apps you need. Also while in LineageOS you can access the micro SD and install MagiskManager-v7.4.0.apk and don't forget to install stericsson busybox to xbin (from Google Play)
I Hope that helps someone as I had a lot of frustrations trying to figure this out as nothing was working for me, with all the guides that are on the internet. All the best!
