[Moto G6 Questions & Answers] katoomba32:
Moto G6. My issue short:

Flashing is locked by mistake and I can't unlock it. Also I can't use the operating system because I installed wrong ROM (different region I guess, my SIM card is not recognized). Bootloader is unlocked in official way.

DETAILS

=====

A few years ago when I bought the phone I decided to unlock the bootloader just in case (I was NOT intended to install custom ROM at that time). Unlocking process is described on the official Motorola page. It was like:

fastboot oem unlock <UNLOCKING_CODE>

I was using Android 8 (didn't install suggested official updates) for all these years. **Once I forgot my PIN and had to wipe the whole data.**

I didn't load the phone with stock ROM (i should've done it and stop experimenting!), but instead I downloaded an official application called "Rescue and Smart Assistance". I followed the instructions and an officical Android 9 ROM has installed on my phone. Everything works, but during the system load I was seeing a banner 'your device has loaded a different operating system'. I decided to go back to Android 8, but it was impossible to do with Rescue and Smart Assistance because the one does not provide old ROM versions, only the latest.

I found an older ROM on the internet and complete flashing. Then I loaded the system, seemed to work well, but I didn't notice my SIM is not recognized. I think it is because I got a ROM for wrong region.

**Accidentally I've locked flashing** via the following command (I wanted to type `oem lock` but it was a long day and I've mistaken):

fastboot flashing lock

The output was:

Phone is locked. Rebooting phone.
OKAY [ 0.006s]
Finished. Total time: 0.007s

So... now I can't install any ROM neither from the command line (fastboot flash) nor the "Rescue and Smart Assistance" tool due to permissions.

Flashing recovery from the official stock ROM:

> fastboot flash recovery .\recovery.img
(bootloader) is-logical:recovery: not found
Sending 'recovery' (22628 KB) OKAY [ 0.711s]
Writing 'recovery' (bootloader) flash permission denied
FAILED (remote: '')
fastboot: error: Command failed

Same for flashing recovery from the TWRP (ofcourse I didn't expect different result, I'm showing it just in case):

> fastboot flash recovery .\twrp.img
(bootloader) is-logical:recovery: not found
Sending 'recovery' (14748 KB) OKAY [ 0.563s]
Writing 'recovery' (bootloader) flash permission denied
FAILED (remote: '')
fastboot: error: Command failed

The Rescue and Smart Assistance tool also gives me the error: `Flash failed. Please try again`.

Now I try to unlock flashing:

> fastboot flashing unlock
(bootloader) WARNING: This command erases all user data.
(bootloader) Please re-run this command to continue.
OKAY [ 0.007s]
Finished. Total time: 0.008s
> fastboot flashing unlock
(bootloader) Check 'Allow OEM Unlock' in Android Settings > Developer
(bootloader) Options.
OKAY [ 0.007s]
Finished. Total time: 0.008s

but... I don't have any OS installed. I formatted some directories during these experiments. I believe that I killed ROM and my phone have no OS. Can't remember for sure. I hope this does not really matter.

If I try `fastboot oem unlock` I get the following:

> fastboot oem unlock
(bootloader) invalid boot state
OKAY [ 0.003s]
Finished. Total time: 0.004s

This `invalid boot state` bothers me.

Please help, what should I do? How to install any ROM? Is it possible to unlock flashing? Can rooting help me? I really need your assistance because my phone is unusable and I'm very limited in options, can't get another device.

P.S. Here is the output of `fastboot getvar all info`:

(bootloader) version: 0.5
(bootloader) version-bootloader: MBM-2.1-ali_retail-32ffece02ed-200416
(bootloader) product: ali
(bootloader) board: ali
(bootloader) secure: yes
(bootloader) hwrev: PVT2
(bootloader) radio: 4
(bootloader) storage-type: emmc
(bootloader) emmc: 32GB SKHYNIX HBG4a2 RV=08 PV=A5 FV=00000000000000A5
(bootloader) ram: 3GB SKHYNIX LP3 DIE=8Gb M5=06 M6=04 M7=00 M8=5F
(bootloader) cpu: SDM450
(bootloader) serialno: ZY323K7CDR
(bootloader) cid: 0x0032
(bootloader) channelid: 0x00
(bootloader) uid: DEA0D37F00000000000000000000
(bootloader) securestate: flashing_locked
(bootloader) iswarrantyvoid: yes
(bootloader) max-download-size: 534773760
(bootloader) reason: UTAG "bootmode" configured as fastboot
(bootloader) imei: 351865096148177
(bootloader) meid:
(bootloader) date: 12-21-2018
(bootloader) sku: XT1925-5
(bootloader) carrier_sku: XT1925-5
(bootloader) battid: SB18C21114
(bootloader) iccid:
(bootloader) cust_md5:
(bootloader) max-sparse-size: 268435456
(bootloader) current-time: "Mon Mar 7 12: 2:52 UTC 2022"
(bootloader) ro.build.fingerprint[0]: motorola/ali_dteu_n/ali_n:8.0.0/OP
(bootloader) ro.build.fingerprint[1]: SS27.82-72-10/12:user/release-keys
(bootloader) poweroffalarm: 0
(bootloader) ro.build.version.full[0]: Blur_Version.27.281.12.ali_dteu.d
(bootloader) ro.build.version.full[1]: teu.en.US
(bootloader) ro.build.version.qcom: LA.UM.6.6.r1-04400-89xx.0
(bootloader) version-baseband: <not found>
(bootloader) kernel.version[0]: Linux version 3.18.71-perf-gece5c27 (hud
(bootloader) kernel.version[1]: soncm@ilclbld107) (gcc version 4.9.x 201
(bootloader) kernel.version[2]: 50123 (prerelease) (GCC) ) #1 SMP PREEMP
(bootloader) kernel.version[3]: T Fri Jan 11 06:52:14 CST 2019
(bootloader) sbl1.git: MBM-2.1-ali_retail-0d2031d6b9-200416
(bootloader) rpm.git: MBM-2.1-ali_retail-576a4d4d-200416
(bootloader) tz.git: MBM-2.1-ali_retail-f9b266cd30-200416
(bootloader) devcfg.git: MBM-2.1-ali_retail-f9b266cd30-200416
(bootloader) keymaster.git: MBM-2.1-ali_retail-f9b266cd30-200416
(bootloader) cmnlib.git: MBM-2.1-ali_retail-f9b266cd30-200416
(bootloader) cmnlib64.git: MBM-2.1-ali_retail-f9b266cd30-200416
(bootloader) prov.git: MBM-2.1-ali_retail-f9b266cd30-200416
(bootloader) aboot.git: MBM-2.1-ali_retail-32ffece02ed-200416
(bootloader) frp-state: no protection (0)
(bootloader) ro.carrier: retru
(bootloader) current-slot:
(bootloader) slot-suffixes: _a
(bootloader) slot-count: 1
(bootloader) slot-successful:_a: INVALID
(bootloader) slot-successful:_b: INVALID
(bootloader) slot-bootable:_a: INVALID
(bootloader) slot-bootable:_b: INVALID
(bootloader) slot-retry-count:_a: unknown
(bootloader) slot-retry-count:_b: unknown

UPD 1. Looks like my device is locked.

> fastboot oem lock
(bootloader) Not in unlocked state

As I described above, `fastboot oem unlocking` throws the error: INVALID BOOT STATE. I believe fixing this will fix my original issue.

UPD 2. Is there a way to force flash unlocking with root? I have never dealt with phone rooting before (I use Linux, I know what is root for, but have no experince in phone rooting)