[Moto G5S  Questions & Answers] grpelloi:
I can't lock bootloader due to "(bootloader) Check 'Allow OEM Unlock' in Android Settings > Developer"

Now i have the oem unlocking greyed out, i can't allow oem unlock because it says that is already unlocked. I flashed twrp and rooted with magisk to force allow oem unlocking but it failed. In a second try i did a factory reset after rooting but it also failed to allow oem unlock.

C:\Users\henrique\Downloads\XT1792_MONTANA_RETBR_8.1.0_OPPS28.65-37-7-11_cid50_subsidy-DEFAULT_regulatory-DEFAULT_CFC.xml>fastboot getvar max-sparse-size
max-sparse-size: 268435456
Finished. Total time: 0.000s

C:\Users\henrique\Downloads\XT1792_MONTANA_RETBR_8.1.0_OPPS28.65-37-7-11_cid50_subsidy-DEFAULT_regulatory-DEFAULT_CFC.xml>fastboot oem fb_mode_set
OKAY [ 0.000s]
Finished. Total time: 0.000s

C:\Users\henrique\Downloads\XT1792_MONTANA_RETBR_8.1.0_OPPS28.65-37-7-11_cid50_subsidy-DEFAULT_regulatory-DEFAULT_CFC.xml>Fastboot reboot bootloader
Rebooting into bootloader OKAY [ 0.000s]
Finished. Total time: 0.000s

C:\Users\henrique\Downloads\XT1792_MONTANA_RETBR_8.1.0_OPPS28.65-37-7-11_cid50_subsidy-DEFAULT_regulatory-DEFAULT_CFC.xml>fastboot getvar max-sparse-size
max-sparse-size: 268435456
Finished. Total time: 0.000s

C:\Users\henrique\Downloads\XT1792_MONTANA_RETBR_8.1.0_OPPS28.65-37-7-11_cid50_subsidy-DEFAULT_regulatory-DEFAULT_CFC.xml>fastboot oem fb_mode_set
OKAY [ 0.000s]
Finished. Total time: 0.000s

C:\Users\henrique\Downloads\XT1792_MONTANA_RETBR_8.1.0_OPPS28.65-37-7-11_cid50_subsidy-DEFAULT_regulatory-DEFAULT_CFC.xml>fastboot oem lock
(bootloader) WARNING: This command erases all user data.
(bootloader) Please re-run this command to continue.
OKAY [ 0.016s]
Finished. Total time: 0.016s

C:\Users\henrique\Downloads\XT1792_MONTANA_RETBR_8.1.0_OPPS28.65-37-7-11_cid50_subsidy-DEFAULT_regulatory-DEFAULT_CFC.xml>fastboot oem lock
(bootloader) Check 'Allow OEM Unlock' in Android Settings > Developer
(bootloader) Options
OKAY [ 0.008s]
Finished. Total time: 0.016s

C:\Users\henrique\Downloads\XT1792_MONTANA_RETBR_8.1.0_OPPS28.65-37-7-11_cid50_subsidy-DEFAULT_regulatory-DEFAULT_CFC.xml>fastboot getvar max-sparse-size
max-sparse-size: 268435456
Finished. Total time: 0.000s

C:\Users\henrique\Downloads\XT1792_MONTANA_RETBR_8.1.0_OPPS28.65-37-7-11_cid50_subsidy-DEFAULT_regulatory-DEFAULT_CFC.xml>fastboot oem fb_mode_set
OKAY [ 0.000s]
Finished. Total time: 0.008s

C:\Users\henrique\Downloads\XT1792_MONTANA_RETBR_8.1.0_OPPS28.65-37-7-11_cid50_subsidy-DEFAULT_regulatory-DEFAULT_CFC.xml>fastboot flash partition gpt.bin
(bootloader) is-logical:partition: not found
Sending 'partition' (45 KB) OKAY [ 0.163s]
Writing 'partition' (bootloader) Validating 'gpt.default.xml'
(bootloader) Committing 'gpt.default.xml'
(bootloader) - flashing 'gpt_main0.bin' to 'partition:0'
(bootloader) Flashing primary GPT image...
(bootloader) Flashing backup GPT image...
OKAY [ 0.116s]
Finished. Total time: 0.311s

