[Samsung Galaxy S10 5G Questions & Answers] erich_vogt:
I found a way to install lineage using heimdall & now have Lineage Recovery and LineageOS version 20-20240131-NIGHTLY-beyondx running on the SM-G977B. I tried to use the instructions for this model set out on the LineageOS.org web page for this device but they do not work. They didn't work for me & they may not work for you. Changes were needed. You should read this alongside the LineageOS installation instructions for the SM-G977B as it follows in some areas and diverges in others. Before you start make sure you've downloaded everything you'll need.

***********************************************************************************

DOWNLOADS

1) USBDeview ver 3.07, I downloaded this from NIRSOFT.

2) Zadig ver 2.8, I downloaded the latest version of Zadig from the zadig.akeo web site.

3) heimdall ver 1.4.2, I downloaded the latest version from Benjamin-Dobell's page at github.com.

4) platform-tools_r34.0.5.zip (adb & fastboot etc), I downloaded these from the Google link provided in the LineageOS instructions.

5) Microsoft Visual C++ 2015-2022 Redistributable (x86) - 14.32.31332 from the link in the LineageOS instructions (heimdall needs this installed)

6) The Lineage build you want. It will consist of 4 image files & 1 zip file. I downloaded these from the "Lineage Recovery" link in the LineageOS instructions.

***********************************************************************************

WHICH MODE IS WHICH & PREPARING THE PHONE

For brevity -

I'll call normal-charging mode "N-C mode"

I'll call download mode "D-L mode"

I'll call recovery mode "R-C mode

Samsung phones do not have a fastboot mode. My PC is running up-to-date Windows 10 64Bit. I'm using a standard USB-C cable. The phone is in very good condition & was properly prepared as described by the LineageOS instructions. I upgraded to Android 12 as required & Developer Options (DV) was activated. In DV I had turned on USB Debugging and OEM Unlock'

***********************************************************************************

GETTING ADB WORKING, CHECKING IT CAN SEE YOUR PHONE & THE CONNECTION IS AUTHORISED

You have to use adb so it must work correctly, be able to see your SM-G977B and see it as an "authorised" device. Adb runs when connected to the phone in N-C mode. This is where I hit the first major problem. My phone did not prompt me to authorise adb debugging so adb saw it as unauthorized & would not work. If I ran ".\adb devices" from an elevated prompt this is what happened -

PS C:\WINDOWS\system32> adb devices

* daemon not running; starting now at tcp:5037

* daemon started successfully

List of devices attached

R3CM6045AWH unauthorized

R3CM6045AWH is the serial number of the phone (I've altered it) & "unauthorised" means that adb will not connect to it. After looking for a day I found that this was a very common problem. It is not the case that the phone may have asked you & you missed the prompt. There were literally dozens of "solutions". One mentioned the option found in Developer Options called "Revoke USB debugging authorisations". This is the key to forcing the phone to issue another prompt. Another one explained the exact order in which operations have to carried out. This is it.

1) Disconnect phone from usb cable

2) Revoke USB debugging authorisations on phone in Developer Options

3) Restart the phone

4) Reconnect the phone

Having done this the phone issued a prompt which I could authorise. Running ".\adb devices" again from an elevated prompt gave -

PS C:\WINDOWS\system32> adb devices

* daemon not running; starting now at tcp:5037

* daemon started successfully

List of devices attached

R3CM6045AWJ device

The word "unauthorised" has gone which means adb can communicate with the phone. The LineageOS instructions don't mention this problem because I believe they assume that you will receive a prompt. I did not. When you are prompted select "always authorise connections with this PC" to save time.

Now put the phone into D-L Mode in the normal manner as described in the LineageOS instructions. So for the next step it is connected to the PC and is in D-L Mode.

***********************************************************************************

DRIVER REMOVAL

The next step is to remove all the USB drivers associated with the Samsung phone on your PC. This could be as many as eight drivers depending on what you've done trying to complete this process in the past. This step is not mentioned in the LineageOS instructions. If I didn't do this I could not progress. I don't know why Lineage doesn't mention it. It is harmless to remove the USB drivers as long as you ensure that you only select Samsung phone USB drivers which can be identified by their USB Vendor ID 04E8, sometimes written as USB\VID_04E8. This is the ID for Samsung Electronics. Make sure you do no remove the drivers for any other Samsung devices that you might have connected to your PC that are not your phone. To remove drivers (they can be easily & automaticall reinstalled) you use USBDeviewer ver3.07. With the phone connected and in D-L Mode open USBDeview. You can identify the Samsung drivers by looking down the column headed "Instance ID" towards the right of the USBDeview window. This will show USB\VID_04E8 plus some additional identifiers which may vary. You should also see the name "Samsung" mentioned in the column headed "Device Mfg" for these same drivers. Delete everything related to the phone but not other drivers. Close USBDeview. At this point the phone is still connected and in D-L Mode.

