The picture illustrates a portable telephone, make "Jolla", model White 16GB EU, pictured from front (thus all black), with boot splash screen having white Jolla logo on black background

Jolla White 16GB EU -Model: JP-1301 -Sailfish 1.0.2.5 [ Maadajävri (with spelling mistake) (see comment)]

Half-bricked with some life in it, not a complete brick (I don’t know how to re-flash yet, sorry). Due to some good and an excellent reason (aren’t they all) you made just a slight mistake working as devel-su before rebooting you know that you are in trouble when you see the Cyclops‘ eye staring at you.

Nothing is lost, except plenty of time. You need a computer which can detect RNDIS USB devices as networked hosts (and not serial line, nor a file system). Well, my laptop with Ubuntu 12.04 LTS works out of the box for that, like about any other Linux distribution.

While the non-booting Sailfish OS problem may be trivial and would be fixed in minutes if there would be just a console for a single user session, there is none here, so probably the fastest method is to use Jolla’s Recovery Boot, albeit it is not user friendly yet. But at least it contains the right ingredients for the future versions of Sailfish OS on it, taking a snapshot of the system and home file systems !

Take off the battery and put it back to get rid off the badly booting installation (soon gone forever).

  1. Push and hold the volume down button
  2. Push and hold for a while the power button until the phone vibrates, release all buttons
he picture illustrates a portable telephone, make "Jolla", model White 16GB EU, pictured from front (thus all black), with boot splash screen having white Jolla logo on black background, connected with a white USB cable into a black portable computer, located on the right hand side.

Boot in recovery mode, then connect the USB cable.

This is a screenshot from an Ubuntu 12.04.3 LTS for the new wired connection IPV4 settings when Jolla phone is connected after a Recovery Boot

Settings on Ubuntu (click to read more about this platform)

Same Cyclops’ eye is looking at you, O.K. But hey, it is not exactly the same, you have just booted Jolla in Recovery Mode. Now, only thing missing is a nice application which would give you some options, but it is certainly coming… Meanwhile, you need to connect the phone to the computer with a USB cable, create a private network connection and then make a telnet connection (yes, it still exists) on 192.168.2.15 which the recovery installation OS is listening.

Once you have connected the USB cable to the waiting device, a new Ethernet device will appear. By default it is waiting for DHCP, configure it manually as 192.168.2.14.

root@clevo:~# telnet 192.168.2.15
----------------------------- Jolla Recovery v0.1 -----------------------------
Welcome to the recovery tool!
The available options are:
1) Reset phone to factory settings
2) Reboot phone
3) Exit
Type the number of the desired action and press [ENTER]:
...
[DONE] DEVICE RECOVERED!
...

That’s it. You can stop reading and start using your phone from point zero again. But if you are interested to understand why half of your phone’s memory is now used in a fresh, empty installation, how to get that memory back and how to, perhaps even to recover some of your data and settings, continue reading.

Recovery boot’s RNDIS USB device does not show up?

With dmesg(1) I saw this:

[19533.731908] usb 3-1: new high-speed USB device number 13 using xhci_hcd
[19533.749051] usb 3-1: New USB device found, idVendor=18d1, idProduct=d001
[19533.749059] usb 3-1: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[19533.749062] usb 3-1: Product: Recovery
[19533.749066] usb 3-1: Manufacturer: Jolla
[19533.749068] usb 3-1: SerialNumber: DU3C600365
[19533.751197] rndis_host 3-1:1.0 eth0: register 'rndis_host' at usb-0000:00:14.0-1,
   RNDIS device, 00:01:02:03:04:05[19533.751913] scsi8 : usb-storage 3-1:1.2
[19534.750933] scsi 8:0:0:0: Direct-Access     Linux    File-CD Gadget   0000 PQ: 0 ANSI: 2
[19534.752474] sd 8:0:0:0: Attached scsi generic sg2 type 0
[19534.753439] sd 8:0:0:0: [sdc] Attached SCSI removable disk...

Working with snapshots after recovery

2014-11-30: * Warning * the below behavior was observed on recovery software v0.1
Later versions may and will work differently and the below will not apply.
You may find more information on some helpful comments I have received for this post.

Nice, your phone is back up again, and you can ssh(1) to it again, as nemo (reminder: the Ethernet interface over USB is not the same than that of the Recovery boot – anyway, for this type of job it is totally O.K. to connect over Wi-Fi).

Theory: Jolla (Sailfish OS) takes advantage of clever btrfs file system, which allows, not only subvolumes to be created on the fly, but also it can take snapshots of those. This feature is used in Ubuntu for a quite a while now, let’s assume that it is stable enough. It is possible to roll back a file system from a snapshot. In our case, both the rootfs and home file systems are mounted, so it is going to be somewhat difficult. But we can mount those snapshots and recover information from them. However, I suggest not to delete or modify those mounted file systems, though; it can be quite confusing on this Copy-on-Write file system. What do I know, but I will explain below how to mount those snapshots to recover files from them and then how to delete them (that’s the tricky part).

As devel-su root, let’s look what we have got, where the memory is spent and how to access those files you may want to recover by copying.

