Jump to content
Sign in to follow this  
netman

What do "system-as-root" and "A/B device" mean?

Recommended Posts

On the forum here and a few other sources I learned that the Pro1 uses "system-as-root" for the stock rom which seems partly self explanatory to a linux guy and a quick search does tell me approximately what it means. There's also talk of it being an "A/B device" which also appears to be about the partition table (and not really the device since we can run different operating systems :-), and that appears to be needed for seamless updates.

But I am still left wondering what does it all mean exactly and why it is chosen to be so? System-as-root seems to have a downside being that we can not simply overwrite the recovery partition with a TWRP image (it's however possible with a little bit of trickery if I understand), what are the upsides? Or is it simply so in preparation for Android 10, which apparently requires system-as-root? How does the A/B magic work exactly, is it like the name implies keeping the original OS on say the A partition and installing the update to B so if everything brokes it can safely switch back when booting fails?

If one wants the full details I guess staring at the google pages will reveal most of it and more can be read, but it'd be cool to have a somewhat more concise explanation in laymans terms, I can't be the only one who wants to know :-). I'd never heard of these things before reading about it here, even though being quite at home with linux things these phones are quite another world 😄.

  • Like 2
  • Thanks 3
  • Confused 1

Share this post


Link to post
Share on other sites
9 hours ago, netman said:

How does the A/B magic work exactly, is it like the name implies keeping the original OS on say the A partition and installing the update to B so if everything brokes it can safely switch back when booting fails?

Yes, that is a big benefit of the A/B design.  Another is that you can fully use the phone while the update is happening, without rebooting, since the files aren't in use on the other partition.  When you are ready to switch to the new version, you can reboot at a time that makes sense for you, and come back up on the other partition.

  • Thanks 3

Share this post


Link to post
Share on other sites
4 hours ago, david said:

Yes, that is a big benefit of the A/B design.  Another is that you can fully use the phone while the update is happening, without rebooting, since the files aren't in use on the other partition.  When you are ready to switch to the new version, you can reboot at a time that makes sense for you, and come back up on the other partition.

Thanks for the clarification.

It would have been more clever if it was the same partition BUT with two directory-trees! So the running version just saw some space gobbled in a RO directory while new files were added. In the other tree existing files conflicting were logically moved into a reserved RO space when new versions were added. This way you would only be 'wasting' space for the files that differs and done cleverly you might even share the part of the directory that relates to non-system files. ... You could even allow for keeping more than two versions, with minimal waste... Of course it would require a minimal stub under the normal OS file system handling this (similar to a PC BIOS).

  • Like 2

Share this post


Link to post
Share on other sites
3 hours ago, EskeRahn said:

It would have been more clever if it was the same partition BUT with two directory-trees!

The problem with that is that the partition has to be R/W mounted in it's entirety which means an unexpected crash or power loss could destroy the metadata beyond repair when unlucky. I've seen this happen. Journalling filesystems are the solution for this but they are not quite as bulletproof as just having one mounted RO and the other R/W.

  • Like 1

Share this post


Link to post
Share on other sites
8 hours ago, david said:

Yes, that is a big benefit of the A/B design.  Another is that you can fully use the phone while the update is happening, without rebooting, since the files aren't in use on the other partition.  When you are ready to switch to the new version, you can reboot at a time that makes sense for you, and come back up on the other partition.

That being the case, I'd not wish to undo this, as the Pro1 has plenty of space, and this is a nice failsafe. Theoretically then one could have the stock OS loaded in one and LOS in the other. How would one switch between these?

  • Thanks 1

Share this post


Link to post
Share on other sites
18 hours ago, netman said:

overwrite the recovery partition with a TWRP image

Why would you even want to do that? I for one don't want that. I love the idea of having a 'safe space' on the device that allows me to start over, especially when flashing stuff where things can easily go wrong.

Share this post


Link to post
Share on other sites
40 minutes ago, SteffenWi said:

Why would you even want to do that? I for one don't want that. I love the idea of having a 'safe space' on the device that allows me to start over, especially when flashing stuff where things can easily go wrong.

To allow dual boot, i assume.

  • Like 1

Share this post


Link to post
Share on other sites
44 minutes ago, SteffenWi said:

Why would you even want to do that? I for one don't want that. I love the idea of having a 'safe space' on the device that allows me to start over, especially when flashing stuff where things can easily go wrong.

All other phones that I've had that is the easy way to install TWRP, and TWRP is the new safe space... Or am I mistaken and it's another partition that normally overwritten with TWRP?

  • Like 2

Share this post


Link to post
Share on other sites
2 hours ago, SteffenWi said:

Why would you even want to do that? I for one don't want that. I love the idea of having a 'safe space' on the device that allows me to start over, especially when flashing stuff where things can easily go wrong.

I think the "that" which you are originally referring to was about the device being system as root.  I for one would much rather not have the recovery embedded in the boot partition!  Also, as for TWRP it most certainly creates safe spaces.

Share this post


Link to post
Share on other sites
9 hours ago, silversolver said:

That being the case, I'd not wish to undo this, as the Pro1 has plenty of space, and this is a nice failsafe. Theoretically then one could have the stock OS loaded in one and LOS in the other. How would one switch between these?

The data partition is still shared, so you need operating systems that don't have any conflicting information in the data partition, which generally means it needs to be the same OS.  I don't know if LOS and Android would be close enough to allow for this. I haven't researched if anyone out there has done it.

As for how to manually switch partitions, you do it with fastboot:

fastboot --set-active=a

or

fastboot --set-active=b

As for knowing which partition is currently active, so that you know which one to switch to, that is done with:

fastboot getvar all

Look in the output for:

(bootloader) current-slot:a

or

(bootloader) current-slot:b

And I agree.  I don't see a reason to circumvent the A/B system.  It could save someone from an ugly soft-brick quickly.  4GB out of 128 isn't insignificant, but it is getting there in a phone that supports a large SD card.

Edited by david
  • Like 1
  • Thanks 1

Share this post


Link to post
Share on other sites
6 hours ago, Polaris said:

I for one would much rather not have the recovery embedded in the boot partition!  

Yeah having the recovery partition separate makes changing recoveries a lot easier.

  • Like 1

Share this post


Link to post
Share on other sites
1 hour ago, david said:

Yeah having the recovery partition separate makes changing recoveries a lot easier.

Without a doubt!!

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Sign in to follow this  

×
×
  • Create New...

Important Information

Terms