Switching A/B slots in update.zip #249
-
Recently I have been playing with an idea in my head, but I can't seem to figure out if it's theoretically possible or not. The advantage of having A/B partitioning for the system is that it should be possible to easily test one system and switch back to the old one if it doesn't work. This normally happens automatically. But what if I want to test a system which successfully boots in the other slot and then just want to switch back to the old one. Of course you can sideload the full OTA and it will switch the slot back, but for repeated testing this will take some time and unnecessary wear of the flash. When the other system has some form of root access, switching slots is possible when booted inside that system. But what if the other system doesn't have root access? When the bootloader is unlocked you can switch the slots in fastboot, but when the bootloader is locked, this is not possible. As far as I'm aware the only way to interact in such a 'low-level' way with the system when the bootloader is locked, is when sideloading a correctly signed update zip. Do you think it is possible to fabricate some sort of correctly signed update.zip which allows you to switch slots, or perform some kind of shell scripting? Much like how the old updater-script/updater-binary used to work when A/B partitioning wasn't used. Or does this kind of scripting still works on newer devices and we just have to find a way to sign the updates? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 4 replies
-
This used to be true, but unfortunately no longer is due to virtual A/B. Now, only partitions that are read by the bootloader, like When flashing an OTA, it takes a snapshot of the current system by setting up some sort of copy-on-write block device for each partition. Any newly written data then gets buffered to files within The only way to boot back into the old slot is to somehow simulate a boot failure to avoid triggering the "this booted successfully" process. This would prevent Android from merging the changes and telling the bootloader that the new slot is good (so that the downgrade protection won't be tripped when switching back). |
Beta Was this translation helpful? Give feedback.
This used to be true, but unfortunately no longer is due to virtual A/B. Now, only partitions that are read by the bootloader, like
boot
andvendor_boot
, have distinct_a
and_b
partitions. The remaining big dm-verity partitions don't.When flashing an OTA, it takes a snapshot of the current system by setting up some sort of copy-on-write block device for each partition. Any newly written data then gets buffered to files within
/data
. As soon as the new slot boots successfully, the changes are merged and the old "slot" basically ceases to exist.The only way to boot back into …