[Samsung Galaxy S 5 Unified Development] curiousrom:
S5 LineageOS Super Clean Install - Magisk Problem

For the official LineageOS installation or upgrading instructions see https://wiki.lineageos.org/devices/ > {your device}. Note that the wiki does not mention TWRP & uses Heimdall instead of Odin.

On a Windows computer Odin is much faster & easier to use to install TWRP compared to the finicky Heimdall that requires drivers that in turn breaks Odin & that's why I wrote this tutorial.

If you are running the stock Samsung OS (or want to install it to rule out a possible hardware problem) see the chapter below: Flashing TWRP Recovery on S5 with Stock Samsung Firmware. The sequence is > Samsung OS > flash TWRP custom recovery > backup the EFS partition > Flash LineageOS + optional packages if you wish.

If you are running unofficial LineageOS 16.0 on your S5 klte + variants or official LineageOS 14.1 or 15.1 see Official 16.0 for S5 2019-03-01 - Dirty Flash Report and you can install official 16.0 with the proper Open GApps ARM 9.0 & just a System + caches wipe.

If you are running a custom ROM (OS) & custom recovery and you want to start from the ground up & do a really S5 LineageOS super clean install:

Make sure you have the most recent TWRP if you want the built-in LineageOS OTA Updater to work properly (see How to Update TWRP Using TWRP Itself) and the most recent bootloader & modem (how-to update).

Optional: Then after backing up your external Micro SD Card to computer, format it as Portable storage using the phone itself: usually the default file explorer has this function. Stock Files explorer formats the Micro SD card to the FAT32 file system so it you use a computer to format your card that's what the S5 likes by default but you can also use exFAT. Adoptable storage is not recommended on the S5 as explained here: Micro SD Card as Internal Storage - Adoptable Storage.

Copy to external Micro SD Card the Official LineageOS 16.0 ROM for the S5 klte & variants for your exact phone model:

klte - SM-G900AZ, SM-G900F, SM-G900M, SM-G900R4, SM-G900R7, SM-G900T, SM-G900V, SM-G900W8, SM-S902L

klteactivexx - SM-G870F

kltechn - SM-G9006V, SM-G9008V

kltechnduo - SM-G9006W, SM-G9008W

klteduos - SM-G900FD, SM-G900MD

kltedv - SM-G900I, SM-G900P

kltekdi - SCL23 & SC-04F

kltekor - SM-G900K, SM-G900L, SM-G900S

And if you wish Open GApps ARM 9.0.

Note: if you are installing LineageOS 17.1 you need Open GApps ARM 10.0.

I prefer the smaller Pico package & just add the extra apps I need from the Play Store or https://f-droid.org/ . See Open GApps Package Comparison.

Rule of thumb: the larger the GApps package the more chance of installation errors.

For root you can chose either the LineageOS 16.0 addonsu ARM and the addonsu-remove-16.0-arm-signed.zip from the same page which should be copied to your external SD card just in case you need it in the future to solve a root problem or if you want to switch to Magisk. Note: the addonsu does NOT work on LineageOS 17.1. Only Magisk workes on that version.

Or the Latest Stable Magisk (Release thread), Latest Magisk Manager.apk & Latest Magisk uninstaller. Beta is not recommended.

Note: in TWRP MTP file transfer is enabled by default. So you can boot in TWRP, connect to computer & transfer the files to be flashed to the external Micro SD card.

*

Sync all your > Settings > Accounts one by one. To avoid some restoring Google Backup problems reported by some users set Screen lock to None, remove SIM lock if you have one & force a fresh > Settings > System > Advanced > Backup or > System > Google > Backup + a Chat backup in WhatsApp's Settings if you use that app.

You can also screenshot or write down your working APN settings before flashing 16.0 so you can use that info in case of a problem connecting to your network provider.

In TWRP backup to the external Micro SD Card the very important EFS partition as described in No Network, No EMEI & EFS Partition Restore Fix

Then after backing up the internal sdcard, in TWRP use Format Data which rebuilds the entire file system of the Data partition including the internal sdcard instead of using wipe that only deletes files of Data without affecting the internal sdcard (screenshot).

See TWRP FAQ: What is a data/media device? for detailed explanations:

