main index Big Fat Warning: this page is only meant as a self-reminder. Almost everything comes from Jolla forums and talk.maemo forums, where you can find original authors and some extra help.

Fun Fact: except for directory names (Pictures, Music and so on), below you may change "Jolla" and "nemo" to whatever your Linux device requires, and see that everything will work just fine.

This page is only my personal reminder of what I would do if I buy another Jolla phone, mainly:

1. I need quickfastsecure access to/from Jolla filesystem (that is: an ssh channel for login and rsync);

2. I need a root prompt to fiddle with (you don't own a device if you can't root it);

3. I need it sharing its internet connection, both in tethered and wifi access point modes; (I may even consider Bluetooth PAN if I find out that it saves battery life)

4. I need my own script started after boot (aka the "rc.local" thing... in Ruby language);

5. I want my name and alternate phone number displayed during power up and shutdown.

6. I need to use the SMS-sending feature of the Jolla phone using a command-line tool from my Linux desktop.

7. Compile latest Ruby directly on Jolla phone.



First of all, secure ssh access

I do not like the default MTP (media transfer protocol via USB) on Jolla: I think that an ssh channel is way too useful.

Enter System Settings menu, configure a wifi connection and everything, then update to latest firmware, and finally enable developer mode to allow remote connection via ssh (set up a password on Jolla for ssh access and devel-su mode) and select a safe fixed wlan IP address on the home wifi network - in my case I chose 192.168.0.31 and updated the /etc/hosts on my desktop Linux box adding this line:
192.168.0.31  jolla

This allows me to start an ssh session from my desktop Linux using: alias ssj='ssh nemo@jolla'
ssj

And even starting programs from my Linux desktop: alias ssb='ssh nemo@jolla sailfish-browser'
ssb particolarmente-urgentissimo.blogspot.com

Note that the first time it will require to confirm the RSA fingerprint (just answer yes) and that thet login may be slooooow! (from ssh command to Password: prompt, I had to wait two to three entire minutes - mostly depending on wifi power-saving).

Enabling passwordless login: execute ssh-keygen command on the Jolla (at the nemo@Jolla prompt, not in devel-su mode), and do not select a password when ssh-keygen asks for one. This will populate the ~/.ssh directory. Enter it and create the authorized_keys file with the contents of the id_rsa.pub of your trusted Linux desktop machine(s) that will need to access, then change the mode to "owner only read/write". Summary:
ssh-keygen
vi .ssh/authorized_keys
chmod 600 .ssh/authorized_keys

Now the above commands ssj and ssb will get to Sailfish OS without asking for a password. You may then invoke devel-su to get root access and shout "jailbroken!" to impress your iBanana iFriends.

Let's go for some useful stuff: on my Ubuntu Desktop I execute:
scp -p nemo@jolla:Pictures/Camera/201410* /tmp
(that is: secure copy "-preserving timestamps" the camera pictures of "2014 October" onto local /tmp directory of my Linux system).

And yes, rsync is better (synchronizes only if the remote file is older/different; good for directories and backups; lots of command-line options like --delete-after and so on):
rsync -ave ssh Allegri\ -\ Miserere nemo@jolla:Music/


Sending SMS

Just invoke dbus-send. From my Ubuntu box it works even if I use accented/special characters. Don't forget to 'quote':
ssj 'dbus-send --system --print-reply --dest=org.ofono /ril_0 org.ofono.MessageManager.SendMessage string:"+39000111222" string:"marémma carrettèra"'

If successful, it will return an "object path" instead of an error.

To store the text of an SMS in the internal database (with the -in or -out flag), just invoke the commhistory-tool with the appropriate group number (and -again!- watch out for quotes and double-quotes):
ssh nemo@jolla "commhistory-tool add -group 7 -text 'marémma carrettèra' -out -sms '' '+39000111222'"

Note: using privileged privileges (wow!), you can extract the mobile phonenumber associated to a contact name or surname:
type=MOBILE
contact=Pinocchio
phonenumber=`sqlite3 /home/nemo/.local/share/system/privileged/Contacts/qtcontacts-sqlite/contacts.db "select phoneNumber from phonenumbers where contactId in (select ContactId from contacts where upper(firstname)='$contact' or upper(lastname)='$contact') and upper(subTypes)='$type' group by phoneNumber"`


SIM check

At the Jolla prompt, just ask:
devel-su journalctl -b | grep SIM

