[Moto G40 / G60] arsradu:
Hello!

You don't need to be afraid to try new things. You just need to be prepared to fail, while also taking all the necessary measures for that not to happen. :)

You already asked here. So that's one step in the right direction.

Don't be afraid to try new things. In fact, you should be able to unlock and relock the bootloader with no issues, IF you pay attention to a few basic things:

1. DO NOT (EVER) lock the bootloader on a custom ROM.

2. use LMSA when restoring to stock ROM. That should be enough to give you a clean environment.

3. always test if the ROM is booting after flashing back stock ROM

Just be aware that, as far as Motorola phones are concerned, the second you request an unlock code, your warranty is void. You don't need to actually use the code for that. Simply requesting it is enough to void your warranty. If you're ok with that, go ahead.

I haven't tested that. I don't think the fact that it says "flashing_locked" is the problem. I think the state of the software in that moment is the problem. Because, people are trying (and failing) to flash their phones with LMSA AFTER the phone is already unbootable. So the problem is not the fact that the bootloader is locked. It's the fact that the phone is in an unbootable state. But I could be wrong of course.

Personally, I don't think anything wrong would happen if you would reflash your stock ROM with a perfectly bootable system. But again, I haven't tried that (or at least I don't remember; I tested a lot of scenarios, but I don't remember trying that), so can't confirm.

Yes, SafetyNet will fail with an unlocked bootloader, on stock ROMs.

I think so too... But could be something else, too.

I was afraid to lock my bootloader after reading all these comments from different people.

Also, I was afraid to do that because my OEM Unlocking option was greyed out (normal) and turned OFF (weird, but apparently that could happen, as well, and it's not as bad as it looks).

But after a couple of emails with the Moto support team, in which they said the position of that on/off switch is not relevant, I decided to give it a try and lock the bootloader. And, to my surprise, it worked! I was able to successfully lock the bootloader (twice, actually), and I had no issues whatsoever. The phone works perfectly fine.

You're right. Newer phones (at least phones with so-called "super" partitions) don't seem to flash to both slots. I noticed this on phones with "system" partitions. Otherwise, the ROM will be flashed on the active partition. That can be A or B. In my experience with this, it doesn't seem to make a difference, as long as that partition is also bootable! However, if you want to be extra cautious, you should be able to force flash to the other slot. Or, while bootloader UNlocked (you won't be able to do that with a locked bootloader, so all the cleaning needs to happen BEFORE locking the bootloader), switch from one slot to the other (you can do that from command line, from TWRP, and probably other methods as well) and flash again.

The vbmeta flags are usually in order to downgrade, if I'm not mistaken. But yeah, I read a couple of those tutorials, as well. And also tried a few GSI ROMs (with pretty low success rate). I find them notoriously buggier than regular ROMs. But you can definitely test some, if you really want.

My advices:

1. be prepared to make mistakes. Cause you likely will.

And that's ok. That's how we learn. It's not a bad thing. That doesn't mean you can throw away your brain and start making stupid mistakes. But what I'm trying to say is don't stress too hard if you make mistakes. Your safety net (no pun intended) is your bootloader being UNlocked. As long as your bootloader is unlocked, you can still recover the phone, in case you make a mistake. Don't be overconfident. And always double/triple check to make sure everything is ok.

2. keep your phone as clean and organised as possible. Being organised as a human being should help to keep your stuff organised, as well, and making less mistakes in the process. Analytical/logical thinking helps, as well.

3. don't flash stuff you don't know, or that don't need to be flashed.

For example, in my case, you don't need to flash TWRP to flash a custom ROM. You can just BOOT TWRP and flash a custom ROM like that. In the case of PixelExperience ROMs for example, they also come with their own PixelExperience Recovery. So....if you're not doing complex stuff in recovery, that should be just fine for regular use.

4. only lock the bootloader when you're 110% sure everything is back the way it should be.

You're most welcome. :)