About this page

This page lists some commonly asked about customizations or tweaks that depend on user's preferences.

This page has quite a bit of overlap with the Frequently Asked Questions page, so check if your topic can be found there?

Suspend/Sleep

Prevent suspend & keep the screen on

Some applications do not keep the screen on and the screensaver (or suspend) kicks in. (Video players or a long running apt upgrade 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. gnome-session-inhibit has various "levels" of inhibiting. Using the --inhibit LEVEL option, it can prevent suspend, or screen blanking/locking with idle (the default).

So, to prevent your phone from going to sleep (but still allow the screen to go blank) while upgrading the system you would run gnome-session-inhibit --inhibit suspend sudo apt upgrade.

It is a nice tweak to add this to your .bashrc file:

# Inhibit suspend when using sudo in a terminal
alias sudo='gnome-session-inhibit --inhibit suspend sudo'

In order to automate this, you can override certain desktop launchers in /usr/share/applications/*.desktop to wrap the executed command with gnome-session-inhibit.

Prevent suspend via launcher icon

Following script will prevent suspending until you close the application's window.

Put the following script into /home/mobian/bin/prevent-suspend.sh (or any other location...)

gnome-session-inhibit --reason "$(whoami) said so..." \
    --inhibit suspend \
    yad --title "Prevent Suspend" \
        --text "We will NOT sleep, unless you click \"OK\"!" \
        --button=gtk-ok \

echo "OK! Zzzzzzzz"

Make the script that you just created executable:

Also create a launcher icon, by putting the following into /home/mobian/.local/share/applications/prevent-suspend.desktop

[Desktop Entry]
Type=Application
Name=Suspend Inhibitor
Icon=gnome-power-manager
Exec=/home/mobian/bin/prevent-suspend.sh
Terminal=false
X-Purism-FormFactor=Workstation;Mobile;

Change the path in Exec= if your script is at a different location.

Prevent Sleep in an SSH session

Since "inactivity" in the Power settings in Phosh consider only interactions with the screen, it may happen that the device goes into sleep mode while you are accessing it via SSH from another machine. To prevent this, add this little section to the end of your ~/.bashrc:

if [[ -n $SSH_CONNECTION ]]; then
  sh -c "gnome-session-inhibit --inhibit suspend --reason \"SSH connection active\" --inhibit-only > /dev/null 2>&1 &"
fi

This section checks whether the SSH_CONNECTION environment variable is currently set (this is done if you ssh into your phone). If it is, meaning that the current shell is spawned via an SSH session, the code above will use gnome-session-inhibit to prevent the device to suspend/sleep. If the ssh-connection and thus the bash-session is killed, so is gnome-session-inhibit and the device is allowed to suspend again.

Prevent suspend while Wi-Fi Hotspot is active

Combining the knowledge above, this script and desktop entry provides a convenient mechanism to enable the Wi-Fi Hotspot and prevent suspend while active; simply turn the hotspot off and the inhibition will automatically cease: https://desmas.net/mobian/wifi-hotspot-inhibit-suspend/.

It may be necessary to grant permission to the user to control the WiFi Hotspot, which can be done by granting permission to all regular users with an active session like so:

Note: this issue is tracked upstream here

Software updates

Add sid repository

Sid is the unstable debian repository with bleeding edge versions. Modify /etc/apt/sources.list and add this line for the sid repository:

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

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, so your user experience can be worse! Also, Mobian developers test only against the Debian "testing" versions of packages, so you are on your own if you do that.

Upgrade to Bookworm (testing)

Upgrading from bullseye to bookworm won’t be automated and will require editing your sources.list files: simply replace bullseye with bookworm in both /etc/apt/sources.list and /etc/apt/sources.list.d/mobian.list.

Notes:

Please keep in mind that we expect a huge amount of upgrades to be flowing in the weeks following the bullseye release, with plenty of opportunities to break the system, so you might want to wait a bit before upgrading

Once the dust settles, we plan to move more and more of Mobian into the Debian archive with the hope of making Debian bookworm a first-class citizen in the “Linux on mobile” world.

Disable GNOME Software on startup (or hide apps from app drawer)

Copy the .desktop file to the local user override directory with mkdir -p ~/.config/autostart/ && cp /etc/xdg/autostart/org.gnome.Software.desktop ~/.config/autostart/, then edit the new file and add this line to the end: Hidden=true

This can be done for any .desktop file, and if you simply want to hide the icon in the app drawer but keep the startup functionality, add NoDisplay=true to the .desktop file.

Networking

Using SSH with a key instead of password

See Using SSH with a key instead of password

Phone calls

Hints for debugging audio calls are at Mobian/AudioPhoneCallsDebuggingHints. If you only need minor tweaks for phone calls, then see:

Proximity sensor

The proximity sensor on your phone is intended to detect infrared (IR) electromagnetic radiation from a distance of a few cm or less from your ear (during a phone call) or body (when the phone is in a pocket). Several components of software are involved in converting the measured "raw" integer value into either "near" (high value, e.g. 500) or "far" (low value, e.g. 10), depending on whether it is above or below the proximity "near level", and in taking an action in response to that. The measured raw value when no human IR is nearby will vary depending on conditions such as GPU/CPU temperature and ambient temperature. (Example: PinePhone v1.2, raw value from 8 to 22 at median GPU/CPU temperature of 50 to 55 deg C; raw value 18 to 22 at GPU/CPU 30-35 C; feel free to help with collecting proximity_raw data so that we can choose a better default.) You will likely have to modify the default "near level" so that screen blanking happens at the distance appropriate for your phone and specific sensor (e.g. stk3311-compatible), within the range of conditions in which you use your phone.

Browse the advice in /lib/udev/hwdb.d/60-sensor.hwdb .

1. As an ordinary user, estimate your preferred near level with a loop such as

for ((i=0;i<30;i++)); do cat /sys/devices/platform/soc/1c2b000.i2c/i2c-1/1-0048/iio:device0/in_proximity_raw ; sleep 1; done

for the PinePhone v1.2. The path for your particular phone may differ (e.g. .../iio:device1/... also for a PinePhone v1.2) - see /lib/udev/hwdb.d/60-sensor.hwdb for hints. Move your hand near the sensor. To see the boot-up near level that that is set via the device tree '.dtb' file, do cat /sys/devices/platform/soc/1c2b000.i2c/i2c-1/1-0048/iio:device0/in_proximity_nearlevel . For a no-reboot method, try the hwdb method (step 2), or if it fails, then the udev rules method (step 3) instead.

2. hwdb method:

2.1 As root, create a file /etc/udev/hwdb.d/61-sensor-local.hwdb :

sensor:modalias:of:Nlight-sensorT*Csensortek,stk3311:*
  PROXIMITY_NEAR_LEVEL=70

where 70 is the near level that you want to try, and /lib/udev/hwdb.d/60-sensor.hwdb gives hints for working out the specific text string for the sensor:modalias:... line (the current line appears valid for PinePhones as of 2022/2023).

2.2 Reload the udev system and restart the monitoring daemon with

sudo systemd-hwdb update && sudo udevadm trigger && sudo systemctl restart iio-sensor-proxy

3. udev rules method: First do the check in step 4. If it succeeds, then don't do step 3 (it's not needed).

3.1 As root, create a file /etc/udev/rules.d/10-proximity.rules with some useful comments starting with # and the line

ACTION=="add", SUBSYSTEM=="iio", TEST=="in_proximity_raw", ENV{PROXIMITY_NEAR_LEVEL}="70"

where 70 is the near level that you want to try.

3.2 Reload the udev system and restart the monitoring daemon with

sudo udevadm trigger --action=add && sudo systemctl restart iio-sensor-proxy

4. Check that the udev system has been updated, e.g.

sudo udevadm info --export-db |grep -i --color -C5 proximity_near

If this does not show a line such as

E: PROXIMITY_NEAR_LEVEL=70

then either try step 2 again (recommended), or try step 3, until udevadm info --export-deb shows that your PROXIMITY_NEAR_LEVEL has been set.

5. Verify your new level with monitor-sensor --proximity . Move your hand near the sensor and it should toggle between 1 (near) and 0 (far).

Audio

Auto-connect Devices

You can configure Pipewire to automatically switch the audio output device to any newly connected device, such as a Bluetooth headset or speaker. This just requires loading the module-switch-on-connect module in Pipewire's Pulseaudio server configuration.

Create the ~/.config/pipewire/pipewire-pulse.conf.d/ configuration directory.

mkdir -p ~/.config/pipewire/pipewire-pulse.conf.d/

Now create the file ~/.config/pipewire/pipewire-pulse.conf.d/50-switch-on-connect.conf with the following contents:

pulse.cmd = [
    { cmd = "load-module" args = "module-switch-on-connect" }
]

Restart the Pipewire Pulseaudio server and the Wireplumber session manager.

systemctl --user restart pipewire-pulse.service wireplumber.service

Video playback

Clapper

To enable hardware accelerated playback it's recommended to use newer playbin3 element by enabling it using environment variable. Put 'export GST_CLAPPER_USE_PLAYBIN3=1' into ~/.profile, for example.

Other tweaks

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=gnome-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 <code>update-desktop-database /home/mobian/.local/share/applications</code>

Clone partitions form eMMC to microSD or from microSD to eMMC

You can easily clone the eMMC partitions to a microSD card and vice versa as long as the total size of the partitions on the device backup is smaller then the target storage, otherwise you need to resize a partition.

In this example we will clone the eMMC partitions to the microSD, first step listing the eMMC partitions:

# sudo fdisk -l /dev/mmcblk2
Disk /dev/mmcblk2: 14,45 GiB, 15518924800 bytes, 30310400 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0xc4a12776

Device         Boot  Start      End  Sectors  Size Id Type
/dev/mmcblk2p1 *     16384   524287   507904  248M 83 Linux
/dev/mmcblk2p3      524288 29822975 29298688   14G 83 Linux

Two partitions here boot and root, the value that we need is the End sector of the root partition (mmcblk2p3 here), 29822975 that we will use for the count value:

# sudo dd if=/dev/mmcblk2 bs=4096 count=29822975 conv=sync,noerror of=/dev/mmcblk0 status=progress 

Here we just copy all the sectors from mmcblk0 (the eMMC) to mmcblk2 (the microSD). Keep in mind that if you reboot your pinephone with the microSD in, the phone will boot on the microSD and not on the eMMc.

Enabling the display of console output on boot (instead of black screen)

As a default, the boot console is the serial interface. You may want to also add the terminal.

Procedure for Linux-first devices

The config is located under /etc/u-boot-menu.d/ and is named after the device used, for example on OG PinePhone:

The file should contain the following line (or a similar one):

Remove

Add

in the U_BOOT_PARAMETERS line. Yes, it is twice a "console=" parameter, hopefully to enable two different consoles (serial AND tty1).

The resulting line should look like:

Apply the changes with:

Procedure for Android-first devices

The configuration is stored in the boot partition, whose partition letter can be found e.g. on op6-enchilada with

$ ls -lah /dev/disk/by-partlabel/
[...]
lrwxrwxrwx 1 root root   11 29 mag  1970 boot_a -> ../../sde11
lrwxrwxrwx 1 root root   11 29 mag  1970 boot_b -> ../../sde39
[...]