[root@jolla mnt]# btrfs subvolume list /
 ID 259 gen 10181 top level 5 path @swap
 ID 264 gen 10504 top level 5 path factory-@
 ID 265 gen 10506 top level 5 path factory-@home
 ID 273 gen 10512 top level 5 path rec-20140104_181447_@
 ID 274 gen 9766  top level 5 path rec-20140104_181447_@home
 ID 288 gen 10516 top level 5 path @
 ID 289 gen 10481 top level 5 path @home
[root@jolla mnt]# cd /mnt; mkdir tmp
[root@jolla mnt]# mount -t btrfs -o subvol=rec-20140104_181447_@ /dev/mmcblk0p28 /mnt/tmp
[root@jolla mnt]# du -h /mnt/tmp --max-depth=5
...
1.6G    /mnt/tmp/data/sdcard/Android/data/com.spotify.mobile.android.ui
1.9G    /mnt/tmp/data
...
2.9G    /mnt/tmp

Interesting, it is my Spotify music, stored by the Android application which was saved by the snapshot. Probably I do not want to recover that but some configuration files from /etc

Below, I copy my own music from that other, @home snapshot which I have mounted on thesame mount point /mnt/tmp.

[root@jolla Music]# pwd
/mnt/tmp/nemo/Music
[root@jolla Music]# ls -al
total 0 drwxrwxr-x 1 nemo graphics 1814 2013-12-29 00:14 .
drwxr-x--- 1 nemo graphics  592 2014-01-04 12:26 ..
drwxrwxr-x 1 nemo graphics   16 2012-12-15 15:50 22-Pistepirkko
drwxrwxr-x 1 nemo graphics   38 2012-12-15 15:50 Adele
drwxrwxr-x 1 nemo graphics   66 2012-12-15 15:50 Alice Cooper
drwxrwxr-x 1 nemo graphics   40 2012-12-15 15:50 Apocalyptica
...
[root@jolla mnt]# du -sh tmp
4.5G    tmp

Deleting the snapshots to free the space

This is a bit tricky, I must admit. Not much information is readily available so I spent countless hours to figure this out and this is why I want to share it with you.

You need to mount the volume in another place than its original mounting point if you just want to delete snapshots in it, not to roll them back. The trick is to mount the volume so that you can see all snapshot subvolumes in that mount point.

[root@jolla mnt]# mount -o defaults,subvol=/ /dev/mmcblk0p28 /mnt/tmp
[root@jolla mnt]# ls tmp
@  factory-@  factory-@home  @home 
rec-20140104_181447_@ rec-20140104_181447_@home  @swap
[root@jolla mnt]# df
 Filesystem           1K-blocks      Used Available Use% Mounted on
 rootfs                14415852   8890692   4998076  65% /
 /dev/mmcblk0p28       14415852   8890692   4998076  65% /
 devtmpfs                415332        64    415268   1% /dev
 tmpfs                   415852        72    415780   1% /dev/shm
 tmpfs                   415852      1928    413924   1% /run
 tmpfs                   415852         0    415852   0% /sys/fs/cgroup
 /dev/mmcblk0p25           8100      4296      3804  54% /persist
 /dev/mmcblk0p28       14415852   8890692   4998076  65% /swap
 /dev/mmcblk0p28       14415852   8890692   4998076  65% /home
 /dev/mmcblk0p19           8100      4188      3912  52% /drm
 /dev/mmcblk0p9           48420      5492     42928  12% /var/systemlog
 /dev/mmcblk0p18          65488     45408     20080  70% /firmware
 tmpfs                   415852         0    415852   0% /mnt/asec
 tmpfs                   415852         0    415852   0% /mnt/obb
 /dev/mmcblk0p28       14415852   8890692   4998076  65% /mnt/tmp
 [root@jolla mnt]# btrfs subvolume delete /mnt/tmp/rec-20140104_181447_@
 Delete subvolume '/mnt/tmp/rec-20140104_181447_@'

Same thing for the home file system snapshot, let' s check after that, the situation (note that the df(1) shows that no room has been restored until you unmount the device, now mounted twice for the above operations, so don't panic).

[root@jolla mnt]# ls tmp
@  factory-@  factory-@home  @home  @swap
[root@jolla mnt]# umount /mnt/tmp
[root@jolla mnt]# df
Filesystem           1K-blocks      Used Available Use% Mounted on
rootfs                14415852   4207440   9658520  31% /
/dev/mmcblk0p28       14415852   4207440   9658520  31% /
devtmpfs                415332        64    415268   1% /dev
tmpfs                   415852        72    415780   1% /dev/shm
tmpfs                   415852      1928    413924   1% /run
tmpfs                   415852         0    415852   0% /sys/fs/cgroup
/dev/mmcblk0p25           8100      4296      3804  54% /persist
/dev/mmcblk0p28       14415852   4207440   9658520  31% /swap
/dev/mmcblk0p28       14415852   4207440   9658520  31% /home
/dev/mmcblk0p19           8100      4188      3912  52% /drm
/dev/mmcblk0p9           48420      5492     42928  12% /var/systemlog
/dev/mmcblk0p18          65488     45408     20080  70% /firmware
tmpfs                   415852         0    415852   0% /mnt/asec
tmpfs                   415852         0    415852   0% /mnt/obb

Yippee !

[root@jolla mnt]# init 6

Suspense… Success !

Thank you if you followed down here.

Advertisements