We have moved to a new Sailfish OS Forum. Please start new discussions there.
0

Restoring system-wide backup fails [answered]

asked 2018-09-03 16:01:04 +0300

Ingvix gravatar image

I reinstalled Sailfish to F5121 as I needed to use Android system for a while. I did the backup according to this tutorial and after restoring it I can't get past Sony logo.

I did the file system check in hybris-recovery and it gives me this:

  /dev/mmcblk0rpmb: read failed after 0 of 4096 at 0: Input/output error
  2 logical volume(s) in volume group "sailfish" now active
e2fsck 1.43.1 (08-Jun-2016)
Pass 1: Checking inodes, blocks, and sizes
Pass 2: Checking directory structure
Pass 3: Checking directory connectivity
Pass 4: Checking reference counts
Pass 5: Checking group summary information
root: 43781/360960 files (0.2% non-contiguous), 451753/1536000 blocks
e2fsck 1.43.1 (08-Jun-2016)
Pass 1: Checking inodes, blocks, and sizes
Pass 2: Checking directory structure
Pass 3: Checking directory connectivity
Pass 4: Checking reference counts
Pass 5: Checking group summary information
home: 27153/872032 files (3.0% non-contiguous), 832997/3889152 blocks
  /dev/mmcblk0rpmb: read failed after 0 of 4096 at 0: Input/output error
  0 logical volume(s) in volume group "sailfish" now active
Done

Is there anyway to fix my backup or do I have to start from a scratch? Any advice how to prevent this from happening with possible future backups?

edit retag flag offensive reopen delete

The question has been closed for the following reason "the question is answered, an answer was accepted" by jiit
close date 2018-10-15 10:21:04.595067

Comments

The reason :

The howto you link is a procedure to restore the LVM partition on a Sailfish X-running Xperia.

Your Xperia was running Android.

I'm writing a more detailed answer.

DrYak ( 2018-09-03 18:40:45 +0300 )edit

2 Answers

Sort by » oldest newest most voted
2

answered 2018-10-14 12:13:34 +0300

Ingvix gravatar image

updated 2018-10-14 12:14:20 +0300

I changed the UUID of fimage partition in root partition's /etc/fstab to match the UUID in the output of blkid /dev/sailfish/* /dev/mmcblk0p52 and then it booted succesfully to the system.

edit flag offensive delete publish link more
1

answered 2018-09-03 19:17:01 +0300

DrYak gravatar image

updated 2018-09-03 20:01:19 +0300

Reason :

The howto was written to a Sailfish X-running Xperia X.

Your Xperia X was running Android, so in addition to your installation (that you carefully backed up), there are other bits that needs to be switch back from Android to Sailfish X.

Namely :

Kernel problem

Sailfish X uses a slightly older kernel (3.10.84) than Android with several different options and drivers compiled in (Sailfish X has the BTRFS compiled in).

Drivers problem

Beware that the current android version on Sony Xperia uses much newer drivers than Sailfish.

Sony has currently Android 7.1 Nougat and 8.0 Oreo available for Xperia X, you probably ran one of these.

Sailfish X, according to the install isntructions still uses older drivers from AOSP 6.0.1 Marshmallow.

Fixing the problems

Simple fix

The simplest fix would be to first download a Sailfish X installer for the same version as the one you took your backup with (best to download it from Jolla on the same moment you make the backup to be sure to have the right version).

Then reflash the device using the regular procedure, including the part where you download the Sony binary drivers.

Once the reflashing is finished, you have a nearly-empty (i.e.: in factory state) partition /dev/mmcblk0p51. You can now use the howto to over-write the default nearly-emptry system with your own backup.

Fixing from the command line

Using a laptop to only reflash the part you need is easier (because fastboot know which partition hold what).

