Tuesday 17 February 2015

[step-by-step guide] Jolla phone unresponsive or laggy

Step-by-step guide: Jolla phone file system, full cleanup

If you're experiencing slow response times, lags and app crashes, or get errors like "Cannot write to file" or "Couldn't install update", these steps will probably help you.

I've followed them all through myself, but I can only confirm them safe on my Jolla. As always, doing stuff as root is in your own responsibility. Be careful!

UPDATE: Part of the process is automated since Sailfish OS

Full cleanup for Jolla's file system

Share and Shout! Your friends might read it.

UPDATE: From Sailfish OS onward, step 6 of the cleaning process described below is automated and scheduled to run on Tuesday 3:00 AM (your local time). To run, it's required that your phone is connected to charger for over that night. You can still enter the step 6 command manually as described below, or just wait until next Tuesday for it to take place. Any other parts of this full cleaning process must still be done manually.

DisclaimerWarning: This process has not been verified/endorsed by Jolla. Steps provided here go very deep into the file system of Jolla phone, including access to factory image snapshots. Follow these steps carefully, and do it on your own responsibility. If you break something, it's yours to fix. Double check every letter before pressing [enter] as a root user. Triple check that you don't delete any other factory images than the ones clearly highlighted below.

  • Settings > System > Developer Mode > Enable developer mode
  • Enable SSH connection and enter your root password 
  • (write your password down!
  • Check your device IP for SSH if using that, either via USB or WLAN. You can also use the terminal in the phone, but you still need the password
  • Close the settings
  • Launch terminal app, now visible in your launcher screen, or connect to your phone via SSH session from your computer
  • Follow the next yellow commands carefully - check every letter before pressing [enter]
Starting via SSH session from computer (xxx for your network IP's):

Start your SSH client (I'm using Putty), and connect to your device IP using port setting 22

login as: nemo
nemo@XXX.XXX.X.XX's password: (invisible writing, your password)
Last login: Tue Feb 17 17:32:27 2015 from xxx.xxx.xxx.xxx
| SailfishOS x.x.x.x (Name) (armvXxx)
[nemo@Jolla ~]$

Starting via Terminal app / going on with SSH session:

[nemo@Jolla ~]$ devel-su
Password: (invisible writing, your password)
[root@Jolla nemo]#

1. CHECKING the file system as a root user:

[root@Jolla nemo]# btrfs fi show
ERROR: unable get label Inappropriate ioctl for device
Label: 'sailfish'  uuid: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
        Total devices 1 FS bytes used 9.32GiB
        devid    1 size 13.75GiB used 13.63GiB path /dev/mmcblk0p28

Btrfs v0.20-rc1

2. If you see big numbers like I did, it's time for some cleaning:

You can leave the terminal app / SSH connection running while following these steps
  • First, go through your Photos, Documents, Downloads, Transfers, Videos and Music. Move them elsewhere (SD card, computer...) or delete
  • Maybe also delete some apps you don't actually need?
  • Install "Sailfish OS Utilities" from Jolla Store and run the new cleanup options, now visible in your Settings > System > Utilities
Now go back to step 1, and check if the number above for "Total devices" is smaller. If it's below 8Gb, you can jump to step 5.
  • Last, and only if the above wasn't enough, you can mount subvolume to have access to the factory image files. Please take backups of your important files before going further! If in doubt, please jump to step 5

    Checking the space they take: 
[root@Jolla nemo]# mount -o subvolid=0 /dev/mmcblk0p28 /mnt/
[root@Jolla nemo]# du -sh /mnt/*
2.8G    /mnt/@
907M    /mnt/@home
0       /mnt/@swap
833M    /mnt/factory-@
70M     /mnt/factory-@home
1.6G    /mnt/rec-20140303_124453_@
3.6G    /mnt/rec-20140303_124453_@home
[root@Jolla nemo]#

3. IMPORTANT: Only files starting with "rec-" may be deleted here!

So, let's delete the two unnecessary (and huge) rec-files. These two are snapshots of factory images, left behind after a factory reset or any other recovery actions

[root@Jolla nemo]# btrfs subvolume delete /mnt/rec*
Transaction commit: none (default)
Delete subvolume '/mnt/rec-20140303_124453_@'
Delete subvolume '/mnt/rec-20140303_124453_@home'
[root@Jolla nemo]#

4. Ok, you deleted, or you didn't find any rec-files, in both cases:

[root@Jolla nemo]# umount /dev/mmcblk0p28
[root@Jolla nemo]#

To get even more free space, you should go through your home directory and search for any big tmp or log files, which are safe to remove. For searching you can use suitable apps provided in Jolla Store, or find -command in terminal (search for Linux find command manual in the web)

5. Checking again

now there's less used space,but memory allocation is still very close to full:

[root@Jolla nemo]# btrfs fi show
ERROR: unable get label Inappropriate ioctl for device
Label: 'sailfish'  uuid: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
        Total devices 1 FS bytes used 4.65GiB
        devid    1 size 13.75GiB used 13.63GiB path /dev/mmcblk0p28

Btrfs v0.20-rc1
[root@Jolla nemo]#

6. Balancing 

Now we have enough of free space (less than 8GB used recommended) to start to balance the btrfs file system, freeing up space in the memory allocation (red "devid" above).

This might take long, even several hours depending mostly on how much space is used, but normally it's ready in less than an hour. Keep your phone powered up with USB charger while running the next command

[root@Jolla nemo]# btrfs balance start /

Prepare for 15 min to several hours run time, depending on how messy your file system is, and the size of used space. Note that you don't get any output during the process, and the only noticeable thing is very laggy user interface while it's running. But just let it run, and avoid using the phone (it's safe to answer phone calls, but answering to them might take a while). The output after the process:

Done, had to relocate XX out of XX chunks
[root@Jolla nemo]#

7. Checking again

now both the space used on files, and the memory allocation space are fine:

[root@Jolla nemo]# btrfs fi show
ERROR: unable get label Inappropriate ioctl for device
Label: 'sailfish'  uuid: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
        Total devices 1 FS bytes used 4.64GiB
        devid    1 size 13.75GiB used 6.81GiB path /dev/mmcblk0p28

Btrfs v0.20-rc1

8. Some extra checking (not necessary)

[root@Jolla nemo]# btrfs fi df /
Data, single: total=6.00GiB, used=4.47GiB
System, DUP: total=64.00MiB, used=4.00KiB
System, single: total=4.00MiB, used=0.00
Metadata, DUP: total=350.00MiB, used=181.06MiB
[root@Jolla nemo]#

9. Ready! You can close the terminal / SSH connection, or write exit two times (first one to exit root mode, second one to close the session)

Your Jolla should run smoother now. Reboot and enjoy a cleaner phone.

Share and Shout! Your friends might read it.

Photo credits: inf3ktion / cc-by-2.0
Published: 2015-02-17 21:26 UTC
Updated: 2015-05-22 16:27 UTC

1 comment:

  1. According to the man pages for "btrfs" the command "balance start" can be verbose as well.
    btrfs balance start -v /
    Just for the impatient ones.