[Samsung Galaxy S9  Questions & Answers] Phil9876:
I got it working with the help of hainguyenthao.

During all these installation steps I made some notes for myself to remember if I have to re-do this in some months or years... Don't expect too much of them as they were only intended for usage of my own. However, maybe you get some useful information out of it. (solving the original issue can be found as the last section)

# Installing custom roms

## Modes

- download-mode or Odin-mode or bootloader: Power + Bixby + VolDown * 7s

- recovery: Power + Bixby + VolUp * 7s

## Locks

- OEM lock means that only samsung-signed firmware can be installed

- FRP lock is similar to this

- RMM lock is hard (introduced in Samsung, Android 10)

- symptoms: "RMM state = Prenormal", "Only official released binaries are allowed to be flashed", OEM unlock not available

- reason: sim card with wrong country

- solution: wait for 7 days

- after unlocked again: install bypass zip (after each time flashing a custom rom!)

- see this post: https://xdaforums.com/samsung-a-series-2017/how-to/guide-root-install-twrp-samsung-t3747535

- dm-verity seems to be another lock

## Odin vs Heimdall

- Odin only works on Windows (thouhg also in a VM)

- Heimdall works on Linux

- Probably with quite some work, heimdall can be installed on MacOS

- Odin usage recommended a lot!!!

- Alternatively unpack the matryoshka;) until you have the .img's and install them in one go (not individually!!!)

- sudo heimdall flash --BOOT boot.img --CACHE cache.img --CM cm.bin --DQMDBG dqmdbg.img --HIDDEN hidden.img --KEYSTORAGE keystorage.bin --RADIO modem.bin --CP_DEBUG modem_debug.bin --ODM odm.img --OMR omr.img --PARAM param.bin --RECOVERY recovery.img --BOOTLOADER sboot.bin --SYSTEM system.img --UP_PARAM up_param.bin --USERDATA userdata.img --VENDOR vendor.img

## Installing a custom ROM

- unlock OEM in developer options (if not available, see RMM lock)

- heimdall flash --RECOVERY twrp-3.4.0-0-starlte.img --no-reboot

- then directly boot to recovery (`Power` + Bixby + VolUP * 7s) after ending download-mode (`Power` + VolDown * 7s)

- lineage-17.1-20201019-recovery-starlte.img can be used as well but twrp is more convenient

- install zips adb sideload in the following order:

- lineage-17.1-20201016-microG-starlte.zip

- no-verity-opt-encrypt-6.1.zip (against dm-verity)

- RMM-State_Bypass_Mesa_v2.zip (against RMM lock)

- maybe try flashing magisk zip (but not tested)

## Installing Samsung stock firmware

- download with samsungfirmware.net, sammobile.com (needs login)

- install Odin on Windows

- unpack to get .tar.md5 files

- drag them into Odin

- go to download mode (`Power` + Bixby + VolDown * 7s)

- press start in Odin

## Root

- supersu does not work (invalid zip; probably deprecated)

- addonsu does not work from lineageos17.1 onwards (https://www.xda-developers.com/lineageos-17-1-android-10-officially-available/)

- Magisk has to be used (https://topjohnwu.github.io/Magisk/install.html)

- patching AP did only work at second time

- instructions use stock Android, not sure how lineageos works...

- consider the warnings below the Samsung instructions

## File endings

- .tar.md5 files can be installed directly by odin; alternatively rename, and unpack twice until one can flash the files individually heimdall flash --RECOVERY recovery.img --...

- .tar files work with odin as well

- .img files are usually recovery; flash with heimdall (they are inside the odin tar-packages)

- .zip are files to install with twrp or lineage recovery (e.g., lineageos, RMM, no-verity, ...)

## How to disable OEM during a bootloop

- help by Michael Samy via Discord

- use Odin in Windows (if not available, use VM)

- flash a combination image (e.g., from samsungfirmware.net, combinationfirmware.com)

- in this combination image, enable OEM

- then one can flash the newest samsung version again