yashsingh1/xdaforums huggingface dataset:
[OnePlus 5 ROMs, Kernels, Recoveries, & Other Devel] Lara Otwell:
After I flash the latest recovery 3.3.x for Android 9/pie by command line, my phone can enter twrp, but when I reboot phone to recovery mode, the result isn't twrp but oneplus official recovery. How to solve it?

My OxygenOS version build with Android 9.
[OnePlus 5 ROMs, Kernels, Recoveries, & Other Devel] d1n0x:
You need to flash magisk, otherwise the stock ROM will always overwrite TWRP with stock Oneplus recovery.
[OnePlus 5 ROMs, Kernels, Recoveries, & Other Devel] Burn2Hell:
29/03/2020 - 17:00 CEST

I had the same problem. But after flashing Magisk after I booted into TWRP the next reboot is resulting into Power off and shutting down.

Flash TWRP

Boot recovery.

Reboot recovery. (to check if it didn't fail)

Flash Magisk v20400

Reboot system

Power off, shutting down...

Booted into recovery

Keeps looping. OxygenOS is reflashed and there was no magisk or modules on the phone. Only way to keep it from looping is flashing back OxygenOS boot.img.

29/03/2020 - 17:01 CEST

Before this I was using OxygenOS 9.0.1 with twrp-3.3.1-20190908-0-codeworkx-signed-forcedecrypt-cheeseburger just fine.

29/03/2020 - 18:06 CEST

My problem is solved. It is working fine now with OxygenOS 9.0.11 and twrp-3.3.1-20190908-0-codeworkx-signed-forcedecrypt-cheeseburger.

Flashed TWRP

Flashed Magisk-uninstaller-20200323.zip from https://github.com/topjohnwu/Magisk/releases

Reboot into system

Reboot into recovery

Flashed Magisk 20400

Reboot into system

Working fine again.

There was still something left from Magisk.
[OnePlus 5 ROMs, Kernels, Recoveries, & Other Devel] shadowstep:
That's actually not true. TWRP can also be retained on OOS if someone doesn't want to flash Magisk by flashing the OxygenOS TWRP Retainer zip from my Essentials thread. :)
[OnePlus 5 ROMs, Kernels, Recoveries, & Other Devel] Lara Otwell:
That's right, thx.

That's right, thx.
[OnePlus 5 ROMs, Kernels, Recoveries, & Other Devel] js-xda:
At first, I was mildly panicking as I wasn't anymore able to decrypt data in TWRP (using the official 3.3.1-0 build) but found finally the answer that this is a known issue and that the solution or rather workaround is to remove the PIN. Works for me. Is this something that is resolved with the TWRP build of codeworkx? Couldn't find an indication on this or the corresponding LineageOS thread but might have missed it if using wrong search terms.
[OnePlus 5 ROMs, Kernels, Recoveries, & Other Devel] TatesMan:
Any idea where if it works on oxygenos 10?
[OnePlus 5 ROMs, Kernels, Recoveries, & Other Devel] navinmholkar:
Does this recovery works on encrypted oxygen os 10?
[OnePlus 5 ROMs, Kernels, Recoveries, & Other Devel] Jyoti_re:
Yes it works perfectly .
[OnePlus 5 ROMs, Kernels, Recoveries, & Other Devel] navinmholkar:
All functions like backup and restore works? I am planning to stay encrypted.
[OnePlus 5 ROMs, Kernels, Recoveries, & Other Devel] CamoGeko:
I guess that's what "perfectly" means.

You could always try and let everyone know here as well.

Sent from my PH-1 using Thebear Blue XDA Labs
[OnePlus 5 ROMs, Kernels, Recoveries, & Other Devel] lekiaM:
Workaround to restore with the latest TWRP (should work on all versions) ;

Before you make a backup in TWRP remove the "data/per_boot" folder in TWRP file manager "before" you make a backup and not "after" and then restore.

Your backup will boot fine and the "no os installed" message is gone.

Hope this temporary helps for those who are having issues.
[OnePlus 5 ROMs, Kernels, Recoveries, & Other Devel] SREEPRAJAY:
+1

Had exactly the same error...

Cant make a backup with the data partition mounted...

Nevertheless, made a nandroid without the data selected successfully.

