Thank you, you pointed me to the right direction. Now it works.
For the record, here is what I did:
-
OEM unlock. For me, this way was simple and worked.
-
Boot to fastboot (aka bootloader) mode
-
Boot to TWRP recovery with the following command:
fastboot boot "C:\whatever\twrp-3.6.2_9-0-FP3.img"
-
On TWRP recovery, install TWRP (
Advanced > Flash Current TWRP
). -
Format data, wipe data etc.
-
Sideload LineageOS:
adb sideload "C:\whatever\lineage-19.1-20220829-nightly-FP3-signed.zip"
. In the displayed logs, note the slot on which it is installed (A or B). -
Still on TWRP, go to
Reboot
, tap on the slot noted above, and then boot to Recovery. -
LOS’s recovery boots (why did LOS’s recovery overwrite TWRP? Too bad IMO), sideload NikGapps-core-arm64-12.1-20220830-signed.zip.Upon warning
Signature verification failed. Install anyway?
answerYes
(IIRC, on TWRP there would have been no such warning). -
Reboot to system. Check that everything works.
-
(optional) Reboot to (LOS’s) recovery and sideload Magisk-v25.2.zip. If warned that there’s a signature problem, tell it to keep on.
-
Reboot to system
-
(Todo) Reinstall TWRP