Xperia 10 III - recovery does not recover [Help please]

So, it seems my phone suffered one of those sudden, nasty “hiccups” we read about here, sometimes. I dunno how relevant it might be, definitely ironic, I was reinstalling MyBackup on my phone, when it froze. After that, it was only the dreaded Sony logo boot loop and nothing else.

Therefore I thought about the recovery mode; I followed the instructions here, and then those here.

I telnet into my phone, I get to the shell, but when I get to input my security-code/passphrase, what I get is a scary “no key”…

/ # cryptsetup luksOpen /dev/sailfish/home recover
Enter passphrase for /dev/sailfish/home:
No key available with this passphrase.

Please, any suggestions would be sooo welcome! (Because obviously all of my things are in the phone, I can’t do without them, my lasy backup was in the Middle Ages, etc…)

Just to be clear: I understand the passphrase be the same number sequence used to unencrypt the phone after turning it on (white dots, black background), right? And, I am pretty sure I am giving the correct sequence in (been using the same for too long, and both for encryption and screen lock), that’s why I am desperate.

PS
In the meanwhile I also exited the telnet connection a couple of times, both through option #2 reboot, and #6 exit, and something odd (to me, at least) is that phone reboots in recovery mode.

I am pretty sure I am giving the correct sequence

Recovery mode should have already asked to input devicelock code (=passphrase), as soon as you have selected the “3) Shell” option:

Type the number of the desired action and press [Enter]: 3
If you continue, this may void your warranty. Are you really SURE? [y/N] [y/N] y
  2 logical volume(s) in volume group "sailfish" now active

Type your devicelock code and press [ENTER] key:
(please note that the typed numbers won't be shown for security reasons)

If you are now as far as executing cryptsetup, it means that the passphrase digits above were entered correctly.

Doublecheck the digits and your keyboard layout on the prompt just before executing cryptsetup luksOpen ...

Hopefully your partitions are intact, you could run the filesystem check from recovery as well (it will ask for the same passphrase when it gets to chk sailfish-home).

So, first of all thanks for helping; I am afraid that I might be in deeper trouble, then.

I checked the output on the terminal against what you posted, and in fact it is (scaringly) different:

> Type the number of the desired action and press [Enter]: 
3
If you continue, this may void your warranty. Are you really SURE? [y/N] [y/N] y
  2 logical volume(s) in volume group "sailfish" now active
[WARNING] Root file system unaccessible, bypassing device lock check.
/ # 

So, it is clear that I misunderstood the instructions at point 2. but it is also clear that something is probably not right.

Thanks again!

[WARNING] Root file system unaccessible, bypassing device lock check.

This error probably means that something’s wrong with your partition(s).
Can you mount rootfs manually?

/ # ls /rootfs # (should be empty, then)
/ # mount /dev/mapper/sailfish-root /rootfs

If mount unsuccessful, I recommend to run recovery’s option 4) Perform file system check.

Ehm… no.

Type the number of the desired action and press [Enter]: 
3 

If you continue, this may void your warranty. Are you really SURE? [y/N] [y/N] y
  2 logical volume(s) in volume group "sailfish" now active
[WARNING] Root file system unaccessible, bypassing device lock check.
/ # ls /rootfs/
apex          dev           linkerconfig  metadata      odm           run           tmp           vendor
config        home          lost+found    mnt           proc          sys           var
/ # 

Oh, by the way, when I run option 4) I get

Type the number of the desired action and press [Enter]: 
4
  2 logical volume(s) in volume group "sailfish" now active
e2fsck 1.45.4 (23-Sep-2019)
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: 70/320000 files (0.0% non-contiguous), 38026/1280000 blocks
Opening encrypted filesystem, you will be prompted for your security code.
Enter passphrase for /dev/sailfish/home: 
No key available with this passphrase.

So, shall I start to give up any hopes?

Will see:

/ # mount | grep rootfs

So…