You need to to (assuming you are into the directory with all necessary images : SailfishX, Sony's blob, your backup) :

  • Flash the kernel, so you boot with Sailfish X's linux kernel (3.10.84, with BTRFS and other Sailfish bits) instead of Android's (3.10.108, with various android bits) :

    fastboot flash boot hybris-boot.img

  • Optionnally flash the recovery, so you have Sailfish' instead of TWRP or whatever you did use on Android :

    fastboot flash recovery hybris-recovery.img

    (At this point, it's now possible to boot into sailfish recovery with the button press trick instead of needing to upload it through fastboot boot)

  • Flash the Sony blob:

    fastboot flash oem SW_binaries_for_Xperia_AOSP_M_MR1_3.10_v13_loire.img

    (At this point your Xperia is now able to boot into Sailfish X again)

  • Flash your backup :

    gzip -d -k backup.img.gz

    fastboot flash userdata backup.img

    (At this point your Xperia should work as before)

  • Flash the factory reset back up partition :

    fastboot flash system fimage.img001

    (At this point your Xperia is exactly as before your Android tests)

Now you can safely reboot, your Xperia X should work just like before the switch to Android.

From within Sailfish recovery

It's possible but you need to pay special attention to be sure that you're overwriting the right partition.

DISCLAIMER: I haven't fully check this one method, proceed with care. Don't blame me if you brick your smartphone.

Assuming you have mounted the SD card, and are in the directory with all the img files (Sailfish X, Sony blob, compressed backup).

(Note: I use blocks of size bs=4096 but you could skip this argument and let dd use smaller blocks)

  • Flash the kernel :

    blkid /dev/mmcblk0p22

    Double check that this partition 22 is PARTLABEL="boot otherwise, you might brick your phone.

    dd bs=4096 if=hybris-boot.img of=/dev/mmcblk0p22

  • Flash the Sony blob:

    blkid /dev/mmcblk28

    Double check that this partition 28 is PARTLABEL="oem" and LABEL="odm" (usually TYPE="ext4")

    dd bs=4096 if=SW_binaries_for_Xperia_AOSP_M_MR1_3.10_v13_loire.img of=/dev/mmcblk28

  • Flash your backup :

    blkid /dev/mmcblk51

    Normally this partition 51 is PARTLABEL="userdata" (usually TYPE="ext4" on Android, and TYPE="LVM2_member" on Sailfish X) gzip -d -c backup.img.gz | dd bs=4096 of=/dev/mmcblk0p51

At this point your Xperia should be bootable. For the remaining parts :

  • Flash the recovery :

    blkid /dev/mmcblk0p42

    Double check that the partition 42 is PARTLABEL="FOTAKernel"

    dd bs=4096 if=hybris-recovery.img of=/dev/mmcblk0p42

  • Flash the factory reset back up partition :

    blkid /dev/mmcblk0p52

    Normally this partition 51 is PARTLABEL="system" (it usually is TYPE="ext4", Sailfish calls it LABEL="fimage")

    dd bs=4096 if=fimage.img001 of=/dev/mmcblk0p52

At this point your Xperia is exactly as before your Android tests.

Now you can safely reboot, your Xperia X should work just like before the switch to Android.

edit flag offensive delete publish link more

Comments

Actually I did install the Sailfish system image and it was working fine before I restored the backup. Sorry, should've mentioned it in the question.

Ingvix ( 2018-09-03 20:24:26 +0300 )edit

stupid question : did you install the SAME Sailfish X version that you made your backup from ?

i.e.: you didn't install Sailfish X using an old 2.1.3.5 installer you had laying around back from when it was launched, but did your backup from an up to date 2.2.0.29 ?

(e.g.: There has been minor update to the kernel here and there in between)

You could also try to look at the logs :

  • mount the root partition (/dev/sailfish/root) somewhere.
  • in etc/systemd/journald.conf file present in that partition, switch the journal from Storage=volatile to Storage=auto
  • create a directory var/log/journal/ on that partition.
  • umount

This will persist the the log on the storage (at least if the booted system manage to get at least to the point where storage is accessible)

On the next boot, use journalctl --root= + path where you mounted /dev/sailfish/root to read the logs.

Yet another thing to check is if the UUID reported by blkid /dev/sailfish/* /dev/mmcblk0p52 match those used the root partition's etc/fstab. (They should, as all come from the same backup).

Running out of idea. Maybe send a ticket to Jolla if you have an official license.

DrYak ( 2018-09-03 20:43:29 +0300 )edit

Sorry for the late response, been busy. Fimage's UUID does not match. Should it? I don't know what does it do but as far I undestood I only backupped the home and root partitions with that tutorial. Should I change the UUID in fstab to match?

There's no journalctl command in hybris-recovery shell. Did you mean I should try to make telnet or ssh connection when the system is booted? If so, I don't know what address to use to connect to it in the failed boot state.

Ingvix ( 2018-10-14 12:00:29 +0300 )edit

Question tools

Follow
3 followers

Stats

Asked: 2018-09-03 16:01:04 +0300

Seen: 451 times

Last updated: Oct 14 '18