Mobian should not need a lot of tweaks

Let's try to find or open issues in the affected software in addition to adding tweaks, and link them here! This includes when something is matter of preference and it's quite common to change it, there should be a UI for it.

Automatic app scaling

As of version 0.4.0, phoc is now able to automatically scale down windows which are too large to fit the screen. This should be enabled on a per-app basis using the following command:

scale-to-fit <APP-ID> on

The APP-ID depends on how the app itself declares it, here is a small list:

App name ID
Calendar gnome-calendar
Cawbird cawbird
Empathy empathy
Firefox firefox-esr
Geary geary
Maps org.gnome.Maps
Mumble net.sourceforge.mumble.mumble
Nautilus org.gnome.nautilus
Totem totem
Sudoku gnome-sudoku

Note: scale-to-fit wasn't in the initial 0.4.0 package, you might need to upgrade once more to have it installed.

Note: To find out the APP-ID, you can launch your app with WAYLAND_DEBUG=client and check for a line similar to xdg_toplevel@37.set_app_id(“gedit”)

To resize the Evolution reminders window (not launchable and not an app), the app id is evolution-alarm-notify

Add sid repository

Sid is the unstable debian repository with bleeding edge versions. Be careful and recall that some of mobian's packages are patched to work better on a mobile (e.g. gtk). By using sid, you will use a newer version without these adaptations. Also, Mobian developers test only against the debian “testing” versions of packages, so you are on your own if you do that. Modify /etc/apt/sources.list and add this line for the sid repository

deb http://deb.debian.org/debian sid main

Make sid repository the lowest priority by adding it to /etc/apt/preferences.d/00-mobian-priority. Your file should look like this. The order is important.

Package: *
Pin: release o=Mobian
Pin-Priority: 700

Package: *
Pin: release n=sid
Pin-Priority: 300

Package: *
Pin: release o=Debian
Pin-Priority: 500

Using SSH with a key instead of password

See Security

Taking screenshots

If you want to take screenshots you can use the package grim:

sudo apt install grim

If you want to make a screenshot just call (can be done from SSH)

grim my_screenshot.png

grim does not support delaying taking a screenshot.

In case you want to take a screenshot of something other than your terminal - I don't know who would want to do such a thing ;-) - you can run

sleep 10; grim my_screenshot.png

to delay the taking of the screenshot by 10 seconds.

An even fancier way to take a screenshot using a simple graphical dialog (and initiating it by invoking an “app”) has been described here and works flawlessly on Mobian once the required dependencies have been installed (sudo apt install libnotify-bin grim). The script needs to be adapted to store screenshots in (/home/mobian) rather than home/purism, so, this works:

#!/bin/bash
SCREENSHOT=${HOME}/Pictures/$(date +%Y-%m-%d-%H%M%S).png
notify-send -t 1000 screenshot "Taking a screenshot in 5 seconds"
sleep 5
grim "$SCREENSHOT"
notify-send screenshot "Screenshot stored at ${SCREENSHOT}"

Setting up GPS (GNSS)

Satellite based positioning is now set up out of the box. The modem hardware switch needs to be turned on for the Pinephone in order for GPS reception to work. Satellite positioning is only available to web apps through GNOME Web browser.

ModemManager handles the location in mobian, not gpsd. See the relevant arch documentation to get an idea of terminal commands to be used (your modem number could be “0” or any higher number, it is not necessarily stable, find out with mmcli –list-modems ). Location querying is being handled by the GNOME's “geoclue” library. Usually, you will not have to install the gpsd daemon on mobian.

See Location for an in-depth look at how location is determined in Mobian.

Enable dark theme

  1. Open a terminal
  2. Enter the following command: gsettings set org.gnome.desktop.interface gtk-theme “Adwaita-dark”

If you enable a dark theme, gedit's default scheme (probably tango) will use a too light color for highlighting the current line and thus making the text unreadable. To get rid of that problem, one can switch to another scheme, such as solarized-dark, with the command gsettings set org.gnome.gedit.preferences.editor scheme “solarized-dark”.

Set custom suspend timeout

The GUI in Settings → Power only offers a limited number of timeouts.

To set the suspend timeout to 30 seconds: gsettings set org.gnome.settings-daemon.plugins.power sleep-inactive-battery-timeout 30

To check the current timeout: gsettings get org.gnome.settings-daemon.plugins.power sleep-inactive-battery-timeout

Enable Wireguard

WireGuard is mainlined in Linux kernel 5.6 and higher, and included in the Pine kernel.

  1. Open a terminal
  2. Enter the following command: apt install –no-install-recommends wireguard-tools
  3. You can now use the wg-quick command to manage WireGuard tunnels.

Updating the bootloader

Due to the way u-boot is packaged in Debian, it isn't automatically updated as a bootloader update is a sensitive operation, and mostly device-dependent.

When the package is upgraded, you need to execute the following command to install the new version to the boot sector:

sudo u-boot-install-pinephone

