Allow airplane mode in Situations app under Sailfish OS 3

After switching my phone from a Jolla 1 to an Xperia X, I had to reenable the ability to allow the Situations app to turn on and off the airplane mode. I collected all the pieces from the blog to provide a guide.

Summary of what the detailed commands do:

  1. Enable Developer mode under Preferences -> Developer tools. You are prompted for your phone pin.
  2. Open the newly installed application Terminal
  3. install sudo
  4. allow the user nemo to call the tool connmanctl via sudo without a password
  5. create a command line situation within Situations

The detailed commands to install sudo (step 2 from above). Type them in the terminal app:

[root@Sailfish ~]$ devel-su
[root@Sailfish ~]$ ssu ar mer-tools
[root@Sailfish ~]$ pkcon refresh
[root@Sailfish ~]$ pkcon install sudo #answer questions with y for yes

The detailed command to allow the user nemo to call the tool connmanctl (step 3 from above). Type them in the terminal app:

[root@Sailfish ~]$ EDITOR=/bin/vi visudo -f /etc/sudoers.d/nemo-settings

This opens the editor vi. Press the key “i” to be able to input text. and type the following:

nemo ALL = (ALL) NOPASSWD: /usr/bin/connmannctl

Press “ESC” and type “:wq” to save and quit vi. Visudo will not save the file if you have syntax errors. It will tell you and allows you to re-edit by pressing “e”.

Test the changes by typing exit in the terminal. You should be still in the terminal app. Type the following to put the phone in airplane mode and back.

[nemo@Sailfish ~]$ connmanctl enable offline
[nemo@Sailfish ~]$ connmanctl disable offline

Now you can add a situation to the Situations app. I have a situation that activates every day from 1am to 6am and calls the following command on situation start:

connmanctl enable offline 

and the following command on situation finish:

connmanctl disable offline

install sudo on sailfish:
connmanctl commands:
sudoers syntax:

Leave a Reply

Please log in using one of these methods to post your comment: Logo

You are commenting using your account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.