C:\Users\henrique\Downloads\XT1792_MONTANA_RETBR_8.1.0_OPPS28.65-37-7-11_cid50_subsidy-DEFAULT_regulatory-DEFAULT_CFC.xml>fastboot flash bootloader bootloader.img
(bootloader) is-logical:bootloader: not found
Sending 'bootloader' (5179 KB) OKAY [ 0.358s]
Writing 'bootloader' (bootloader) Validating 'bootloader.default.xml'
(bootloader) Committing 'bootloader.default.xml'
(bootloader) - flashing 'emmc_appsboot.mbn' to 'aboot'
(bootloader) - flashing 'rpm.mbn' to 'rpm'
(bootloader) - flashing 'tz.mbn' to 'tz'
(bootloader) - flashing 'devcfg.mbn' to 'devcfg'
(bootloader) - flashing 'cmnlib.mbn' to 'cmnlib'
(bootloader) - flashing 'cmnlib64.mbn' to 'cmnlib64'
(bootloader) - flashing 'keymaster.mbn' to 'keymaster'
(bootloader) - flashing 'prov.mbn' to 'prov'
(bootloader) - flashing 'sbl1.mbn' to 'sbl1'
OKAY [ 0.578s]
Finished. Total time: 0.968s

C:\Users\henrique\Downloads\XT1792_MONTANA_RETBR_8.1.0_OPPS28.65-37-7-11_cid50_subsidy-DEFAULT_regulatory-DEFAULT_CFC.xml>fastboot flash modem NON-HLOS.bin
(bootloader) is-logical:modem: not found
Sending 'modem' (67978 KB) OKAY [ 2.589s]
Writing 'modem' OKAY [ 1.070s]
Finished. Total time: 3.713s

C:\Users\henrique\Downloads\XT1792_MONTANA_RETBR_8.1.0_OPPS28.65-37-7-11_cid50_subsidy-DEFAULT_regulatory-DEFAULT_CFC.xml>fastboot flash fsg fsg.mbn
(bootloader) is-logical:fsg: not found
Sending 'fsg' (3560 KB) OKAY [ 0.296s]
Writing 'fsg' OKAY [ 0.120s]
Finished. Total time: 0.448s

C:\Users\henrique\Downloads\XT1792_MONTANA_RETBR_8.1.0_OPPS28.65-37-7-11_cid50_subsidy-DEFAULT_regulatory-DEFAULT_CFC.xml>fastboot erase modemst1
Erasing 'modemst1' OKAY [ 0.040s]
Finished. Total time: 0.040s

C:\Users\henrique\Downloads\XT1792_MONTANA_RETBR_8.1.0_OPPS28.65-37-7-11_cid50_subsidy-DEFAULT_regulatory-DEFAULT_CFC.xml>fastboot erase modemst2
Erasing 'modemst2' OKAY [ 0.033s]
Finished. Total time: 0.040s

C:\Users\henrique\Downloads\XT1792_MONTANA_RETBR_8.1.0_OPPS28.65-37-7-11_cid50_subsidy-DEFAULT_regulatory-DEFAULT_CFC.xml>fastboot flash dsp adspso.bin
(bootloader) is-logical:dsp: not found
Sending 'dsp' (16384 KB) OKAY [ 0.772s]
Writing 'dsp' OKAY [ 0.282s]
Finished. Total time: 1.078s

C:\Users\henrique\Downloads\XT1792_MONTANA_RETBR_8.1.0_OPPS28.65-37-7-11_cid50_subsidy-DEFAULT_regulatory-DEFAULT_CFC.xml>fastboot flash logo logo.bin
(bootloader) is-logical:logo: not found
Sending 'logo' (2195 KB) OKAY [ 0.256s]
Writing 'logo' OKAY [ 0.112s]
Finished. Total time: 0.400s

C:\Users\henrique\Downloads\XT1792_MONTANA_RETBR_8.1.0_OPPS28.65-37-7-11_cid50_subsidy-DEFAULT_regulatory-DEFAULT_CFC.xml>fastboot flash boot boot.img
(bootloader) is-logical:boot: not found
Sending 'boot' (16384 KB) OKAY [ 0.613s]
Writing 'boot' (bootloader) Image signed with key bad key
OKAY [ 0.378s]
Finished. Total time: 1.231s

C:\Users\henrique\Downloads\XT1792_MONTANA_RETBR_8.1.0_OPPS28.65-37-7-11_cid50_subsidy-DEFAULT_regulatory-DEFAULT_CFC.xml>fastboot flash recovery recovery.img
(bootloader) is-logical:recovery: not found
Sending 'recovery' (16484 KB) OKAY [ 0.761s]
Writing 'recovery' (bootloader) Image signed with key bad key
OKAY [ 0.414s]
Finished. Total time: 1.195s

C:\Users\henrique\Downloads\XT1792_MONTANA_RETBR_8.1.0_OPPS28.65-37-7-11_cid50_subsidy-DEFAULT_regulatory-DEFAULT_CFC.xml>fastboot flash system system.img_sparsechunk.0
(bootloader) is-logical:system: not found
Sending 'system' (256294 KB) OKAY [ 9.651s]
Writing 'system' OKAY [ 4.120s]
Finished. Total time: 13.850s