Format Data adds an empty section after the Data partition for some future encryption related data which is required if you decide later to encrypt your S5: A.K.A. encryption footer.

In TWRP after Format Data > Advanced wipe of Cache, Dalvik / Art Cache, System like in the last attached screenshot below and reboot to Recovery before installing the LineageOS ROM + Open GApps in one go without rebooting in between then reboot to System.

You can root later at anytime so it is not necessary to do it at this stage. I prefer to install only LineageOS + GApps to keep it simple & avoid errors, boot to system, setup the device, reboot to recovery & make a full TWRP backup of that clean install then root the device.

***

Optional but not recommended: In TWRP instead of Format Data, you could > Advanced wipe of Cache, Dalvik / Art Cache, System & Data and reboot to Recovery then install the LineageOS ROM + Open GApps but you may carry some problematic leftovers from internal sdcard & some Data file system problems. You could also have some encryption problems if you decide to do it at a later stage as Format Data reserves some space at the end of the Data partition for the encryption footer which the simple wipe Data does not do.

If you want to restore a Google Backup, do it as soon as you boot to System the first time when asked if you want to do that. My Google backup was huge @ 1.3 GB so make sure you have a quick wifi connection if you do that.

It restored 90% of my LineageOS settings, all apps & my data but did not include the apps that I installed manually from other sources than Google Play obviously.

And/or use an other apps backup method like Titanium Backup for example (requires root to create the backups) but it's hit or miss depending on the apps and their required libraries which are not always backed up by Titanium Backup.

***

Rooting Galaxy S5 LineageOS 16.0

These 2 methods were tested successfully on my S5 running LineageOS with the files downloaded from the links above.

LineageOS own su root solution:

In TWRP flash the LineageOS 16.0 addonsu ARM.zip package.

Boot to System.

Enable Developer options: Settings > About phone > keep tapping on Build number until a pop up saying "Developer options enabled" appears.

Go back to Settings > System > Advanced > Developer options > Root access > enable Apps. Note the enable Apps and ADB options in case you need root while using ADB & connected to a computer.

You can disable root at any time on the fly with that Root access setting.

Or remove it permanently by flashing in TWRP addonsu-remove-16.0-arm-signed.zip

Or Magisk if you wish. On my S5 G900M running LineageOS 16.0, Magisk Manager was no showing up after flashing the Magisk installer & rebooting but installing manually Magisk Manager.apk showed that Magisk was installed correctly & enabled.

***

See some S5 LineageOS optimization tips here: Remove Animations UI Speedup Test - Taming Google & Apps

***

I described how I updated my S5's modem & bootloader here & included Odin screenshots: S5 Odin Flashable Modem & Bootloader

As seen in the screenshot you can use DevCheck > System where you can see Bootloader & Radio which is the same as modem or baseband.

You can also see your current bootloader & modem using adb. See this XDA portal article What is ADB? How to Install ADB, Common Uses, and Advanced Tutorials for more info.

adb shell getprop > getprop_Properties.txt

And search file with bootloader & modem. Or to see it on your screen:

adb shell getprop gsm.version.baseband

adb shell getprop ro.bootloader

***

Flashing TWRP Recovery on S5 with Stock Samsung Firmware

Notes:

You do not need to root the S5 running stock Samsung Firmware before flashing TWRP if you use Odin3 as described below.

The sequence is > Samsung OS > flash TWRP custom recovery > Flash LineageOS + optional packages if you wish.

Installing an official Samsung firmware on your S5 is a last resort troubleshooting step when all else fails when using a custom OS (ROM) or to make sure that a problem is not hardware related as the stock Samsung firmware it is the most stable for a given device because Samsung had paid staff working for years on it to fix the problems reported by thousands of users & warranty claims.

The Galaxy S5 SM-G900V Verizon LTE is a special case and contrary to most S5 klte + variants it has a locked bootloader out-of-the-box thanks to Verizon. The first thing to do is to check if the bootloader is unlocked if you bought the phone used. To check that boot in Download mode & if you see "Mode: Developer" the bootloader is unlocked. See the attached screenshots in S5 G900V Bootloader Update?. If it's not unlocked see this XDA S5 Verizon thread. If you have the CID 15 variant that can be unlocked, do it then flash TWRP as described below.