Import contacts from VCF file

Syncevolution has been removed from upstream Debian, in the meantime it is straightforward to import contacts from a VCF file via Evolution tooling. First install evolution:

sudo apt install evolution

Before you import the file you will need to set scale-to-fit for Evolution on, otherwise the import dialog page is unusable.

scale-to-fit Evolution on

After this I opened the .vcf file via the Files app, it auto-launched the import dialoug. After importing I removed the Evolution app, this step is optional:

sudo apt remove evolution

sudo apt autoremove

Run local scripts on startup

If you plan to run some tweaks and scripts on startup which used to be run in /etc/rc.local before the systemd times, here is a howto to re-enable that:

- create /etc/rc.local with the following content:

#!/bin/sh -e
# This script is executed at the end of each multiuser runlevel.
# Make sure that the script will "exit 0" on success or any other
# value on error.

# By default this script does nothing. 
exit 0

- chmod +x /etc/rc.local (mark the file as executable)

- systemctl enable rc-local (enable the already predefined rc-local system)

- and test with service rc-local start and systemctl status rc-local

CalDAV and CardDAV

Though there is no native way to sync CalDAV and CardDAV, you can add CalDAV and CardDAV though evolution (evolution in this manner acts as a front end to add the entries into evolution-data-server, and the other programs read from that),

sudo apt install evolution

Before you import the file you will need to set scale-to-fit for Evolution on, otherwise the import dialog page is unusable.

scale-to-fit Evolution on

I found the easiest way to configure it was to configure all of my CardDAV and CalDAV on a desktop version of evolution, backing it up, putting it on the PinePhone, and importing the configuration. After that, you just have to enter in the passwords.

NOTE: Gnome To-Do (the “To-Do” app on Mobian) does not work with CalDAV, so it will not recognize any CalDAV to-do lists. < It does if you use Gnome Online Accounts with Nextcloud, for example.

USB-C chargers / smart chargers not charging phone

This appears to be related to the kernel module for a chip in several USB-C-to-HDMI adapters. It can be fixed by blacklisting the module.

To fix it, create or edit the file /etc/modprobe.d/blacklist.conf and add the following line:

blacklist anx7688

Reboot, and smart chargers should now charge correctly.

Mount SDcard as /home (Unencrypted)

If you want to install Mobian to the eMMC and use an sdcard as your /home partition, you will need to first install Mobian on the internal MMC.

Once it is complete, power down the phone, and either insert a different, fresh sdcard with an ext4 partition, or format an existing sdcard by mounting it on your desktop, creating a new MSDOS partition table (in gparted, parted, etc), and then running sudo dd if=/dev/zero of=/dev/YOURSDCARDDEVICE bs=512 seek=16 count=1 to overwrite the u-boot signature (otherwise the phone will try to boot from it still). Ensure that you do not run this command against the wrong device! Finally, create a new ext4 partition on the sdcard, and then eject it.