Just completed a full format and getting ready to jump to Oreo
[OnePlus 5 ROMs, Kernels, Recoveries, & Other Devel] codeworkx:
Didn't have to format data when using stock recovery. Upgrade worked without a problem.
[OnePlus 5 ROMs, Kernels, Recoveries, & Other Devel] Skumar29:
Hi

Is it possible to get a verified step-by-step guide to install OOS 5.0.1 from an *Encrypted - Nougat Rooted* OP5?
[OnePlus 5 ROMs, Kernels, Recoveries, & Other Devel] codeworkx:
Flash stock recovery then sideload the full 5.0.1.
[OnePlus 5 ROMs, Kernels, Recoveries, & Other Devel] pssnn:
What I did was look in the recovery log for the file that caused the error, might not be the same file or solution for you. In my case it was:

"failed to lookup tar policy for '/data/system_ce/999' - 'daf3a498b0d5d03f'

I:Error adding file '/data/system_ce/999' to '/data/media/0/TWRP/BACKUPS/e51473d/2018-01-05--04-32-11/data.ext4.win003'

Error creating backup."

In ADB Shell I executed "pm remove-user 999"

This is the thread that gave me the info to solve my problem (post#4):

https://www.google.com/url?sa=t&rct...255-t3727673&usg=AOvVaw0bR4UyYlsiN7tNRZz5mmBv
[OnePlus 5 ROMs, Kernels, Recoveries, & Other Devel] xdvs23:
Congratulations! Looks like we have the new MVP.

Are the sources up-to-date? Would like to have a look on it.
[OnePlus 5 ROMs, Kernels, Recoveries, & Other Devel] codeworkx:
teamwin github, twrp gerrit and omnirom bootable/recovery
[OnePlus 5 ROMs, Kernels, Recoveries, & Other Devel] kgr:
[MENTION=3208754]codeworkx[/MENTION] Nice TWRP. Thanks!

Every time I flash anything I get this error:

E:String resource 'zip_sig_chk' not found. Using default value.

What is this?
[OnePlus 5 ROMs, Kernels, Recoveries, & Other Devel] flatratte82:
I cannot confirm this issue. I don't get any error message when flashing with the latest universal version.
[OnePlus 5 ROMs, Kernels, Recoveries, & Other Devel] mipirakas:
Hey guys, I'm still experiencing issues with usb otg.

The usb stick gets recognized now but when i tap on one of the folders on the usb stick, twrp freezes and i have to force reboot.

Twrp also freezes when unmounting usb otg.

Anyone else have this problem?

Thanks
[OnePlus 5 ROMs, Kernels, Recoveries, & Other Devel] xdvs23:
Thanks. Just needed to merge bootable/recovery from omnirom, otherwise I had everything.
[OnePlus 5 ROMs, Kernels, Recoveries, & Other Devel] Emilius:
Excellent, thank you. I am wondering if default 100% brightness can be set to like 20% and vibration completely disabled. The setting not stick until next time and it is so boring doing same thing over and over. Dues anyone feel the same?
[OnePlus 5 ROMs, Kernels, Recoveries, & Other Devel] xdvs23:
That only works after entering your password for encryption.
[OnePlus 5 ROMs, Kernels, Recoveries, & Other Devel] Emilius:
Yes I know, That's why I am asking if default TWRP settings could be different.
[OnePlus 5 ROMs, Kernels, Recoveries, & Other Devel] ulxerker:
For me it works exactly this way and my settings stick until next start of twrp.

Try to delete .twrps file (its the config file) in twrp folder, then enter twrp and apply your settings. This will create a new config file, maybe that helps.
[OnePlus 5 ROMs, Kernels, Recoveries, & Other Devel] Emilius:
Sorry, English is not my first language. My TWRP settings will stick but next time when I wipe and format storage TWRP will go back to maximum brightness and super strong vibrations on tap. So now I need to do settings again but for first time will not stick until my new rom have first boot. Second time settings in TWRP will stick finally.

My question/suggestion is can TWRP default settings (without touching it) be like 20% brightness and no vibrations at all. I mean who need that in recovery LOL.
[OnePlus 5 ROMs, Kernels, Recoveries, & Other Devel] codeworkx:
Who needs sticky settings at recovery? It's nothing you use all the day. :P
[OnePlus 5 ROMs, Kernels, Recoveries, & Other Devel] ulxerker:
Ah, now I see, so its working as designed for you. And as for the defaults this is really up to the developers to change that.
[OnePlus 5 ROMs, Kernels, Recoveries, & Other Devel] Emilius:
Yes I know but I am really carefull with my amoled screen and 100% brightness is overkill like 3x. Vibration also why is so bloody strong or why is there at all in recovery. Can you see where I am coming from?
[OnePlus 5 ROMs, Kernels, Recoveries, & Other Devel] mcduffie2010:
England?
[OnePlus 5 ROMs, Kernels, Recoveries, & Other Devel] flatratte82:
:D
[OnePlus 5 ROMs, Kernels, Recoveries, & Other Devel] smohanv:
I flashed and works good. One downside is that it doesn't mount USB storage.

Returned to modified twrp.
[OnePlus 5 ROMs, Kernels, Recoveries, & Other Devel] yka:
Usb mount ok here
[OnePlus 5 ROMs, Kernels, Recoveries, & Other Devel] codeworkx:
Must be fat formated. Ntfs support was broken on twrp source tree.
[OnePlus 5 ROMs, Kernels, Recoveries, & Other Devel] mrityunjaygr8:
Unable to flash Lineage 15.1

Hi,

I am having trouble flashing Lineage OS 15.1 20180106 by codeworkx using this recovery (twrp-3.2.1-0-universal).

The install from zip completes without any error, but on booting the ROM, the devices reboots to recovery everytime.

Currently I am on xxx_no_limits 9.2 OpenBeta 3, and my device is decrypted.

Let me know which logs will be helpful in sorting this out.

Thanks
[OnePlus 5 ROMs, Kernels, Recoveries, & Other Devel] monoton0815:
you may need to format your data, when switching between android 8.1 (linage 15.1) and 8.0 (stock/no_limits)
[OnePlus 5 ROMs, Kernels, Recoveries, & Other Devel] mrityunjaygr8:
Thanks for the fast reply. I will try that and report back.
[OnePlus 5 ROMs, Kernels, Recoveries, & Other Devel] acemimerakli:
I am using OP5 oreo stock rom. (encrypted) I loaded codeworkx twrp. At first time, work very well, openning in twrp. but second time, i open device in recovery, got back to stock recovery. I tried again, result same? (back to stock) What was my fault, have anybody's idea? thanks
[OnePlus 5 ROMs, Kernels, Recoveries, & Other Devel] mofeywalker:
You have to either flash magisk or no-verity-opt.zip, otherwise the stock rom replaces the recovery.
[OnePlus 5 ROMs, Kernels, Recoveries, & Other Devel] NozItsATrap:
I have the latest blu_spark recovery, if i want to change at latest cheeseburger recovery(universal), just flash the img only? Or need to format something before or after? Im on 9.1 xxx rom decrypted.
[OnePlus 5 ROMs, Kernels, Recoveries, & Other Devel] kipue:
No worries, just flash the recovery, then reboot to recovery and you'll be all good :good:
[OnePlus 5 ROMs, Kernels, Recoveries, & Other Devel] acemimerakli:
thanks a lot.
[OnePlus 5 ROMs, Kernels, Recoveries, & Other Devel] Harregukalerik:
Is it possible to install anything that demands permission to change files in /sys/ ? With this twrp?
[OnePlus 5 ROMs, Kernels, Recoveries, & Other Devel] TH3-CRiMIN4L:
Works like a charm!

By the way, when it's asking for me to update the TWRP, I imagine I shouldn't do that because your latest version is already installed just today and so I ignore the app asking for me to update it?
[OnePlus 5 ROMs, Kernels, Recoveries, & Other Devel] ulxerker:
Exactly as the app only refers to the official release channel, so ignore it. Also, I'd remove the app as its not really necessary.
[OnePlus 5 ROMs, Kernels, Recoveries, & Other Devel] TH3-CRiMIN4L:
Thank you for the reply and I tried but I don't think I could remove it so I had to just hide it from the list, haha.
[OnePlus 5 ROMs, Kernels, Recoveries, & Other Devel] shadowstep:
That's because TWRP installs the app as a system app. If you're rooted, you can remove it via a root file manager or if you aren't, you can just boot to recovery and delete it via TWRP's file manager.
[OnePlus 5 ROMs, Kernels, Recoveries, & Other Devel] TH3-CRiMIN4L:
Yep, I'm rooted! I'll try doing that then

Update : Titanium Backup says can't uninstall the app because it can't find the Apk, previously to that I tried removing the app from system folder in argon explorer and each time it said "Successfully deleted" but it's still there

Any idea what's up?

Edit : TWRP file manager doesn't show anything in system folder

Edit 2 : Found out how I needed to select System under mount section in TWRP and then deleted the app from the file manager there. But I still don't know why Titanium Backup couldn't do it with Superuser access.
[OnePlus 5 ROMs, Kernels, Recoveries, & Other Devel] anujyadava:
I upgraded to 5.0.1 using codeworkx recovery and then changed to Blu spark.so today when I tried to dirty flaht the rom using Blu spark it showed error in twrp as attached.do I need to switch to codeworkx recovery to dirty flash ROM though all other zips are flashing normally through Blu spark.
[OnePlus 5 ROMs, Kernels, Recoveries, & Other Devel] mcduffie2010:
Why flash back to Blu if codeworkx works?
[OnePlus 5 ROMs, Kernels, Recoveries, & Other Devel] gvaram:
Go to blue with that question. Makes no sense to ask it here. "You know dev, your TWRP is working great, but I went to different TWRP. Why isn't it working?"
[OnePlus 5 ROMs, Kernels, Recoveries, & Other Devel] mcduffie2010:
You are mean. You now what's coming
[OnePlus 5 ROMs, Kernels, Recoveries, & Other Devel] Gambo_7:
Yes you do
[OnePlus 5 ROMs, Kernels, Recoveries, & Other Devel] gvaram:
Please do enlighten me. Sorry to dev for spam.
[OnePlus 5 ROMs, Kernels, Recoveries, & Other Devel] mcduffie2010:
Pm sent
[OnePlus 5 ROMs, Kernels, Recoveries, & Other Devel] Sandertje1980:
Can I dirty flash OOS 5.0.1 coming from 4.5.15 using this recovery? I don't want to wipe data and reinstall everything.
[OnePlus 5 ROMs, Kernels, Recoveries, & Other Devel] str8str:
Which one should I use the universal?
[OnePlus 5 ROMs, Kernels, Recoveries, & Other Devel] sting5566:
Correct.
[OnePlus 5 ROMs, Kernels, Recoveries, & Other Devel] Hoshang25:
I have recently flashed black themed codeworkx twrp, earlier i was on blu spark version. But now i am unable to see any folder in internal memory. What could be the reason. Someone plz suggest a work around. Some error screenshots for reference.
[OnePlus 5 ROMs, Kernels, Recoveries, & Other Devel] codeworkx:
Did u run a rom with full disk encryption enabled instead of the newer file based encryption?
[OnePlus 5 ROMs, Kernels, Recoveries, & Other Devel] Hoshang25:
I war running "xxx no limits 9.4a" in decrypted mode with blu spark twrp. I had just flashed the black twrp recovery from computer using fastboot command. And when i went to recovery i was unable to see any folder. I am able to see root directory but no folders when i go to "sdcard" folder. I have no clues as to what you mean by new file based encryption.

Thanks for your quick reply :) plz help
[OnePlus 5 ROMs, Kernels, Recoveries, & Other Devel] Slicus:
Did you enter the password to decrypt as you first engage twrp
[OnePlus 5 ROMs, Kernels, Recoveries, & Other Devel] Hoshang25:
Thats the problem. I check it, it does not prompt me to enter password. I tried after changing my phone lock screen password thinking it my work. But still got no prompt to enter pwd to decrypt.