/ # mount | grep rootfs
rootfs on / type rootfs (rw,size=2139728k,nr_inodes=534932)
/dev/sailfish/root on /rootfs type ext4 (rw,relatime)
none on /rootfs/dev type devtmpfs (rw,relatime,size=2139728k,nr_inodes=534932,mode=755)
proc on /rootfs/proc type proc (rw,relatime)
/ #

This looks like Android’s rootfs, not Sailfish, yet still incomplete. Such as an aborted attempt to flash Android on top, however over the userdata partition, which shouldn’t happen. Would be interesting to see:

find-mmc-bypartlabel userdata
lvm lvdisplay
ls -l /rootfs
ls -l /rootfs/var/log # (if exists)

Thank you.

/ # find-mmc-bypartlabel userdata
/dev/sda79
/ # lvm lvdisplay
  --- Logical volume ---
  LV Path                /dev/sailfish/root
  LV Name                root
  VG Name                sailfish
  LV UUID                g0qeAk-LUcR-FK9C-3N0o-9K0n-sC6R-OoJZmp
  LV Write Access        read/write
  LV Creation host, time SailfishSDK, 2022-05-11 11:44:48 +0000
  LV Status              available
  # open                 1
  LV Size                4.88 GiB
  Current LE             1250
  Segments               2
  Allocation             inherit
  Read ahead sectors     auto
  - currently set to     1024
  Block device           253:0
   
  --- Logical volume ---
  LV Path                /dev/sailfish/home
  LV Name                home
  VG Name                sailfish
  LV UUID                vOtW2k-pesk-cP7b-NBPP-N0Fc-eX06-andjvc
  LV Write Access        read/write
  LV Creation host, time SailfishSDK, 2022-05-11 11:44:48 +0000
  LV Status              available
  # open                 0
  LV Size                <99.53 GiB
  Current LE             25479
  Segments               2
  Allocation             inherit
  Read ahead sectors     auto
  - currently set to     1024
  Block device           253:1
/ # ls -l /rootfs
drwxr-xr-x    2 root     root          4096 Apr 25  2022 apex
drwxr-xr-x    2 root     root          4096 Oct 23  2021 config
drwxr-xr-x   10 root     root          7660 Jan 31 04:01 dev
drwxr-xr-x    2 root     root          4096 May 11  2022 home
drwxr-xr-x    3 root     root          4096 Oct 23  2021 linkerconfig
drwx------    2 root     root          4096 Jan 28 10:55 lost+found
drwxr-xr-x    2 root     root          4096 Oct 23  2021 metadata
drwxr-xr-x    3 root     root          4096 Jul 12  2022 mnt
drwxr-xr-x    2 root     root          4096 Oct 23  2021 odm
dr-xr-xr-x  477 root     root             0 Jan  1  1970 proc
drwxr-xr-x   15 root     root          4096 Dec  7 07:52 run
drwxr-xr-x    2 root     root          4096 May 11  2022 sys
drwxrwxrwt    2 root     root          4096 May 21  2022 tmp
drwxr-xr-x    4 root     root          4096 Jul 12  2022 var
drwxr-xr-x    5 root     root          4096 Jul 12  2022 vendor
/ # ls -l /rootfs/var/
drwxr-xr-x    3 root     root          4096 Jul 12  2022 cache
drwxrwxrwt    2 root     root          4096 Jul 12  2022 tmp

How were you reinstalling the MyBackup app? By removing/adding it, to newer version?

Try to mount your home without encryption:

mount /dev/sailfish/home /rootfs/home

Also this is interesting:

df -h /rootfs
ls -l /var/cache /var/tmp

I had Books (I rarely close that one), Storeman, and Chum GUI open; I was looking for apps that were on both sides, to see if I could delete any repositories from Storeman. I saw that MyBackup was still Storeman’s version (if you use Chum, you have surely seen that apps installed through it have a version name that’s longer than Storeman’s, with a .jolla-something ending). I don’t remember if I clicked on the icon then, or if I pulled the menu in Storeman, to uninstall. Then I did something (as swiping from side, or from top, or similar) which I don’t remember precisely, and I found myself with a frozen screen with the top menu half way down (but without the icons, IIRC) a loop circle, and a wrong clock (that, I remember because for some reason I checked the time, and from 18:xx that was the actual time, clock was displaying 16:yy).

