I messed up flashing a beta Android Q build on my phone.

After that, I can't flash my stable ROM without error 7 in TWRP - device mismatch. Removing the assert works, but not a permanent solution.

So, I digged through google and my own phone for hours and found out why. My device is identified as raphael in recovery, but it is identified as raphaelin in fastboot and while the phone is booted.

In recovery:

# getprop ro.product.device
# raphael

In booted mode (i.e. while the phone is booted):

# getprop ro.product.device
# raphaelin

In fastboot:

> fastboot getvar product
product: raphaelin

I checked my build.prop and the value in that file is raphaelin too. I tried setprop and it showed that it can't set that property.

So, please advise me on how to set the value using setprop in recovery mode. Or, if you know, please let me know from where the recovery is pulling data for getprop and if I can change that file.


Firstly the main Android OS (what you call "boot mode") and recovery are two independent operating systems. When one is running, other is not. Running processes are different, environment is different, loaded properties are different and so on.

Recovery has its own default.prop file in ramdisk from which it reads properties. In order to permanently change the value of ro.product.device you'll have to unpack recovery.img (or boot.img on A/B devices), modify the file, repack and re-flash.

Secondly you can't set read-only (ro.*) properties once they are already set. Magisk's resetprop tool however can do this, going a little out of the way.

Thirdly ro.product.device is usually set in /system/build.prop. So you can edit this file and reboot device to see changes. There are also some other files from which properties are set on boot.
Make sure not to break dm-verity by modifying /system if enabled.

Since the (/system and other) partitions are accessible from recovery mode too, you can mount filesystem read/write in recovery and edit the file.

Fourthly the value you are getting in fastboot is independent of both main OS and recovery. That's hard-coded in bootloader. You'll get that value even if there is no recovery and no Android OS on device.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.