Got it working after flashing universal twrp for cheeseburger
[OnePlus 5 ROMs, Kernels, Recoveries, & Other Devel] dsg2003:
i was on xXx Rom (decrypted) and switched to AICP Rom. Now i want to go back. In TWRP i want to restore back. It was successful. But when i reboot, xXx starts but afret Sim pin, the phone does not accept the security pin. What can i do?
[OnePlus 5 ROMs, Kernels, Recoveries, & Other Devel] mcduffie2010:
Go back in recovery and use advanced to use file explorer.....

Go to data > system and scroll down till you see gatekeeper and locksetting files. Delete them and reboot
[OnePlus 5 ROMs, Kernels, Recoveries, & Other Devel] gunther82:
Do you think that the "createTarFork() error 255" while performing a nandroid backup with parallel apps set in the phone will be solved in future versions of the recovery, or we should give up using parallel apps?

---------- Post added at 02:50 PM ---------- Previous post was at 02:47 PM ----------

Do you think that the "createTarFork() error 255" while performing a nandroid backup with parallel app set in the phone will be solved in future versions of the recoevry, or we should give up using parallel apps?
[OnePlus 5 ROMs, Kernels, Recoveries, & Other Devel] newcomer6789:
Query about TWRP 3.2.1-0 by codeworkx