Now that you have Mobian installed on the eMMC and a fresh sdcard inserted, power on the phone and launch the terminal. First, mount the sdcard by running sudo mkdir /mnt/sdcard && sudo mount -t ext4 /dev/mmcblk0p1 /mnt/sdcard. Then, copy the current contents of /home to it with sudo cp -aR /home/* /mnt/sdcard/. Then, unmount it from the temporary mountpoint with sudo umount /mnt/sdcard, and mount it at /home with sudo mount -t ext4 /dev/mmcblk0p1 /home. Finally, we will need to acquire the UUID of the sdcard and add an entry to fstab. Run sudo blkid /dev/mmcblk0p1 to get the UUID, and then copy just the UUID (it will look like 1f255d6ae-1634-2aa4-172cfa15) and edit /etc/fstab with vim or nano (or whatever). Copy the first line, and paste it at the bottom of the file as a new third line. Then replace the UUID with what you copied from the output of blkid, and change the / to /home, and finally change the final 0 to a 2 (this will tell fsck to check it after the other entries). It should look like this: UUID=a2c1f977-0405-4ae1-8169-639b8ae53e3b /home ext4 defaults 0 2

At this point your sdcard will be persistently mounted to /home, and will have all the files that the initial /home had. Congratulations, you now have more than 16GiB available for your files!

Auto-connect bluetooth headset

You can setup pulseaudio to automatically connect to any new bluetooth headset. Simply add the following line to /etc/pulse/default.pa:

load-module module-switch-on-connect

Enable ZRAM

ZRAM support is built into the Mobian kernel, and creates a swap block that runs in realtime on physical RAM with compression. It makes swap almost as fast as physical memory, while also making it more efficient, so it is ideal for low-memory devices (it has been used for years in all Android and ChromeOS devices). Fedora is also most likely making it the default in release 33.

To enable it, install the package zram-tools (sudo apt install zram-tools). Then edit /etc/default/zramswap and uncomment the PERCENTAGE line, and change the value to any value between 0 and 200. According to The authors of zram-config (Link to Github), zram compression lays between 220-450%, meaning that up to 4.5 times the physical RAM may in some circumstances fit into a zram space. A value of 50 should be on the safe side, more adventurous users have successfully set it to 200.

As of writing this, there is a bug in Mobian, where only a single zram device (/dev/zram0) will be created, thus only a single core can be used for compression. zram-utils by default tries to use all cores, thus only 1/4 of your specified zram space will be available this way. As a workaround, set the CORES property in the config file to 1, until this is resolved. That way, only 1 core will be used and the entire zram will reside in /dev/zram0.

As the zram function is integrated in the Mobian kernel and not build as a module, the only way to enable multiple zram devices is to append to the kernel bootargs zram.num_devices=X with X the same value you specifed as CORES. To modify the kernel bootargs edit as root the file /boot/boot.cmd and regenerate the boot script with sudo mkimage -T script -C none -A arm64 -d boot.cmd boot.scr and then reboot.

After doing the changes to the config-file you need to either reboot, or use sudo zramswap start for the changes to take effect. Check sudo swapon -s and free for the results.

Make the internal speaker louder

Sometimes, it seems like the internal speaker is quiet compared to other phones even though the volume is set to maximum. You can adjust the gain of the “line out” using alsamixer.

$ sudo apt install alsa-utils
$ alsamixer

Once the mixer comes up you can use F6 and pick the “PinePhone” device. From there, use the left and right arrow keys to find “Line Out” and then the up arrow to boost the gain of it. You can also boost it a little further by going to “Line Out Source” and picking “Mono Dif” instead of stereo.

Home screen launcher for Voicemail

For certain commonly used phone numbers it's great to have a launcher on the home screen that automatically dials it instead of having to look in contacts, recent calls, etc. It turns out that the calls app supports dialing phone numbers from the command-line and so it is possible to invoke it with a specific phone number from a launcher. Here's an example launcher that you can put in /home/mobian/.local/share/applications/voicemail.desktop.

[Desktop Entry]
Name=Voicemail
StartupWMClass=Voicemail
Comment=Dial voicemail
GenericName=Voicemail
Exec=calls --dial=<voicemail_phone_number_here>
Icon=/usr/share/icons/hicolor/scalable/actions/mail-inbox-symbolic.svg
Type=Application
Categories=Cell;
MimeType=;
Keywords=Connectivity;

Note that you put whatever your voicemail phone number is in the Exec line. Also, pick the icon that you would like for the launcher or even download a png file somewhere on your phone (e.g. /home/mobian/.local/share/icons) and give that path to it here. Either reboot your phone to see the new launcher or run

update-desktop-database /home/mobian/.local/share/applications

Prevent suspend & keep the screen on

Some applications do not keep the screen on and the screensaver (or suspend) kicks in. (Video players such as mpv come to mind). In these case the built-in gnome-session-inhibit tool can be useful. You can use it to run a program and it will inhibit the screensaver and suspend while the program is running. You can override certain desktop launchers in /usr/share/applications to wrap them with gnome-session-inhibit. See the mpv page to see an example.

Anbox

Changing the default username from mobian

This procedure requires ssh unless there is a way to log in as a different user on the phone itself. The main command involved in changing a username requires that all processes running under that user be closed – as a result, we will need to kill phosh and will lose access to the phone through the touch screen (requiring ssh). First, we will add a temporary user and give it sudo privileges. Although it probably won't matter because we are using ssh, consider only using numbers when creating temp's password.

sudo adduser temp

sudo adduser temp sudo

Don't forget to give the temporary user your ssh credentials if you use public key login.

sudo mkdir /home/temp/.ssh && sudo cp /home/mobian/.ssh/authorized_keys /home/temp/.ssh/authorized_keys

sudo chown -R temp:temp /home/temp/.ssh

Now, exit/logout and log back in as temp through ssh. We want to run commands to rename your username, home folder, and group. When you run the command below (sudo usermod -l newusername -m -d /home/newusername oldusername), it will fail because phosh is still running. You will see a message like the following: usermod: user mobian is currently used by process XXXX

Run ps -ax | grep XXXX, where XXXX is the PID referenced in the message above, to see what is running. Ensure it is something you are willing to close (it should only be phosh unless you have something else running). Use sudo kill XXXX, which will stop your phone's screen from displaying anything. Now, the two commands below should run:

sudo usermod -l newusername -m -d /home/newusername oldusername

sudo groupmod -n newusername oldusername

Run sudo reboot and make sure everything is working. If you have any dotfiles that specify file paths using /home/mobian, you will need to change them. If you were using a custom picture in a directory within /home/mobian as your wallpaper, you will need to set it again. Unfortunately, the commands above don't seem to change absolutely everything. For example, using your phone, navigate to Settings > Users. Your username will still say mobian. If you rotate your phone to landscape mode, you will be able to edit the name here using the pencil icon on the far right of the screen.

Finally, you can delete your temporary user:

sudo userdel -r temp