C:\Users\henrique\Downloads\XT1792_MONTANA_RETBR_8.1.0_OPPS28.65-37-7-11_cid50_subsidy-DEFAULT_regulatory-DEFAULT_CFC.xml>fastboot flash system system.img_sparsechunk.1
(bootloader) is-logical:system: not found
Sending 'system' (256762 KB) OKAY [ 9.515s]
Writing 'system' OKAY [ 3.308s]
Finished. Total time: 12.883s

C:\Users\henrique\Downloads\XT1792_MONTANA_RETBR_8.1.0_OPPS28.65-37-7-11_cid50_subsidy-DEFAULT_regulatory-DEFAULT_CFC.xml>fastboot flash system system.img_sparsechunk.2
(bootloader) is-logical:system: not found
Sending 'system' (255764 KB) OKAY [ 9.226s]
Writing 'system' OKAY [ 3.520s]
Finished. Total time: 12.858s

C:\Users\henrique\Downloads\XT1792_MONTANA_RETBR_8.1.0_OPPS28.65-37-7-11_cid50_subsidy-DEFAULT_regulatory-DEFAULT_CFC.xml>fastboot flash system system.img_sparsechunk.3
(bootloader) is-logical:system: not found
Sending 'system' (260630 KB) OKAY [ 9.383s]
Writing 'system' OKAY [ 3.412s]
Finished. Total time: 12.846s

C:\Users\henrique\Downloads\XT1792_MONTANA_RETBR_8.1.0_OPPS28.65-37-7-11_cid50_subsidy-DEFAULT_regulatory-DEFAULT_CFC.xml>fastboot flash system system.img_sparsechunk.4
(bootloader) is-logical:system: not found
Sending 'system' (257521 KB) OKAY [ 9.228s]
Writing 'system' OKAY [ 3.391s]
Finished. Total time: 12.655s

C:\Users\henrique\Downloads\XT1792_MONTANA_RETBR_8.1.0_OPPS28.65-37-7-11_cid50_subsidy-DEFAULT_regulatory-DEFAULT_CFC.xml>fastboot flash system system.img_sparsechunk.5
(bootloader) is-logical:system: not found
Sending 'system' (245941 KB) OKAY [ 8.820s]
Writing 'system' OKAY [ 3.200s]
Finished. Total time: 12.044s

C:\Users\henrique\Downloads\XT1792_MONTANA_RETBR_8.1.0_OPPS28.65-37-7-11_cid50_subsidy-DEFAULT_regulatory-DEFAULT_CFC.xml>fastboot flash system system.img_sparsechunk.6
(bootloader) is-logical:system: not found
Sending 'system' (258569 KB) OKAY [ 9.291s]
Writing 'system' OKAY [ 3.262s]
Finished. Total time: 12.612s

C:\Users\henrique\Downloads\XT1792_MONTANA_RETBR_8.1.0_OPPS28.65-37-7-11_cid50_subsidy-DEFAULT_regulatory-DEFAULT_CFC.xml>fastboot flash system system.img_sparsechunk.7
(bootloader) is-logical:system: not found
Sending 'system' (251493 KB) OKAY [ 9.190s]
Writing 'system' OKAY [ 3.742s]
Finished. Total time: 13.034s

C:\Users\henrique\Downloads\XT1792_MONTANA_RETBR_8.1.0_OPPS28.65-37-7-11_cid50_subsidy-DEFAULT_regulatory-DEFAULT_CFC.xml>fastboot flash system system.img_sparsechunk.8
(bootloader) is-logical:system: not found
Sending 'system' (257933 KB) OKAY [ 9.402s]
Writing 'system' OKAY [ 3.731s]
Finished. Total time: 13.272s

C:\Users\henrique\Downloads\XT1792_MONTANA_RETBR_8.1.0_OPPS28.65-37-7-11_cid50_subsidy-DEFAULT_regulatory-DEFAULT_CFC.xml>fastboot flash system system.img_sparsechunk.9
(bootloader) is-logical:system: not found
Sending 'system' (214096 KB) OKAY [ 7.731s]
Writing 'system' OKAY [ 2.703s]
Finished. Total time: 10.466s

C:\Users\henrique\Downloads\XT1792_MONTANA_RETBR_8.1.0_OPPS28.65-37-7-11_cid50_subsidy-DEFAULT_regulatory-DEFAULT_CFC.xml>fastboot flash oem oem.img
(bootloader) is-logical:oem: not found
Sending 'oem' (247426 KB) OKAY [ 8.946s]
Writing 'oem' OKAY [ 3.281s]
Finished. Total time: 12.290s

C:\Users\henrique\Downloads\XT1792_MONTANA_RETBR_8.1.0_OPPS28.65-37-7-11_cid50_subsidy-DEFAULT_regulatory-DEFAULT_CFC.xml>fastboot erase cache
Erasing 'cache' OKAY [ 0.016s]
Finished. Total time: 0.031s