Hi

First of all, I am a total noob in flashing custom recovery etc. But I have read almost enough info available so I finally had guts to flash this particular twrp. I didn't really understand what I was doing but please comment where did I go wrong. I am using OnePlus 5 and was from official 5.0.1 running everything stock, locked bootloader, unrooted and no custom recovery.

My experiences are as follows:

1. Made full backup and transferred to PC

2. Factory reset

3. Boot to stock recovery

4. Flashed OnePlus 5 OOS Open Beta 4 (downloaded from official OnePlus download section) over stock recovery

5. Wipe cache and data

6. Boot to new OOS Open Beta 4

7. Succeed

8. Felt itchy

9. Enable developer mode again (USB debugging etc)

10. Enable OEM unlock

11. Unlock bootloader through fastboot

12. Bootloader unlocked!

13. Back to fastboot mode

14. Flashed 3.2.1-0 TWRP by codeworx using fastboot. Succeed!

15. Reboot to custom recovery

16. Wipe dalvik and cache

17. Reboot to custom recovery again (to make sure custom recovery still there lol)

18. Reboot to OS, OK!

19. Enable again developer mode for USB debugging etc

20. Reboot to recovery......... it became stock recovery

21. Flashed again twrp, OK!

22. Now, this! I didn't have any idea, I wiped dalvik, cache and system because I thought system refers to Stock Recovery lol

