[Moto G5 Plus Questions & Answers] jayray1:
Got it back to factory boot, but have a few messages about bad key. How do I relock and have it 100% back to factory? Do I just "fastboot oem lock" at the end before reboot in the script? Below is output

./flashallO.sh
OKAY [ 0.001s]
Finished. Total time: 0.002s
(bootloader) is-logical:partition: not found
Sending 'partition' (45 KB) OKAY [ 0.170s]
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.078s]
Finished. Total time: 0.248s
(bootloader) is-logical:bootloader: not found
Sending 'bootloader' (5115 KB) OKAY [ 0.300s]
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.554s]
Finished. Total time: 0.855s
(bootloader) is-logical:modem: not found
Sending 'modem' (71921 KB) OKAY [ 1.955s]
Writing 'modem' OKAY [ 1.089s]
Finished. Total time: 3.047s
(bootloader) is-logical:fsg: not found
Sending 'fsg' (3012 KB) OKAY [ 0.244s]
Writing 'fsg' OKAY [ 0.119s]
Finished. Total time: 0.364s
Erasing 'modemst1' OKAY [ 0.034s]
Finished. Total time: 0.034s
Erasing 'modemst2' OKAY [ 0.034s]
Finished. Total time: 0.034s
(bootloader) is-logical:dsp: not found
Sending 'dsp' (16384 KB) OKAY [ 0.577s]
Writing 'dsp' OKAY [ 0.280s]
Finished. Total time: 0.858s
(bootloader) is-logical:logo: not found
Sending 'logo' (2186 KB) OKAY [ 0.224s]
Writing 'logo' OKAY [ 0.116s]
Finished. Total time: 0.340s
(bootloader) is-logical:boot: not found
Sending 'boot' (16384 KB) OKAY [ 0.600s]
Writing 'boot' (bootloader) Image signed with key bad key
OKAY [ 0.378s]
Finished. Total time: 0.979s
(bootloader) is-logical:recovery: not found
Sending 'recovery' (20580 KB) OKAY [ 0.690s]
Writing 'recovery' (bootloader) Image signed with key bad key
OKAY [ 0.481s]
Finished. Total time: 1.172s
(bootloader) is-logical:system: not found
Sending 'system' (258396 KB) OKAY [ 6.581s]
Writing 'system' OKAY [ 3.730s]
Finished. Total time: 10.313s
(bootloader) is-logical:system: not found
Sending 'system' (256514 KB) OKAY [ 6.543s]
Writing 'system' OKAY [ 3.332s]
Finished. Total time: 9.877s
(bootloader) is-logical:system: not found
Sending 'system' (246302 KB) OKAY [ 6.347s]
Writing 'system' OKAY [ 3.631s]
Finished. Total time: 9.985s
(bootloader) is-logical:system: not found
Sending 'system' (262141 KB) OKAY [ 6.670s]
Writing 'system' OKAY [ 3.350s]
Finished. Total time: 10.022s
(bootloader) is-logical:system: not found
Sending 'system' (262141 KB) OKAY [ 6.679s]
Writing 'system' OKAY [ 3.421s]
Finished. Total time: 10.104s
(bootloader) is-logical:system: not found
Sending 'system' (262141 KB) OKAY [ 6.686s]
Writing 'system' OKAY [ 3.323s]
Finished. Total time: 10.011s
(bootloader) is-logical:system: not found
Sending 'system' (250531 KB) OKAY [ 6.416s]
Writing 'system' OKAY [ 3.666s]
Finished. Total time: 10.089s
(bootloader) is-logical:system: not found
Sending 'system' (262059 KB) OKAY [ 6.693s]
Writing 'system' OKAY [ 3.740s]
Finished. Total time: 10.444s
(bootloader) is-logical:system: not found
Sending 'system' (254142 KB) OKAY [ 6.485s]
Writing 'system' OKAY [ 3.301s]
Finished. Total time: 9.789s
(bootloader) is-logical:oem: not found
Sending 'oem' (104608 KB) OKAY [ 2.766s]
Writing 'oem' OKAY [ 1.373s]
Finished. Total time: 4.143s
Erasing 'cache' OKAY [ 0.019s]
Finished. Total time: 0.019s
Erasing 'userdata' OKAY [ 0.185s]
Finished. Total time: 0.185s
Erasing 'DDR' OKAY [ 0.002s]
Finished. Total time: 0.003s
OKAY [ 0.001s]
Finished. Total time: 0.002s
Rebooting OKAY [ 0.000s]
Finished. Total time: 0.151s