C:\Users\henrique\Downloads\XT1792_MONTANA_RETBR_8.1.0_OPPS28.65-37-7-11_cid50_subsidy-DEFAULT_regulatory-DEFAULT_CFC.xml>fastboot erase userdata
Erasing 'userdata' OKAY [ 0.216s]
Finished. Total time: 0.216s

C:\Users\henrique\Downloads\XT1792_MONTANA_RETBR_8.1.0_OPPS28.65-37-7-11_cid50_subsidy-DEFAULT_regulatory-DEFAULT_CFC.xml>fastboot erase DDR
Erasing 'DDR' OKAY [ 0.000s]
Finished. Total time: 0.016s

C:\Users\henrique\Downloads\XT1792_MONTANA_RETBR_8.1.0_OPPS28.65-37-7-11_cid50_subsidy-DEFAULT_regulatory-DEFAULT_CFC.xml>fastboot oem fb_mode_clear
OKAY [ 0.016s]
Finished. Total time: 0.016s

C:\Users\henrique\Downloads\XT1792_MONTANA_RETBR_8.1.0_OPPS28.65-37-7-11_cid50_subsidy-DEFAULT_regulatory-DEFAULT_CFC.xml>fastboot oem lock
(bootloader) Check 'Allow OEM Unlock' in Android Settings > Developer
(bootloader) Options
OKAY [ 0.000s]
Finished. Total time: 0.016s

fastboot getvar all

fastboot getvar all
(bootloader) version: 0.5
(bootloader) version-bootloader: moto-msm8937-BC.12
(bootloader) product: montana
(bootloader) board: montana
(bootloader) secure: yes
(bootloader) hwrev: P3
(bootloader) radio: 3
(bootloader) storage-type: emmc
(bootloader) emmc: 32GB SAMSUNG QX13MB RV=08 PV=07 FV=0000000000000007
(bootloader) ram: 2GB SAMSUNG LP3 DIE=8Gb M5=01 M6=05 M7=00 M8=1F
(bootloader) cpu: MSM8937
(bootloader) serialno: 0044243152
(bootloader) cid: 0x0032
(bootloader) channelid: 0x17
(bootloader) uid: EBC7344E00000000000000000000
(bootloader) securestate: flashing_unlocked
(bootloader) iswarrantyvoid: yes
(bootloader) max-download-size: 535822336
(bootloader) reason: Reboot mode set to fastboot
(bootloader) imei: ---------------------hidden
(bootloader) meid:
(bootloader) date: 02-19-2018
(bootloader) sku: XT1792
(bootloader) carrier_sku:
(bootloader) battid: SB18C15119
(bootloader) iccid:
(bootloader) cust_md5:
(bootloader) max-sparse-size: 268435456
(bootloader) current-time:
(bootloader) ro.build.fingerprint[0]: motorola/montana/montana:8.1.0/OPP
(bootloader) ro.build.fingerprint[1]: S28.65-37-7-11/7f8a6:user/release-
(bootloader) ro.build.fingerprint[2]: keys
(bootloader) poweroffalarm: 0
(bootloader) ro.build.version.full[0]: Blur_Version.28.281.15.montana.re
(bootloader) ro.build.version.full[1]: tail.en.US
(bootloader) ro.build.version.qcom: LA.UM.6.6.r1-08600-89xx.0
(bootloader) version-baseband[0]: M8937_37.13.03.75R MONTANA_BRAZILDSDS_
(bootloader) version-baseband[1]: CUST
(bootloader) kernel.version[0]: Linux version 3.18.71-perf-g1c8179f (hud
(bootloader) kernel.version[1]: soncm@ilclbld69) (gcc version 4.8 (GCC)
(bootloader) kernel.version[2]: ) #1 SMP PREEMPT Sun Aug 11 12:40:44 CDT
(bootloader) kernel.version[3]: 2019
(bootloader) sbl1.git: git=MBM-NG-VBC.12-0-g77d3670
(bootloader) rpm.git: git=bd76357-dirty
(bootloader) tz.git: git=57946dd
(bootloader) devcfg.git: git=57946dd
(bootloader) keymaster.git: git=57946dd
(bootloader) cmnlib.git: git=57946dd
(bootloader) cmnlib64.git: git=57946dd
(bootloader) prov.git: git=57946dd
(bootloader) aboot.git: git=MBM-NG-VBC.12-0-g0b9dae9
(bootloader) frp-state: protected (77)
(bootloader) ro.carrier: timbr
(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
all: listed above
Finished. Total time: 0.290s

What i can do?

obs: the only boot.img that the xt1792 recognized as signed was the magisk_patched.img