23. Reboot to custom recovery, reboot to System, NO OS INSTALLED!

24. Panicked

25. Tried to ADB sideload the rom (also no idea about this), "adb devices didn't see my device"

26. Oh shiz

27. Found out I could transfer back the rom file to internal storage while I was in twrp (I didn't know why)

28. Flashed OOS Beta 4 again through custom recovery, succeed!!

29. Wiped dalvik/cache

30. Successfully booted to OS no bootloop etc

31. Reboot to fastboot, "fastboot oem lock"

32. Reboot to OS, OK! wew

I did recent digging though this forum. I found some people said flashing Magisk is a must after flashing TWRP so that Stock Recovery won't overwrite?

Please comment which part from my steps should be neglected and explain why flashing Magisk will make TWRP stays.

Thanking you all in advance and sorry if this is wrong thread to ask. I really can't figure out where should I go to express my concerns.
[OnePlus 5 ROMs, Kernels, Recoveries, & Other Devel] pegasus5862:
I m on xxx 4.7 ob2. Whenever I try to flash universal twrp 3.2.1 it succeded but won't boot to recovery, just stays on fastboot menu even after trying flashing by command on pc or by official twrp app. So I had to flash 3.1.1 and I m on it now. Anything wrong I m doing
[OnePlus 5 ROMs, Kernels, Recoveries, & Other Devel] codeworkx:
fastboot flash recovery twrp.img
fastboot boot twrp.img
[OnePlus 5 ROMs, Kernels, Recoveries, & Other Devel] Ccbyrob:
Chinese TWRP

You are not alone. Thankfully, I have used TWRP enough that I was still able to install recent OOS. I readily admit i could be doing something wrong, but there isn't much I could have done. I don't get the option to select a language. The odd thing is that there are some buttons with Chinese labels and others in English. I would love to have solution if anybody knows what the issue could be.

All that said, I was still able to use Codeworkx 3.2.1 Oreo 8.0 version and other than the Chinese characters it worked perfectly. I am absolutely thrilled. Thank you.
[OnePlus 5 ROMs, Kernels, Recoveries, & Other Devel] jhs39:
I've seen the Chinese or Chinese/English language mix reports with other versions of TWRP. I'm guessing it has something to do with settings being detected from Chinese TWRP.
[OnePlus 5 ROMs, Kernels, Recoveries, & Other Devel] drpradsms:
Simple 3 steps to change ur TWRP language, if you are greeted in TWRP with the language you don't understand.
[OnePlus 5 ROMs, Kernels, Recoveries, & Other Devel] Ccbyrob:
English, thank you!

Thank you so much. Of course, it worked perfectly.
[OnePlus 5 ROMs, Kernels, Recoveries, & Other Devel] vaib:
Keeps on saying wrong password. I'm on OOS latest stable version.

Stock recovery was able to decrypt but this doesn't work. I was previously on OMNI rom 8.1 and it worked flawlessly.

What am I doing wrong?
[OnePlus 5 ROMs, Kernels, Recoveries, & Other Devel] djsubterrain:
In order to answer that you would need to tell us the steps you went through and what status your phone currently has (i.e. recovery, rom version, encrypted or decrypted)
[OnePlus 5 ROMs, Kernels, Recoveries, & Other Devel] vaib:
I was on OMNI ROM 8.1 (Oreo 8.1) and encrypted with TWRP codeworkx 3.2.1-0.

Then I flashed OOS stable, went to fastboot and flashed TWRP codeworkx 3.2.1-0 again. The stock recovery was able to decrypt.

So now I am on OOS stable (Oreo 8.0) and encrypted with TWRP 3.2.1-0 with magisk 15.3.

Also, if I remove the PIN, TWRP works fine. With the PIN enabled, it is not able to decrypt.
[OnePlus 5 ROMs, Kernels, Recoveries, & Other Devel] djsubterrain:
When you went to OOS Oreo isn't stable, it's beta just now, but that's beyond the point, when you went to OOS, did you flash and boot/setup the rom, including your pin and then reboot and flash TWRP and then flash Magisk or did you flash all 3 at once?
[OnePlus 5 ROMs, Kernels, Recoveries, & Other Devel] gvaram:
Android 8 and 8.1 use different encryption.
[OnePlus 5 ROMs, Kernels, Recoveries, & Other Devel] vaib:
I did them separately.

Flashed the ROM and rebooted.

Then Rebooted to fastboot and flashed recovery and then magisk from recovery.
[OnePlus 5 ROMs, Kernels, Recoveries, & Other Devel] djsubterrain:
Yes but, as the thread title states, these versions should support both.
[OnePlus 5 ROMs, Kernels, Recoveries, & Other Devel] :
Today is the third time that, after flash a custom ROM using this TWRP version, the /sdcard was corrupted when I start the device.

The steps that I follow to flash the custom ROM (and Magisk) are:

* Start into recovery

* Wipe

* Wipe system, cache and dalvik-cache

* Flash custom ROM

* Flash GAPPS

* Reboot into recovery

* Flash Magisk

* Reboot into recovery

* Reboot normal

Is the third time that, after this steps, when the device boots, I receive a lot of FC and the contents of /sdcard was dissapeared.

After that, I need to reboot into bootloader then do:

* fastboot flash recovery stock

* fastboot oem lock

* fastboot reboot

(reboot into fastboot again)

* fastboot oem lock

reboot the device into recovery (stock) to sideload OOS-5.0..1 then reboot

After first reboot:

* reboot fastboot

* fastboot oem unlock

* fastboot flash recovery twrp-codeworkx

* fastboot reboot

reboot the device into recovery then start all the process to flash the custom ROM.

Is there a way to know if is a TWRP issue or if is a issue from Magisk or if the issue is caused by other cause?

Thanks
[OnePlus 5 ROMs, Kernels, Recoveries, & Other Devel] djsubterrain:
...and used the same pin each time?
[OnePlus 5 ROMs, Kernels, Recoveries, & Other Devel] Portgas D. Ace:
I came across several posts that other users as well had issues when flashing Magisk in the same session right after flashing ROM and Gapps. Seems that Magisk 15.x is causing those issues. It is recommended to flash ROM/GApps, reboot device, then reboot again into recovery and flash an older version of Magisk (14.x). Afterwards, boot into system and update Magisk though Magisk Manager app. Not sure if it will solve your corrupted SD card issue (as this is the first report about it), but why not giving it a try?
[OnePlus 5 ROMs, Kernels, Recoveries, & Other Devel] :
When the sdcard becomes corrupted I can complete the one-step-initialization due to a FC message is displayed all the time (even if I close it).

When the issue occurs flash a custom ROM+GAPPS from TWRP doesn't solves the issue. Only to lock OEM+flash OOS+unlock OEM solves the issue.

From now I will try to reboot normal (instead of recovery) after flash ROM+GAPPS and before flash Magisk to see if that eliminates the problems...

Thanks!