***********************************************************************************

CHECK THE DRIVERS HAVE GONE

The next step is to use the program called Zadig as described in the LineageOS Instructions. This is Zadig Ver 2.8, it is an executable & requires no installation. It works better than earlier versions. You need to check that Zadig_2.8 cannot see the phone. It should not be able to see the phone because all the drivers have been removed. At this point the phone is still connected and in D-L Mode. Run Zadig and in the Zadig window go to Options > List all devices and make sure its ticked. If Zadig can see the phone you'll have to review & start again. If Zadig cannot see the phone all is well. Now you have to close Zadig. The next step is, with the phone still in D-L Mode, unplug the phone for a couple of seconds & then replug it. The phone will remain in D-L Mode. Without doing this the process would simply fail for me. The act of replugging in D-L Mode seems to install only a couple of drivers and in particular the exact one that Zadig needs to replace.

***********************************************************************************

INSTALL CORRECT WINUSB DRIVER

Open Zadig again. The phone is connected and is still in D-L Mode. You use Zadig to install a USB driver that is compatible with heimdall & further stages of the process. In the Zadig window go to Options > List all devices and make sure its ticked. You will see a list of devices & you have to Idenify the device/s that represent the phone. You must not install a driver for any other device, only the phone. The LineageOS instructions suggest various names that the phone may take in the Zadig drop down box. You may find 2 names both referring to the phone. This is what happened for me. I saw 2 instances of "Gadget Serial" and both were clearly the phone. After several failed experiments I found that the only way it would work was to ignore the "Gadget Serial" with the "modem" driver (look in the box below the drop-down) and replace the other "Gadget Serial" which had a driver called "dg_ssudbus (v2...etc etc)". This worked fine. I replaced it with the Zadig driver called WinUSB (v6.1...etc etc). Zadig gives you 4 choices for replacement but only the WinUSB driver worked for me. Replacement can take a few minutes. After completion run Zadig again (phone still plugged in & still in D-L Mode) and in my case the 2 instances of "Gadget Serial" had reduced to 1 which was shown as having the driver WinUSB (v6.1...etc etc). Close Zadig. This is exactly right.

***********************************************************************************

RUNNING HEIMDALL ONCE ONLY TO FLASH RECOVERY.IMG

So now theoretically all drivers except the correct WinUSB have been removed and you can go to the next step which is to run heimdall & use it to install the Lineage recovery.img file. The phone is still connected and is still in D-L Mode. Here, there was for me & I expect there will be for you an important diversion from the process suggested by the LineageOS instructions. It is simple enough to understand but it caused me a day of problems. For me heimdall would only run ONCE successfully before I needed to repeat all the previous steps from DRIVER REMOVAL onwards. This was incredibly frustrating & time consuming but I found no way round it. It just means that you get 1 chance to load the recovery.img & if that fails you have to go back to DRIVER REMOVAL & start again. The heimdall error message just says that the phone is disconnected & I couldn't find any way round this other than to start again. I tried about 10 times before I realised what was happening. So I may be able to save you a lot of time. The LineageOS instructions suggest running ".\heimdall print-pit" from an elevated command prompt in order to test that heimdall is working properly. However, if you do this then when you run the next heimdall command (to install the recovery.img file) it will fail and you'll have to start again from DRIVER REMOVAL So the solution is don't bother with the test. It does no harm, the worst that can happen is that heimdall fails & you are forced to go back to DRIVER REMOVAL. The advantage of heimdall ver 1.4.2 is that it will download the .pit file automatically and use the partion map it contains to flash recovery.img onto the correct area. So that's what I did & it worked fine for me. Heimdall flashed the recovery.img file onto the phone in the correct manner. Find this point in the LineageOS instructions. From this point on I found that I could follow the instructions as they appear.

***********************************************************************************

I hope this helps someone else.