1- Charge the S5 to at least 80% & to avoid errors it is better to connect the phone directly to the computer and not via a USB hub when using Odin. Also better to have Odin, Samsung Firmware & TWRP on C drive & not on external drives.

2- Download the most recent (@ the present) Odin3 v3.14.4: https://dl2018.sammobile.com/Odin3-v3.14.4.zip

Unzip or unpack the .zip file & copy the Odin3-v3.14.4 folder to the root of C drive.

3- Optional: you can install the most recent Samsung stock Firmware for your exact S5 model for testing purposes or to update the modem, bootloader & other vendor's firmwares not included in LineageOS. The respective download pages include instructions about how to install it using Odin:

Most trusted. May require to register (slow) or paid subscription (fast) depending on the firmware you choose: https://www.sammobile.com

Don't be fooled by fake Download ad buttons: https://updato.com. Now requires to be registered.

4- Download the TWRP for Samsung Galaxy S5 Qualcomm (klte family) for your exact model. Get the twrp-3.4.0-0-klte....img.tar version to use with Odin & copy it to your Odin3-v3.14.4 folder. The TWRP app is collecting data, wants to always run in the background & is not recommended.

The most recent TWRP Recovery for S5 is required for the built-in OTA LineageOS Updater to work properly.

5- On the computer Right-click Odin and run as Administrator. Click on the AP button and navigate to the twrp-3.4.0-0-klte....img.tar file. (See attached Odin screenshot)

Turn off the phone & boot in Odin Mode (A.K.A. Download Mode) (press and hold Home + Power + Volume Down buttons and confirm with Volume up to Continue) then connect to the computer and in Odin > Options do not select Auto Reboot and keep only the F. Reset Time option selected and nothing else! Click Start.

When Odin has finished the TWRP Recovery installation you will see a blue bar on the S5 screen and All threads completed. (succeed 1 / failed 0) in the Odin Log window. Disconnect the phone & reboot in TWRP Recovery Mode: (volume up + Home + Power buttons) and release the buttons as soon as you see the Samsung Galaxy S5 logo otherwise by default the stock Samsung firmware will revert to the stock Samsung recovery.

This is a one time thing, afterwards booting in Recovery will always be in TWRP as it will rename the stock Samsung one.

If you have network signal & LTE working with your Samsung stock firmware do this before flashing LineageOS:

Write down and/or screenshot your current APN settings that you can use if you have a network signal, data or LTE problem in LineageOS.

After installing TWRP & before flashing LineageOS do an EFS partition backup that can be use to fix a no SIM or no network problem. See this post which includes TWRP screenshots: No Network, No IMEI, No SIM & EFS Partition Restore Fix

You can then reboot to System, reboot back to TWRP & proceed with the LineageOS super clean install as described above.

***

Magisk Problem

I described exactly how I installed Magisk v18.0 in New S5 LineageOS 16.0 haggertk 2019-01-09 Build! - Report & Bugs & added some screenshots.

I'm getting dizzy reading all the stuff you tried. :eek:

"Zip flashed successfully no error" - Well obviously there is error(s) somewhere because Magisk is not working for you. ;)

From what you wrote it seems that you did it properly so maybe there is a file system error, old TWRP, old bootloader or some hardware problems.

The best place to ask for help would be in the Magisk General Support / Discussion with several local Magisk experts but without logs there is no way to intelligently troubleshoot your problem.

I would suggest a super clean install as described above including a Format Data in TWRP.

Then after flashing the most recent Magisk & before rebooting > TWRP > Home > Advanced > Copy Log to external SD card then reboot to System. The TWRP Recovery log can be very useful for troubleshooting an installation problem & it takes about 10 seconds to back it up.

In Magisk Manager > hamburger > Log > Magisk > there is a save button on the top (screenshot). That could be useful for troubleshooting besides capturing a logcat.

Because you are not rooted check "setup ADB and then capture a log" in the LineageOS wiki.

Or since the phone is not rooted you can grant this permission to enable the fast & easy to use SysLog using ADB & a computer:

adb shell pm grant com.tortel.syslog android.permission.READ_LOGS

Read this post in the Magisk General Support thread by Recognized Contributor [MENTION=4667597]Didgeridoohan[/MENTION].

Please report back if you fix your problem or not. :cool:

***