meta data for this page
Table of Contents
About this page
This page lists some commonly asked about customizations or tweaks that depend on user's preferences. There is another page listing tweaks that are most useful for table/pinetab screen format devices.
This page has quite a bit of overlap with the Frequently Asked Questions, so check if your topic can be found there?
PMOS-Tweaks
https://gitlab.com/postmarketOS/postmarketos-tweaks/
GNOME Tweaks but *tweaked* for Phosh.
git clone https://gitlab.com/postmarketOS/postmarketos-tweaks.git cd postmarketos-tweaks sudo apt install libhandy-1-dev python3-yaml meson meson setup --prefix=/usr build cd build sudo ninja install
Initial packaging for old version is available here and can be reused to build Debian package for newer versions.
Themes
See the excellent page on themes for Mobian, to learn how to use a different theme, how to prefer and use dark themes, how to change icon themes or wallpaper backgrounds.
Display related tweaks
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 |
---|---|
Anki | anki |
Calendar | gnome-calendar |
Cawbird | cawbird |
Empathy | empathy |
Evolution reminders | evolution-alarm-notify |
Firefox | firefox-esr |
Geary | geary |
Maps | org.gnome.Maps |
Mumble | net.sourceforge.mumble.mumble |
Nautilus | org.gnome.nautilus |
Sudoku | gnome-sudoku |
Telegram Desktop | telegramdesktop |
Totem | totem |
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
.
Linmob.net has a post elaborating on scaling techniques (app vs full screen).
Scale the screen
Sometimes apps just don't fit the screen and you would like to scale the full screen. Fortunately that is easy. “Settings→Display” has a setting to chose between 100% or 200% scaling. If you want to use other values or you need a way to do that from the terminal, install package wlr-randr and do:
wlr-randr --output DSI-1 --scale 2 wlr-randr --output DSI-1 --scale 1
(depending on which scale you want). The scaling is applied until you reboot, so is not saved permanently. You can also chose fractional values (1.5), but be aware that this could have performance implications. (It would be great if somebody tested this). This puri.sm blog post has a nice description on how to put together a mini app that allows you to easily change the scaling on the fly.
Scale the screen (variant 2)
The default configuration of phoc is in file /usr/share/phosh/phoc.ini. To change the default screen scaling copy that file to /etc/phosh/phoc.ini and modify this part:
... [output:DSI-1] # scale = 2 scale = 1.5 ...
This change is persistent across reboots. (but beware that in case the default values of phoc.ini change at some point, you might end up with obsolete ones).
Change the background for the lock screen, app grid and monitor
To change the background for the app grid and/or lock screen, you need to create a file ~/.config/gtk-3.0/gtk.css. Here is an example css script:
/* * ~/.config/gtk-3.0/gtk.css * Restart phosh using "sudo systemctl restart phosh" */ phosh-app-grid { background-image: linear-gradient(rgba(0, 0, 0, 0.7), rgba(0, 0, 0, 0.7)), url('file:///home/mobian/Pictures/background.jpg'); background-size: cover; background-position: center; } phosh-lockscreen, .phosh-lockshield { background-image: linear-gradient(rgba(0, 0, 0, 0.7), rgba(0, 0, 0, 0.7)), url('file:///home/mobian/Pictures/background.jpg'); background-size: cover; background-position: center; }
To change background of a monitor/background while loading an app run this command:
gsettings set org.gnome.desktop.background picture-uri file:///home/mobian/Pictures/background.jpg
Taking screenshots
From the command line
There is no key shortcut to take screenshots, but you can use the command line tool grim (sudo apt install grim
).
To make one, just call (can easily be done from SSH so that you can see on your phone display what you are screenshotting)
grim my_screenshot.png
This will save a screenshot in the current directory (if you omit the file name, it will select a unique name automatically).
Unfortunately grim
does not support delaying taking a screenshot. In case you want to take a screenshot of something other than the terminal you type grim
in - you can run
sleep 10; grim my_screenshot.png
to delay the taking of the screenshot by 10 seconds.
Gnome-screenshot
You can install the gnome-screenshot package. Fullscreen screenshots work! Delay timer works fine too, so you can easily change focus to another app or part of the home screen. The 'Window' and 'Selection' options currently cause the app to crash.
To install the package:
sudo apt install gnome-screenshot
Out of the box it will not scale properly on the PinePhone (possibly on other devices too?). To fix this:
scale-to-fit gnome-screenshot
Taking screenshots v2 (fancy app)
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. It is a good combination between convenience and ease of understanding.
- Install the required dependencies:
sudo apt install libnotify-bin grim
- Place the screenshot script in /home/mobian/bin (or anywhere really). The original script has been adapted to store screenshots in (/home/mobian) rather than /home/purism:
#!/bin/bash # this file should be stored as /home/mobian/bin/screenshot 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}"
- Make the screenshotter executable as program:
chmod 755 /home/mobian/bin/screenshot
- Finally create the application icon to easily call it from the homescreen. So create a file in /home/purism/.local/share/applications/screenshot.desktop and put there:
[Desktop Entry] Name=Screen Shot Type=Application Icon=applets-screenshooter Exec=/home/mobian/bin/screenshot Categories=Utility;
Now all you need to do is clicking on the screenshot icon in your app overview. Or issue “screenshot” in the terminal (it might take a relogin to make ~/bin automatically be picked up as PATH).
Taking screenshots v3
(an improved fancy app with correct display in the local language)
Nothing is so good that it can't be even better, in three steps to screenshots in the local language, see there:
- Install the required dependencies:
sudo apt install grim libnotify-bin yad
- The script –> /usr/local/bin or another folder in the $PATH variable. Don't forget to adjust the execution permissions, e.g.:
chmod 755 /usr/local/bin/screenshot2app
- The *.desktop –> /usr/share/applications
#PP_german:matrix.org hopes you have fun creating a screenshot.
Screen recording
If you want to record the screen, you can use the package wf-recorder (sudo apt install wf-recorder
).
If you want to make a video grabbing screen and microphone just call (can be done from SSH)
wf-recorder --file=recording_with_audio.mp4 --audio
Screen recording v2 (fancy app)
Using the above application wf-recorder
in combination with yad
and a simple bash-script, one can create a cool GUI for screen recordings (with and without audio recording):
Put this script into /home/mobian/bin/screenrecorder.sh
or any similar location:
#!/usr/bin/env bash SCREENCAST="${HOME}/Videos/$(date +%Y-%m-%d-%H%M%S).mp4" CHOICE=$(yad --title="Screen Recorder" \ --text="${SCREENCAST}" \ --window-icon=mpv \ --button=gtk-ok \ --form \ --field="Audio:CHK") if [[ $? == 0 ]]; then AUDIO=$(echo "$CHOICE" | cut -d "|" -f1) if [[ "$AUDIO" == "TRUE" ]]; then AUDIO_ARG="--audio" fi wf-recorder $AUDIO_ARG --file="${SCREENCAST}" & RECORDER_PID=$! yad --title="Screen Recorder" \ --text="Stop Recording" \ --button=gtk-cancel kill -INT 888 $RECORDER_PID notify-send "Screencast" "${SCREENCAST}" fi
You also need a launcher icon for the script, so put following into /home/mobian/.local/share/applications/screenrecorder.desktop
:
[Desktop Entry] Type=Application Name=Screenrecorder Icon=preferences-desktop-screensaver Exec=/home/mobian/bin/screenrecorder.sh Terminal=false
Change the path in the Exec=
line, if the script has a different location.
Suspend/Sleep
Set custom suspend timeout
The GUI in Settings → Power only offers a limited number of timeouts which might not be sufficient for you (the shortest time is 5 minutes).
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
The change is persistent across restarts.
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 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 (aka crust sleep), 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 sudo'
In order to automate this, you can override certain desktop launchers in /usr/share/applications/*.desktop to wrap the excuted command with gnome-session-inhibit. See the mpv page to see an example.
Prevent sleep via launcher icon
Following script will prevent sleep until you close the application's window.
Put following script into /home/mobian/bin/prevent-sleep.sh
(or any other location…)
#!/usr/bin/env bash 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 created script executable.
chmod a+x /home/mobian/bin/prevent-sleep.sh
Also create a launcher icon, by putting following into /home/mobian/.local/share/applications/prevent-sleep.desktop
:
[Desktop Entry] Type=Application Name=Suspend Inhibitor Icon=gnome-power-manager Exec=/home/mobian/bin/prevent-suspend.sh Terminal=false
Change the path in Exec=
if your script has 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 Sleep while mediaplayback is active
A simple Suspend-Guard script can be used to prevent suspending as long as media is playing on the phone (music, video, …).
The script checks whether any applications is currently outputting audio via pulseaudio (note as of 2023-01-26, it does not seem to work with pipewire) and inhibits suspend for a short amount of time, until it checks again. That way, the phone may suspend as soon as the media is not playing anymore.
The script comes with a handy systemd-unit which enables the guard automatically. You can find the source-code in a user's git-repository. Additions and comments are welcome!
To enable:
git clone https://codeberg.org/jayvii/pinephone-scripts.git cd pinephone-scripts/sguard make install systemctl enable --user sguard --now
Prevent suspend while WiFi Hotspot is active
Combining the knowledge above, this script and desktop entry provides a convenient mechanism to enable the WiFi 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:
sudo nmcli connection modify Hotspot +connection.permissions ''
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
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
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:
- if you originally flashed your device with an image older than April 26th, 2021, will have to edit /etc/apt/sources.list.d/extrepo_mobian.sources, replacing Suites: mobian with Suites: bookworm
- if you were using Mobian unstable so far, you will only need to edit /etc/apt/sources.list: our current unstable repo will keep being the entry point for all new and updated packages we upload
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.
Updating the bootloader
The bootloader uboot is automatically updated when the u-boot-sunxi package is updated, so you should not need to do this manually. If you ever find yourself in a situation where you want to manually update or reinstall it, you can install the latest version to the boot sector: sudo u-boot-install-pinephone
.
Networking
Using SSH with a key instead of password
Enable Wireguard/VPN
WireGuard is included in the Mobian kernel. See the instructions on how to set it up.
Audio
Auto-connect
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
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.
Video recording
Currently there is no working app to record videos, as pinhole does not seem to work anymore and megapixels doesn't have video recording implemented yet. A simple hack would be to video screen capture the output of megapixels as described above.
A summary of additional methods was posted in the forum. All methods are based on an initial reddit post.
The python script doesn't run out of the box anymore and needs further attention, but is a good starting point to play around with currently available options.
Data import/integration
AndroidImpEx
Development effort for importing contacts from SIM or Contacts/SMS/CallHistory from a rooted Android:
https://gitlab.com/l2385/AndroidImpEx
Download the deb package:
$ wget https://gitlab.com/l2385/AndroidImpEx/uploads/2a2f331a74bf5dba9d33fc078b7d7523/AndroidImpEx_v.0.0.3.deb
Install with:
$ sudo apt-get install ./AndroidImpEx.deb
Application is able to import from Android
Contacts from: /data/data/com.android.providers.contacts/databases/contacts2.db Call History from: /data/data/com.sec.android.provider.logsprovider/databases/logs.db Messages from: /data/data/com.android.providers.telephony/databases/mmssms.db
The 3 Android databases to be imported should be placed under: /home/mobian/AndroidDBs
Application is also able to import Contacts from SIM
Import and export local addressbook contacts as VCF or CSV file
The contact app in Mobian uses the evolution-data-service as a backend. As of version 63, gnome-contacts can be used to import and export contacts in vcard format (.vcf).
Export local addressbook contacts as VCF or CSV file
As of version 43, gnome-contacts can be used to import and export contacts in vcard format (.vcf).
Alternatively, the binary addressbook-export
located at: /usr/libexec/evolution-data-server
can be used to export contacts as CSV or VCF files. In OS versions based in Debian oldstable (e.g: PureOS Amber) the path to this binary is different: /usr/lib/evolution/evolution-data-server/addressbook-export
and can be used without having to cd
into the directory.
cd /usr/libexec/evolution-data-server && ./addressbook-export --format=csv --output=/home/"$USER"/contacts-backup-"$(date +%Y-%m-%d-%H%M%S)".csv && cd cd /usr/libexec/evolution-data-server && ./addressbook-export --format=vcard --output=/home/"$USER"/contacts-backup-"$(date +%Y-%m-%d-%H%M%S)".vcf && cd
CalDAV and CardDAV
CalDAV and CardDAV are standards to provide addressbook and calendar data. You can easily integrate an online Caldav and Carddav source when running Nextcloud through the Online Account feature in the settings. This will also make the To-Do app to synchronize your tasks. The data will be synchronized and will even be available when you are online.
If you are not running Nextcloud, you can still integrate CalDAV/CardDAV resources, using the evolution frontend (which uses the same backend evolution-data-server as other programs).
- temporarily installing evolution (sudo apt install evolution
).
- You will need to set scale-to-fit for Evolution, otherwise the import dialog page is too big and 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. But you can also use evolution in order to integrate online addressbook and calendar sources.
Optional: Deinstalling evolution post-integration (as it is not needed for the backend to work):
sudo apt remove evolution sudo apt autoremove
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.
Other tweaks
Tuning boot time
apt install lz4 vim /etc/initramfs-tools/initramfs.conf
Find “compress=gzip” and change it to “compress=lz4”
Save file and
update-initramfs -u
Disable animations in Phosh
This may lead to significantly increased (perceived) performance gains (but breaks phosh 0.20):
gsettings set org.gnome.desktop.interface enable-animations false
Afterwards, restart your phone (or phosh via pkill phosh
) to apply the setting immediately.
Disable haptic feedback for Squeekeboard
Open a terminal and type the following:
gsettings set org.sigxcpu.feedbackd.application:/org/sigxcpu/feedbackd/application/sm-puri-squeekboard/ profile silent
Bash prompt shows battery state
Using this bash customizing with some changes to display the battery percentage in the bash prompt.
add this to ~/.bashrc and to /root/.bashrc if you like to see it as superuser too
# -= start battery prompt =- battery_status(){ BATTERY=/sys/class/power_supply/axp20x-battery #this is for pinephone and pinetab #BATTERY=/sys/class/power_supply/rk818-battery #this is for pinephone pro #BATTERY=/sys/class/power_supply/max170xx_battery # this is for librem 5 BATSTATE=$(cat ${BATTERY}/status) CHARGE=$(cat ${BATTERY}/capacity) NON='\001\e[0m\002' BLD='\001\e[1m\002' RED='\001\e[1;31m\002' GRN='\001\e[1;32m\002' YEL='\001\e[1;33m\002' COLOUR="$RED" case "${BATSTATE}" in 'Charged') BATSTT="=" ;; 'Charging') BATSTT="+" ;; 'Not charging'|'Discharging') BATSTT="-" ;; *) BATSTT="*" ;; esac # prevent a charge of more than 100% displaying if [ "$CHARGE" -gt "99" ] then CHARGE=100 fi if [ "$CHARGE" -gt "24" ] then COLOUR="$YEL" fi if [ "$CHARGE" -gt "34" ] then COLOUR="$GRN" fi printf "[${BATSTT}${COLOUR}${CHARGE}%%${NON}]" } #end of battery_status() if [ $(id -u) -eq 0 ]; then # you are root, set red colour prompt PS1='$(battery_status)\[\033[1;31m\]\u\[\033[0;32m\]@\h\[\033[1;34m\] \w\[\033[0m\]\$ ' else # normal user PS1='$(battery_status)\[\033[1;36m\]\u\[\033[0;32m\]@\h\[\033[1;34m\] \w\[\033[0m\]\$ ' fi # -=end battery prompt=-
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.
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
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.
Enabling "experimental" features in Chatty (default SMS/messaging app)
WARNING: experimental features are… experimental! bugs are expected; the usual; disclaimer, disclaimer, “You do what you want, but we had warned you.”
(You probably need the latest version from the unstable repositroy.)
To enable experimental features, issue this command in the terminal:
gsettings set sm.puri.Chatty experimental-features true
and here is the issue tracker for issues you find: https://source.puri.sm/Librem5/chatty/-/issues
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
After this execute 'sudo chown -R mobian:mobian /home/mobian' and replace 'mobian' with your current user to ensure the permissions are set correctly.
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!
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
update-desktop-database /home/mobian/.local/share/applications
Changing the default username from mobian
Be warned: Use it right after a fresh flash only! If you have configured apps that are using databases the change will modify database content in a violent way. I would say it is this line of code [grep -rl “$ohp” /$nhp | xargs sed -i “s+$ohp+$nhp+g”]
To change the current username, you can copy the following section into a text file, make it executable with chmod +x scriptname
and run it with sudo ./scriptname
.
After the reboot every instance of the username will be replaced with your choice.
#!/bin/bash # A script to change the current username set -e # Get current username printf "\nType the current username:\n" read old # Set desired username printf "\nType the desired username:\n" read new # Home paths ohp="home/$old" nhp="home/$new" # Change username printf "\nChanging username\n" for file in group gshadow passwd shadow subgid subuid do sed -i "s/$old/$new/g" /etc/$file* done # Rename home folder mv /$ohp /$nhp # Fix path references in /home for new user printf "\nAdjusting paths in home directory\n" grep -rl "$ohp" /$nhp | xargs sed -i "s+$ohp+$nhp+g" # Set user info echo chfn $new sync reboot
If you want to get your hands dirty for educational purposes or you just like to tinker around, you can also follow the instructions below:
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 stop the phosh process 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.
Now stop the phosh service.
sudo systemctl stop phosh
Next, run the commands to rename your username, home folder, and group.
sudo usermod -l newusername -m -d /home/newusername oldusername
sudo groupmod -n newusername oldusername
Then modify /etc/dconf/profile/user and replace mobian with your new username.
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.
Finally, you can delete your temporary user:
sudo userdel -r temp
Wrapper function for Megapixels postprocess.sh
The wrapper script provides a more readable picture name. Even that the default folder for pictures (Picture) can be used in the language of the user, e.g. in german: “Bilder”. Also the favorite image type, e.g. jpg, can be specified. Then the RAW images are no longer saved in the image folder. After downloading the postprocess.sh.wrapper file, the original must:
The script relies on imagemagick
sudo apt install imagemagick
First be moved from “/usr/share/megapixels/” to “/usr/local/bin/”:
sudo mv /usr/share/megapixels/postprocess.sh /usr/local/bin/postprocess.sh
Then the postprocess.sh.wrapper can be copied to /usr/share/megapixels/postprocess.sh:
sudo cp ~/Downloads/postprocess.sh.wrapper /usr/share/megapixels/postprocess.sh
It is important that the new file is executable:
sudo chmod 755 /usr/share/megapixels/postprocess.sh
Currently the file can be downloaded from @PP_german:matrix.org. A visual impression can be found there.
It is not only worthwhile for the camera app to move the “/tmp” folder to RAM. If not already done, the file “/etc/fstab” must be adapted for this:
sudo echo -e "tmpfs /tmp tmpfs mode=1777,nosuid,nodev 0 0\n" >> /etc/fstab
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 want to also add the terminal. The config is located under /etc/u-boot-menu.d/ and is named after the device used, for example on OG PinePhone:
$ sudo vi /etc/u-boot-menu.d/pinephone.conf
The file should contain the following line (or a similar one):
U_BOOT_PARAMETERS="console=ttyS0,115200 consoleblank=0 loglevel=7 rw splash plymouth.ignore-serial-consoles vt.global_cursor_default=0"
Remove
splash
Add
console=tty1
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:
U_BOOT_PARAMETERS="console=ttyS0,115200 consoleblank=0 loglevel=7 rw plymouth.ignore-serial-consoles vt.global_cursor_default=0 console=tty1"
Apply the changes with:
$ sudo u-boot-update
Phosh, Reorder favorites
Phosh favorites are stored as an array of desktop file name in a gsettings entry :
/sm/puri/phosh/favorites
.
To fetch current favorites array :
gsettings get sm.puri.phosh favorites
after reordering the different element use the following command to set the new favorites order :
gsettings set sm.puri.phosh favorites "['list', 'of', 'favorites']"
Phosh, add an app as mobile friendly in the launcher
Several apps are already mobile friendly but are not categorized as such and therefore do not appear in the phosh launcher unless you tap on “show all apps”.
The method to add an app in the GUI is to open dconf-editor (install it with “sudo apt install dconf-editor” if you don't have it already). Navigate to
/sm/puri/phosh/force-adaptive
and toggle off “use default value”.
Add the name of the desktop file of the app you want to add as mobile friendly (e.g. “im.fluffychat.Fluffychat.desktop”) to the list in “Custom value”
Or, if you want to use the terminal, get the default list of mobile friendly apps
gsettings get sm.puri.phosh force-adaptive
copy the list of apps in an editor and add the one you want, then apply the change with
gsettings set sm.puri.phosh force-adaptive "['your', 'list', 'of', 'mobile-friendly', 'apps', 'im.fluffychat.Fluffychat.desktop']"
It is also possible to get the same result by editing the desktop file for the application under /usr/share/applications
, including the line
X-Purism-FormFactor=Mobile;
Change Default Mobian User
The default user is mobian
. We show here how to change the username to fulanodetal
. We assume you do not want to conserve any files.
The process is somewhat involved because Phosh is hardcoded to log in automatically to the UID to 1000. There is an opportunity for a volunteer to modify the initial login process to allow the user to enter a preferred username.
- Either plug in a keyboard and enter a TTY, or log in using SSH.
- Give the root user a password with
sudo passwd root
- Log out of all shells and log in again as
root
. - Run
systemctl stop phosh.service
. - Try to run
usermod -u 1002 mobian
. This will likely fail, but it will give you the PID for the process blocking this step. Kill that process withkill -9 $PID
where$PID
is the process id that usermod returned. If you are curious, you can find all the processes running under mobian withtop -u mobian
. - After usermod succeeds, run
groupmod -g 1002 mobian
. - Verify that you successfully changed mobian's UID and GID by running
grep mobian /etc/passwd
. You should see the substring1002:1002
. If you see1000:1000
,1000:1002
, or1002:1000
, something went wrong.
If you made it this far, you are able now able to add a new user fulanodetal with UID and GID both being 1000. You may need to reboot twice. If you would like to use sudo from fulanodetal, remember to add yourself to the sudoer group, and consider deleting the root user you made for security. Verify your success by opening a graphical terminal from Phosh. The prompt should be fulanodetal@mobian:~$
.
Access chroot using qemu and jumpdrive
Create chroot-librem5.sh with following values,
#!/bin/sh set -ex MOUNT_DIR=/media/${LOGNAME} ROOT_FS=${MOUNT_DIR}/rootfs BOOT_DIR=${MOUNT_DIR}/boot # if boot partition is not mounted automatically, # you will have to mount it using gnome-disks or # using mount command sudo mount --bind ${BOOT_DIR} ${ROOT_FS}/boot sudo mount --bind /dev ${ROOT_FS}/dev # Needed for systemd-resolved - which should be installed on the host too sudo mount --bind /run ${ROOT_FS}/run cd ${ROOT_FS} # Do this once: # sudo apt install qemu-user-static # sudo cp /usr/bin/qemu-aarch64-static ./usr/bin/ sudo chroot . /usr/bin/qemu-aarch64-static /usr/bin/bash
once booted using jumpdrive, run ./chroot-librem5.sh
Note: these steps are not needed right now as mobian don't have luks disk encryption by default (we can use jumpdrive plus telnet and then chroot), but once luks encryption is enabled, this will be required as jumpdrive don't support luks.