Android 13 and SailfishOS on Xperia 10 III

I took the backup via ssh to my laptop. Maybe this is interesting for some:
Backup and restore both take about 1 hour each, most of it without interaction.
Flashing android and reinstalling sfos took about 1h for me as well (most of the trouble was reviving a windows pc).
If you want to be really failsafe,mount your homepartition wiht cryptsetup after backup to make sure everything worked (either ungzip before cryptsetup or use avfs

  1. connect device in fastboot mode (volume up and plugin usb cable on a powerd off phone)
  2. flash recovery from the sailfishos distribution you use for flashing:
fastboot flash boot_a hybris-recovery.img
fastboot flash boot_b hybris-recovery.img
fastboot reboot
  1. telnet to the device from your computer:
telnet 10.42.66.66
  1. enter shell and prepare a public ssh key from your pc
mkdir /root/.ssh
chmod 600 /root/.ssh
echo "<your ssh key>">/root/.ssh/authorized_keys
exit
  1. launch sshd from the menu and connect to it by following the instructions (no password needed). You can exit again, if it works. I assume the ip 10.42.66.66 for the commands below.
  2. save backup: (pv shows the progress)
ssh root@10.42.66.66 "/usr/bin/pigz --stdout /dev/sailfish/root" | pv > 10IIIbackup-root.gzip
ssh root@10.42.66.66 "/usr/bin/pigz --stdout /dev/sailfish/home" | pv > 10IIIbackup-home.gzip
  • do your things (flash android via emma)
  • reinstall sfos
  • boot sfos
  • shutdown, enter fastboot flash recovery, reboot into recovery enter ssh (step 1-5)
  • restore your partitions
ssh root@10.42.66.66 -T "/usr/bin/pigz -d > /dev/sailfish/root" < 10IIIbackup-root.gz
ssh root@10.42.66.66 -T "/usr/bin/pigz -d > /dev/sailfish/home" < 10IIIbackup-home.gz

Comments:
using pigz (parallel gzip) is actually completly pointless on the home partition. This device is still encrypted (not what i was expecting) thus compression wont help anything.
Root partition should compress relativley good because this seems to be plain.
root partition backup and restore took about 1min, home partition backup 40min and restore 51min. The gzip command for the homepartition can be replaced by cat but shouldnt be a bottleneck with default parameters

7 Likes

I’m not confusing binaries and OS, but I never flashed full A12 OS here, just A12 binaries. So this last experiment was “A12 binaries on top of A11 OS”.

“Binaries don’t change anything” I should’ve worded better: A12 binaries on top of A11 OS caused a camera functionality regression. Everything else seemed to have stayed equal to my A11 binaries experience, hence no reason to try fix the camera regression in some other way.

I flashed A11 binaries back: Android camera functionality was immediately restored.

Thanks for SFOS partitions backup/restore guide: I will do a full A12 base flash after I’m back from US road trip, avoiding large risks during travel.

(US: where X10III lack of band 12 is definitely sub-optimal, see Sailfish in the USA - #244 by lkraav)

You introduced the necessity to reinstall SailfishOS only to restore the LVM volume layout by backing up on LVM volume level. IMO this is pretty senseless, either backup on block device level (/dev/sda79 for the Xperia 10 III) or on filesystem level for regular backups using tar (but the latter is unsuitable for the purpose here, i.e. backing up the complete SailfishOS installation).

If one wants to backup to another device (instead of on SD-card), the easiest way is to pipe into or from scp (in order not to resort to ancient tools as rcp or netcat).
I.e. for backing up
dd if=/dev/sda79 bs=4M | scp <user>@<host>:<directory>/backup-sda79_$(date -I).img
and for restoring
scp <user>@<host>:<directory>/backup-sda79_$(date -I).img | dd of=/dev/sda79 bs=4M

P.S. / Edit: Oops, scp does not seem to be able to read from or write to a pipe.

So one may try this (also untested):

  • Backup on your PC by
    ssh root@10.42.66.66 "/usr/bin/cat /dev/sda79" > backup-sda79_$(date -I).img
  • and restore from your PC by
    ssh root@10.42.66.66 -T "/usr/bin/cat > /dev/sda79" < backup-sda79_<hit-tab-to-autocomplete>.img

P.P.S.: @niquest did it by using netcat (nc).

1 Like

You dont need to reinstall sfos before recovering from the backup?
i should have read that more carefully.
i was only playing around with home and root because i wanted to see what effect encryption has. Your approach is probably better

You dont need to reinstall sfos befote recovering from the backup?

Correct, that’s what makes it worth trying on a daily driver. Reinstall is a real chore.

That’s the reason why I only mentioned uncompressed backup in my post. Compression (well, at least gzip that I’ve tried) is quite slower and doesn’t seem to be helping much.

I don’t remember having seen any banding since I started using Android 12 (along with Android 12 binaries), but I haven’t tested it with nightish. I’ll give it a try.

Well, I’ve only ever used A12 binaries together with Android 12 OS as base for SFOS (and that was actually the reason of using them - to have a matching pair), so I can’t tell how they behave on top of Android 11.

Anyway, as I wrote earlier, I actually haven’t noticed any improvements that would result from changing the binaries because all fixes (including the echo issue, banding/color tint and fingerprint sensor functionality) apparently come from upgrading the underlying Android OS to version 12 or 13, and not the binaries. So I guess it is OK to just stick with Jolla recommended A11 binaries, or in case of using Android 12 as base OS for SFOS one may also use A12 (v2a) binaries to have a matching pair that may POSSIBLY give some advantages (or not :slight_smile: ) but in that specific combination (Android 12 62.1.A.0.675 as underlying OS, Android 12 v2a binaries) after weeks of tests don’t seem to be causing any issues.

You do need to reinstall SFOS prior to restoring the backup in the case that you wiped the existing SFOS installation (e.g. by reflashing Android using EMMA). Or in such case you need to at least manually flash the remaining partitions that SFOS uses, which are not in your /dev/sda79 backup (that only contains rootfs and home). Namely:

fastboot flash boot_a hybris-boot.img
fastboot flash boot_b hybris-boot.img
fastboot flash dtbo_a dtbo.img
fastboot flash dtbo_b dtbo.img
fastboot flash oem_a Sony_binaries.img
2 Likes

We should compile that info into a wiki post

5 Likes

Good idea. One more thing worth including in such a wiki post is that after restoring the /dev/sda79 backup it is sometimes not possible to add new fingerprints without doing the following. The existing fingerprints work OK, but if one wants to add new ones it takes wiping them and the cache first, as suggested by @ric9k here:

systemctl stop sailfish-fpd
/usr/libexec/sailfish-fpd/fpslave --remove-all
/usr/libexec/sailfish-fpd/fpslave --flush-cache
systemctl start sailfish-fpd

and then it works as usual. I’ve tested it multiple times after each restore and it always works, so there’s nothing to be worried about, just an additional easy step to do after restore.

This is regardless of underlying Android OS version, binaries version, etc.

4 Likes

(which took it from @spiiroin here :slight_smile: )

2 Likes

Uh, and this binaries experiment gets even weirder: color banding, or “paint blobs” is also gone now. Damn, turns out I should’ve taken photos of the device screen to document I’m not crazy :slight_smile:

I’m looking at the exact same “Work” app launcher folder I screenshotted earlier at Android 13 and SailfishOS on xperia 10 III - #61 by lkraav and there’s zero weird color banding on screen, everything now looks exactly like in the screenshot - translucency, shadows are all perfect.

Maybe lighting conditions were different. This color banding issue only becomes apparent with very low screen brightness, so with an automatic display brightness it takes being in a dark place to see it.

Yes, confirmed! In a pitch black dark room, color banding is visible. OK I think now that’s all there is to know about it, thanks. Will test full A12 juggle next week.

3 Likes

oh yeah, I don’t have the Sony anymore, but remember that colors… man, how bad they were. With A12 or A13 that’s solved

1 Like

Hello, picking up this thread on the “backup wiki” subject. I am not very fluent with linux bash but is it even possible to use dd on a “live” device? Will I not get corrupted data? Or am I missing something?

I think I answered it myself. It is not live. Sorry for the uninformed question.

[root@Xperia10III dev]# umount /dev/sda79
umount: /dev/sda79: not mounted.
1 Like

Sda79 actually contains 2 partitions: root and home. Thus sda79 is not mounted but its contents are. On a live system those change during dd and corrupt the backup. The backup should be done via the recovery.

3 Likes

Thanks for the insight. Can you confirm it works like this:

  • flash the hybris-recovery image respectively to boot_a and _b using fastboot
  • reboot
  • telnet to the device
  • file a public key on the device
    → then proceed with dd activity via ssh?

By the way, the above command didn’t work out for me but I was able to make it work like this (ssh’d into device and as devel-su):

dd if=/dev/sda79 bs=4M | ssh myusername@
address 'cat > /mypath/dd/backup-sda79_$(date
 -I).img'

As a side note, I found out that when running dd on Sailfish it seems impossible to monitor the data transfer by either calling ‘status=progress’

dd: invalid argument 'progress' to 'status'

or to view the pipe content by inserting a ‘| pv |’ as in was suggested on some forum:

dd if=/dev/sda79 bs=4M | pv | ssh potato@address

result:

bash: pv: not found

Anyway thank you very much for your help!

Try

watch -n5 'kill -USR1 $(pgrep ^dd$)'

from another telnet session to get update about dd progress every 5 seconds.

1 Like

There are a couple of approaches in this thread. One is this which matches what you say

Thanks for pointing it out.
Your linked post by @wetab73 only partially matches my query as I want to dd my /dev/sda79 to a network drive as suggested by @olf and not to an sd card (it’s a size issue). I am currently using telnet and investigating netcat which appears to possibly run in recovery mode.
I only have a limited idea of what I’m doing but I find a discrepancy between the way recovery mode seems to work and the idea of dd’ing large data via scp. OTOH, ssh and with it scp seems to preclude copying an unmounted volume because it would run on the same?

If you guys think that this discussion is misplaced here please say so and I will remove it and attach it to an appropriate thread (haven’t found one so far) or open a new one.