By the way:

/ # mount /dev/sailfish/home /rootfs/home/
/ # ls /rootfs/home/
lost+found
/ # df -h /rootfs/
Filesystem                Size      Used Available Use% Mounted on
/dev/sailfish/root        4.7G      6.0M      4.7G   0% /rootfs
/ # ls -l /var/cache/
/ # 
/ # ls -l /var/
drwxr-xr-x    2 root     root            40 Apr 25  2022 cache
drwxr-xr-x    2 root     root            40 Apr 25  2022 log
drwxr-xr-x    2 root     root           100 Feb  1 03:36 run
-rw-r--r--    1 root     root            44 Feb  1 03:36 udhcpd.leases

Had you received an ‘OS update is available’ message before this?

Sounds like it could have been caused by the ‘os update check sets ssu re’ issue.

Nope, no message about OS updates.

I’ve investigated MyBackup uninstall scriptlet and sadly it did the damage by removing everything on your device. @slava is the author and I hope they could find the easiest way to solve this in the app:
This line of code on busybox shell evaluates to:
rm -fr /
for every user on the system that does not have actual home dir (smoke test: u=nobody; eval echo ~$u/some/path)
On GNU Bash it evaluates as author intended, but Sailfish doesn’t use GNU Bash, it uses busybox…
rm -fr //.local/share/openrepos-mybackup

The fact that you were able to mount your sailfish/home, means that you hopefully disabled user data encryption when you first installed Sailfish OS.
To try and undelete your files, you could cross-compile this and deploy it into your recovery via sd card: http://extundelete.sourceforge.net/

2 Likes

Ouch :open_mouth:

When I wrote that scriptlet Sailfish OS was still using bash and of course I tested it and it worked. Replacing bash with busybox is such a great way to randomly break things.

Thanks for the tip. I’m not using the latest Sailifish OS on my daily phone and would never notice that myself.

I’ll find a syntax that would work both busybox and bash. Until then, don’t uninstall MyBackup🙂

Upgrade is going to be safe, that script only runs on uninstall.

UPD. Actually, my daily phone where I tested it, already has bash replaced with busybox (albeit an older version) and that uninstall script works there just fine. Looks like we’ve stumbled upon a recently introduced feature (probably a bug) in busybox

MyBackup version 1.0.6 should fix the rm -fr / problem. Update is safe, it doesn’t run the uninstall script.

Well, I have no words @seaMeeGo to thank you for all you went through trying to help.

As a matter of a fact I did a fresh reinstall just in the morning before your message (couldn’t keep the phone lying there anymore); in fact I came back here because, while reinstalling all the apps, I saw slava’s comment in the app description and thought about letting you know. Now I understand it was because of your intervention.

“Luckily”, I did actually encrypt my phone (I am very sure about it), so I think there was no way to recover things.

BTW, @slava, since we are here please allow myself to ask you if you think it would be possible to have something like an incremental backup but only saving files from a given point (previous backup, or date) onwards. That is: I do a given backup on day 1, then when I do a new backup on day X only the new files get copied even if I removed the old files from the destination.

No, that won’t fit into Sailfish OS backup architecture.

First, when the backup unit gets invoked, it’s not told what was in the previous backup or whether it exists at all. It’s simply not part of the interface.

If that’s not enough, backup only keeps the last two tarballs and automatically removes the older ones, assuming that those are all full backups. There’s nothing a backup unit can do about that.

Is there a known way to back up email database?
I like having a copy of emails on the phone ( downloaded as POP3).
Currently emails are not included in the backed up content ( or that’s not working if it makes a difference :slight_smile: ) .

Add ~/.qmf directory to MyBackup.