fastboot flash bootloader = FAILED (remote: (InvalidState)) I'm trying to flash bootloader on my Nexus 7 (2012) and getting FAILED:

mbp:nakasi-lrx21p alexus$ fastboot flash bootloader bootloader-grouper-4.23.img
sending 'bootloader' (2100 KB)...
OKAY [  0.305s]
writing 'bootloader'...
FAILED (remote: (InvalidState))
finished. total time: 0.445s
mbp:nakasi-lrx21p alexus$


What am I doing wrong?
According to this XDA thread it's an issue with the bootloader file. You could try downloading a different factory image for your device and try the bootloader from there instead (the recent images have all had the same 4.23 version, although different files).


  Does anyone else get a "invalidState" and "signature mismatch" message
  when trying to flash the bootloader.img from the new JWR66Y factory
  image? Flashing the previous bootloader.img from JWR66V image or JDQ39
  image works just fine though.


Although the thread refers to a JellyBean issue I encountered the same problem when flashing my Nexus 7 to the Lollipop (LRX21P) factory image as well. As I already had v4.23 I did not flash a new bootloader, my Nexus 7 has booted ok so you could skip it all together.