If you get a No SIM card present message then, well, either you forgot to install the microSIM card... or your telco requires a "recent" microSIM. I had to pay 10 bucks to H3G to change my miniSIM to a microSIM (I had correctly cut the miniSIM but their host was programmed to reject registration of a "born as miniSIM" on an IMEI "natively microSIM"...).

Using ssh from a desktop Linux machine to save the entire journal on the local machine and then check for SIM: just enter:
ssh nemo@jolla devel-su journalctl -b > /tmp/localfile.txt
Password: [...watch out! visible!]
grep SIM /tmp/localfile.txt

Sometimes I get errors related to SIM dialling numbers, but since 2001 I stopped using the SIM for storing anything:
ott 23 07:58:40 Jolla ofonod[795]: Unable to read mailbox dialling numbers from SIM


Daily safe backup

I use rsync for automated backups. In my Linux NAS I added this cron script:
rsync --quiet --delete -ave ssh --exclude=.config/signond --exclude=.local/share/system/privileged --exclude=.cache/msyncd nemo@jolla:/home/user /home/
(note that the "excluded" paths are the sign-on, syncml and social databases).

Some extra suggestions (incremental/per-day/timemachine backup using rsync) are here and here.


Unneeded files

Sorry, Jolla People, I do not need your images...
rm /home/nemo/Pictures/Jolla/*
rm /home/nemo/Videos/Jolla/*


AUTOEXEC.BAT

Yes, Sailfish OS sports systemd - no rc.local is available. First, enter devel-su and create your executable script /home/nemo/rc.local and verify that it works. Then create the systemd service description in the /etc/systemd/system/myrclocal.service textfile, containing:
[Unit]
Description=The almighty rc.local
ConditionFileExists=/home/nemo/rc.local

[Service]
Type=oneshot
RemainAfterExit=yes
ExecStart=/home/nemo/rc.local

[Install]
WantedBy=basic.target

Then enable it using:
systemctl enable myrclocal.service

It will be executed on every boot once reached the basic target of the systemd hierarchy (about 11-12 seconds after Linux kernel start).

A little advice: be careful on what you set up... because rc.local will be running as root, enabling you to make a huge mess.

You may want to start your script before/after other targets:
- graphical.target (graphic display is active)
- local-fs.target (local filesystems are mounted)
- network.target (networking support is ready)

Note that basic.target has already everything in place (including the ramdisk-mounted /tmp directory, the ofono phone structure and networking enabled).


Tethering

The Tethering app does the dirty work. No need to tinker.


Personalizing charging/shutdown screens

If you don't know how to fiddle with them, then you don't deserve this feature. ;)

The directory /usr/share/themes/jolla-ambient/meegotouch/icons/ contains theme images and icons. Relevant images are these 540×960 PNG files (self-describing names, despite that obsolete "854" naming):
- graphic-bootloader-usb-wakeup.png (down)
- graphic-charging-done.png (up)
- graphic-charging-error.png (up)
- graphic-charging.png (up)
- graphic-charging-unplugged.png (up)
- graphic-shutdown-480x854.png (up and down)

I merged in my 540×308 logo in the available space (up or down).

The boot image is probably in the Linux kernel and requires more work.

Note that everything is reset if the device is reset to its factory settings or if you apply a Sailfish OS version upgrade.


Manually installing packages from Sailfish OS repositories

Command-line package manager is pkcon. Some examples:
pkcon repo-list
devel-su pkcon install ruby
pkcon search name - | grep Available

Lots of stuff out there (Ruby, Cups, gcc/g++, xz, llvm...), but they only make sense for tinkerers. I only needed Ruby, my preferred programming language, and mce tools.

After installing mce-tools I found I was fine with all energy-saving options:
devel-su pkcon install mce-tools
mcetool

Some experimenting: to disable cellular radio (voice/data) leaving wifi active (this is different from "flight mode" where every radio device is disabled) you may try:
mcetool --disable-radio=cellular
mcetool --enable-radio=cellular
(warning: it seems that connman won't like it too much...)


Compiling Ruby... directly on the Jolla phone

Fetch the latest Ruby source from Ruby website and go! (note the make -j2 command: double speed because processor is dual core and Jolla has 1Gb RAM).
tar xpzvf ruby-2.*
cd ruby-2.*
devel-su pkcon install gcc binutils make autoconf
devel-su pkcon install libffi-devel gdbm-devel openssl-devel readline-devel zlib-devel
./configure --disable-install-doc
make -j2
devel-su pkcon remove libffi-devel gdbm-devel openssl-devel readline-devel zlib-devel
./ruby --version
devel-su make install

By default (Sailfish 1.1 with gcc 4.6.4 and -currently- Ruby 2.1.5) it will configure with everything in /usr/local, fpu=vfpv3-d16, arch=armv7-a, posix-threads, using "-O3" and "-Wall" (there may be a few unharmful warnings while compiling). Compilation requires some 20 minutes (if Jolla goes in stand-by, compilation will be way slooooower!).

Don't cry about tcl/tk stuff (X11-related) and -er- win32 missing support. I chose --disable-install-doc to save some space. Note that the only missing library is fiddle (thus fiddle-devel is not present). Note that the -devel libraries are only needed to compile.

I also compiled Ruby 2.2 with jemalloc 3.6 library support. As I installed jemalloc in /usr/local directory, I needed to add LD_LIBRARY_PATH before ./configure and make.

Command-line GPS stuff

GPS position can be sniffed on the DBus bus if there is some other GPS application running (the default Maps one, which uses its Android cluttered libraries and daemons). When the display goes in energy-saving mode, the GPS runs for another minute before entering its standby-mode (no more positions).

Also, the /dev/nmea says "no device". There are no GPS serial ports because the baseband stuff does everything (more info here).

In C++ you need to resort to Qt 5.2 Positioning feature. Other suggestions (and a pure QML example) are on a Sailfish OS dev blog.

Python install (plus dbus and gobject and dependencies; note that currently gobject is not yet available for Python 3.x on Sailfish):
devel-su pkcon install dbus-python pygobject2

Python script for the DBus receiver (does not need special privileges):
#!/usr/bin/env python

import dbus, gi.repository.GObject as gobject
import dbus.mainloop.glib as glib

glib.DBusGMainLoop(set_as_default=True) 
bus = dbus.SessionBus()
lastime = 0

def gpsprint(fields, timestamp, lat, lon, alt, acc):
    global lastime
    if timestamp > lastime:
        lastime = timestamp
        print("t=%d lat=%f lon=%f alt=%f accuracy=%f" % (timestamp, lat, lon, alt, acc[1]))

bus.add_signal_receiver(gpsprint, "PositionChanged", "org.freedesktop.Geoclue.Position")
loop = gobject.MainLoop()
loop.run()

Example output:
t=1413566361 lat=41.613205 lon=13.928593 alt=838.000000 accuracy=4.000000
t=1413566362 lat=41.613211 lon=13.928593 alt=838.000000 accuracy=4.000000
t=1413566363 lat=41.613211 lon=13.928593 alt=839.000000 accuracy=4.000000

Er... I actually did it. I'm releasing a native Sailfish OS app GPStuff capable of logging GPS data even in background and without requiring DBus.

Notifications

Simple script to generate "notification" events (takes titlestring and argumentstring as command-line parameters), using the nice harbour-tidings icon:
#!/usr/bin/python

import dbus, sys
bus = dbus.SessionBus()
object = bus.get_object('org.freedesktop.Notifications','/org/freedesktop/Notifications')
interface = dbus.Interface(object,'org.freedesktop.Notifications')
interface.Notify(sys.argv[0], 0, "/usr/share/icons/hicolor/86x86/apps/harbour-tidings.png",
                 sys.argv[1], sys.argv[2], dbus.Array(), dbus.Array(), 0)


Monitoring events

All Sailfish events can be monitored on DBus. Example: this script waits until I answer an incoming phone call and then executes another shellscript:
dbus-monitor "type=signal, interface=org.freedesktop.Telepathy.Channel.Interface.Group, member=MembersChangedDetailed" |  
while read -r line; 
do
  if echo $line | grep "string \"Call answered\""; then
    /home/nemo/executemypersonalscript.sh
  fi
done


Tinkering with Sailfish SDK virtual machines

Sailfish SDK uses two virtual machines: a mer sdk one, which contains the toolchains for "i486" and "arm" targets, and a Sailfish OS emulator one, based on a minimum setup of Linux 2.6 and Sailfish libraries, running in i486 mode.

Once booted and running, they are available via ssh on ports 2222 and 2223:
ssh -p 2222 -i ~/SailfishOS/vmshare/ssh/private_keys/engine/mersdk mersdk@localhost
ssh -p 2223 -i ~/SailfishOS/vmshare/ssh/private_keys/SailfishOS_Emulator/nemo nemo@localhost

Note that you can even install software in them; for example, in the Sailfish OS (the one on port 2223):
sudo pkcon install glibc-debuginfo
valgrind --log-file=log.txt --leak-check=full mybuggyapp
less log.txt


Other stuff

The CSD diagnostic utility can only be started from command-line: csd (note that it runs in graphical mode only). The funniest test is the "battery resistance" test.

The repositories can be listed using ssu repos command.

To read the unique identifier of The Other Half (TOH) and its status (installed/ready), without using qdbus, use gdbus:
gdbus call --system --dest com.jolla.tohd --object-path /com/jolla/tohd --method org.freedesktop.DBus.Properties.GetAll com.jolla.tohd

Reply will be something like:
({'TOHID': <'04afadf2ebfb9f'>, 'Docked': <1>, 'Ready': <1>},)

In an ssh session you can start stuff even if the Jolla screen is blanked and/or the apps were already started:
sailfish-browser www.e656.net
jolla-notes
harbour-flashlight

Except a few ones, applications do not (yet) manage command-line parameters.

The qdbus thing is simpler than common dbus interface: I installed it using:
devel-su pkcon install qt5-qttools-qdbus

Emergency Jolla reinitialization: The firmware image is available on torrents (currently it is not redistributable because it contains a few bits of proprietary software).

Blocking adstraffic (note: does not work in Android apps): either using a 15000+ lines hosts or using Fool DNS service:
iptables -t nat -A OUTPUT -p udp --dport 53 -j DNAT --to-destination 87.118.110.215
iptables -t nat -A OUTPUT -p tcp --dport 53 -j DNAT --to-destination 87.118.110.215

The microSD slot is recognized as /dev/mmcblk1 and mounted on /media/sdcard using its hex unique id (not the given "label").

I happen to love ext4-formatted microSD cards. I inserted a brand new 8Gb microSDHC and formatted it allowing a maximum of about 9000 files (note that "8Gb" means some 7.6 millions kb, of which only about 7.48 are available to the user):
umount /media/sdcard/*
mkfs.ext4 -N 9000 -m0 -L my_MP3_files /dev/mmcblk1p1 sync sleep 15 reboot

Camera shutter audio files: /usr/share/sounds/jolla-ambient/stereo/camera_shutter.wav and /usr/share/sounds/freedesktop/stereo/camera-shutter.oga (OGG audio).

Root ssh access to Sailfish OS Emulator (the vbox running in the SDK): just edit ~/SailfishOS/emulator/1/ssh/root/authorized_keys and add your id_rsa.pub key. Then ssh -p 2223 root@localhost and enjoy: pkcon install qt5-qtpositioning-devel


Jolla btrfs disk space "full"?

In some cases (when you have some free disk space but cannot create/modify files), the balanced-tree-filesystem (btrfs) requires a "balancing" (somewhat like a "defrag").

"Balancing" will be likely activated in background if you delete some large files (a few gigabytes).

Manual balancing: first, check with devel-su btrfs fi show
If "used" space is equal (or almost equal) to "total" space, then the btrfs filesystem has to be manually balanced.

Balancing: make absolutely sure you won't run out of battery and execute: devel-su btrfs balance start -v /

It will require a long time (here it was more than 20 minutes the first time I tried it). While running, the "used" space will vary. At the end you will see a message like: Done, had to relocate 21 out of 21 chunks.


My personal feature request

Maybe I will place these on together.jolla.com as well...

Upgrade to Qt 5.5:
I don't know if there is any reason to rely on Qt 5.2...

Preinstalled Ruby 2.2 language interpreter with Qt 5.5 UI bindings and allowing to upload Ruby 2.2 apps to Jolla store:
'nuff said.

Privacy enhanced apps for major services:
hey, why should Facebook access my SMS and contacts archive? I only want to post updates and chat. On multiple accounts.

Sound and headsets:
when an headset is connected, sound output *shall* use only it.

Currently: I need to use "silence sounds" because I hate the ringtone playing on the loudspeaker while I wear my headset.

Data plan counters in the lock screen:
it should include an option to autoreset when solar month date changes:

[×] show dataplan counters in the lock screen
starting from (×) solar month ( ) last reset
show (×) total megabytes ( ) sent and received megabytes
user string [ traffico consumato: ]