How to share files between a mobian device and another computer

mtp

mtp is the technology which Android and other devices use in order to transfer files to and from the computer (showing up in the file manager). There is such a thing available in the package umtp-responder which you can install if you are aware of what you are doing and how to configure it. Mobian did install it for a while but stopped doing so, as this was not deemed a safe enough solution. For instance, it automatically allowed anyone who plugged in the phone through a USB cable to get all files from the phone without the need to authorize. New files were owned by the root user. Mobian wants to bring back a mtp solution, but only when it is secure and convenient. However, as we said: power to the people, the package is there and available.

sftp

In case you have a SSH server running, you can access your file system via sftp://. If you want to connect from a Linux desktop, entering the URL sftp://mobian@mobian (adapt if your hostname/IP address differs) in your file manager should allow to browse the file system with the same permissions as user mobian has. This should work from any reasonable Linux computer. If you are connecting from a Windows computer you may require additional software such as in order to connect (pls verify and correct!)

Alternatively you can also enter this into the terminal to use sftp. (adapt these commands to your IP or hostname.):

If you have a custom port setup you may need to enter:

Syncthing

Syncthing is available in Debian and it can be used to synchronize folders/files as long as two devices are connected to a network. It can work locally or use relays to circumvent NATs etc... Their documentation on getting started is reasonable and it is not too difficult to set synchronization up.

You only need to run syncthing in case you want to keep stuff synchronized, if you want to automatically start syncthing on login and keep it running, you could do so by issueing (but keep in mind this will continuely consume resources and keep your phone busy):

It allows 1-way synchronization or 2-way synchronization of selected folders. syncthing needs to be started before it does its thing, so it might be useful to add a desktop button to start the service (unless you always want to have it autostarted, which you perhaps do not want). While syncthing runs, it can be configured using a nice web interface. Alternatively, there exist a number of GUIs available as frontend.

syncthing-gtk works better than the web UI on the ?PinePhone and it's packaged in Debian with the same name.

Cloud solutions (Nextcloud/WebDAV)

One workaround is to use an intermediary cloud storage solution that can be accessed by both devices. For instance WebDAV/Nextcloud instances can be integrated through the Online Accounts feature and GNOME Files (nautilus) will be able to mount and use these accounts.

nc

Geek bonus points if you actually use the swiss army knife of network tools:

How to customize on-screen keyboard

Mobian ships the Squeekboard on-screen keyboard by default. As of June 2023, squeekboard is temporarily not in Debian/trixie, though it remains available in Debian/bookworm. phosh-osk-stub is an alternative on-screen keyboard that you may try.

Squeekboard's layouts are easily customizable by adding keyboard description files to

and updating gsettings if the language is new.

When on a tablet, or on a phone with a scaling factor of 100%, Squeekboard will seek for an additional layout named (us|de|...)_wide.yaml (and terminal_wide.yaml, emoji_wide.yaml for version below 1.12).

Instructions

The Squeekboard keyboard description file format is not well documented as of Oct 2023, but customizing is not difficult. Take an existing layout and start tweaking it. Then give it the correct name and put it in the user's Squeekboard keyboard directory.

A tutorial on how to contribute to Squeekboard can be found here. A long forum thread with the developer of Squeekboard with useful background information is here.

How to use mobile data

If your correct provider settings do not show up in Settings >> Mobile >> Mobile Data >> Access Points, you can add a new one with the [+] button. Add a network name and your APN. The correct settings depend on your provider. If mobile data does not work, make sure that the "mobile data" toggle is turned on (this happens more often than you would think).

How to send/receive MMSes

MMSes should work, but may need manual APN switching for some mobile service providers. The mmsd-tng is the daemon intended to send and receives MMSes.

As of October 2024, if your mobile provider has different APNs for generic internet data versus MMSes, then you can wait for NetworkManager bug #958 to be solved, or you can switch APNs manually between using only mobile data or only MMSes:

How to connect to the Mobian device

Alternatives to using phosh (whether phosh is running or not) include a tty screen or an ssh connection.

Connect over a tty with a docking bar

If you have a docking bar from the PinePhone convergence package or for the PinePhone-Pro, then you can plug the docking bar to the USB-C port and an ordinary USB keyboard into the docking bar. Then the usual Ctl-Alt-F2 or Ctl-Alt-F3 or ... Ctl-Alt-F6 should give you a standard GNU/Linux tty login prompt; Ctl-Alt-F7 should return you to the phosh login screen.

Connect to a running SSH server

This section explains how to connect to your Mobian device using an ssh server that you have installed on it. You should set your ssh server to not allow logins via the numeric password if you want to remain safe. See instructions for this below.

Connect over Wi-Fi

If your device is connected to your local Wi-Fi and you have an SSH server running, try to access it with ssh mobian@mobian. If that does not work out (e.g. because your network assigned the device a different hostname, you will need to find out the hostname/IP address to connect to.

Connect over a USB-C cable connected to a computer

It's possible to connect to Mobian device with a similar end result as using adb shell with an Android device, but using the USB-C connection and SSH instead. When connecting a Mobian device to a Linux computer via the USB-C connection, a network interface is made available to the computer, and utilizing udev and NetworkManager an IP address is assigned to both. This allows connecting to Mobian via a hardwired SSH session, instead of having to rely on Wi-Fi (which may not be 100% reliable).

Network overlap with 10.0.0.0/8

When connecting a Mobian device to a computer via USB-C, Mobian is configured to use the IP address 10.66.0.1, in the subnet 10.0.0.0/8. This can cause an issue if Mobian is also connected to a Wi-Fi network which utilizes a subnet within the same 10.0.0.0/8 subnet. The configuration of the USB connection //could// be changed to use a different or smaller subnet, //or// a more specific route can be configured for the Wi-Fi connection to account for this special case. Here is how to add a persistent more specific route.

How to share your connection/tether

It is possible to share your phone's mobile data with another device. Either create a Wi-Fi hotspot that others connect to, or use a USB cable to forward data.

Sharing mobile data through a Wi-Fi hotspot

Visit the settings -> Wi-Fi. The "3 dot" menu will offer a "Turn On WiFi Hotspot..." entry, which is all that you should need to create a hotspot.

Stop the hotspot from the Wi-fi page in the settings app.

How to use SSH with a key instead of password

When you have SSH enabled on your phone, it is a good idea to use key-based authentication instead of password-based authentication. This is especially true in the case of numerical passwords only!

On your mobian phone install openssh-server:

If you don't have already have a private/public key pair on the device you want to access the phone from (say your desktop or laptop), you want to first generate one. Assuming you're using linux or something similarly unix-compatible:

You should probably secure your key with a password. Now copy your public key to the phone. Again assuming linux or similar, and that the phone is accessible using the name mobian on your local network:

Check the man pages for the commands if you want to know more about the options. If you are using PuTTY then the process will be somewhat different.

You should now be able to log in via SSH using the key rather than the password for the user on the phone. If you specified a password for the key you will be asked for that password.

Once you know login works with the key you can change the sshd configuration on the phone to disable access using the phone user's password, and optionally change the port it listens on. Search for PasswordAuthentication in /etc/ssh/sshd_config and change it to PasswordAuthentication no.

Or run this command:

Also it's good to use an uncommon port for SSH to reduce noise and battery usage caused by SSH scanners on the Internet (in case your device is accessible remotely from the Internet).

Change 45673 to any port that isn't already being used. Note that you will have to specify this port when connecting to the phone via ssh in future, usually with the -p option.

Finally on the phone restart the sshd so that it will use the settings you just changed:

Extra note:

If you have secured your SSH key with a password and don't want to bother retyping the password for every time you reconnect with SSH, you can run:

Now you should not be prompted to enter your password (as long as you are running ssh from the same environment/terminal).

How to use disk encryption

Disk encryption is currently available through the Mobian Installer. This image can be found in the installer directory of the download page for your device. For the PinePhone for example, this is https://images.mobian-project.org/pinephone/installer/.

How to enable shuffled keypad on the lockscreen

The keypad on the login screen has a fixed layout by default. If you want it to make it harder for an observer to guess your password (by watching your fingers), you could do this by shuffling the keypad.

The setting can be adjusted using phosh-mobile-settings (in the Lockscreen panel) or by running the following in a shell

gsettings set sm.puri.phosh.lockscreen shuffle-keypad true

However, this is only for the lockscreen, not for the initial login following a reboot, which is managed by greetd. As of 2024-05-19, a hack for the initial greeter through phog (the greeter for phosh) in Debian/trixie is to replace the line

   if (shuffle) {

of src/keypad.c of phog by

   if (1) {

then rebuild the package and install the rebuilt package in replacement of the original Debian phog.

How to check if a package has privacy issues

Some packages in Debian (and thus Mobian) have known privacy issues. Check their list for details.

How to install Japanese IME (Google free)

Summary

With the following Japanese IME(input method engine) fcitx-kkc you can input Japanese on your mobile device same like your computer.

Description

To enter Japanese Kana or Kanji, default Users will use Google "mozc" as input method. But there are tracking free method available. It's called KKC or "Kana Kanji". It does nothing more than convert the entered kana into kanji and it uses some dictionaries for that. It is very powerful and fast too. The current installation of default IME for Japanese is fcitx-kkc, which can be used on your computer also.

Preparation

Make sure you have installed Japanese fonts. This fonts are needed to write and read Japanese contents on your mobile device.

Installation

The following sequence must be observed during installation. You can do this in your "King's Cross" or by SSH.

(Thereby a lot of further dependent data is installed. In total about 130MB.) Perform a reboot. This will prepare the keyboards for "Fcitx", this cannot be done manually, so a reboot is inevitable.

Setup

After the restart 2 new icons of "Fcitx" are integrated, but these should not be started from the mobile device directly. Instead we use the command prompt via "King's Cross" (do not use SSH, this will not work).

A window opens in which a keyboard is already included. This keyboard should not be deleted! Using the + sign to add another keyboard. A list with a large number of keyboard layouts appears, which we ignore. The checkbox "Only Show Current Language" must be removed. In the search you enter "kkc" and the keyboard "Kana Kanji" appears. Select it and click on "OK". You come back to the list and now 2 keyboards are shown.

Now to activate the layout for the Japanese language. In the still opened window there are further tabs. There you click on "Global Config". In this tab there is a button called "Trigger Input Method" and currently the default is "Ctrl+Space". But "Ctrl+Space" is not comfortably to use on your mobile device, therefore let's change to another trigger like "Ctrl+Lalt". For this we click the button "Crtl" and hold it pressed, additionally we press the left "Alt" key. Now release both keys. The button should have changed to "Ctrl+Lalt".

The X on the window to closes it and we return to King's Cross. Now the Japanese input can be tested directly via an external keyboard or via the virtual keyboard.

How to use

There 2 ways

For a mechanical keyboard:

To activate the Japanese input, simply hold down Ctrl and press the Alt key. The message "Kana Kanji" appears briefly, so we know that the Japanese keyboard is active.

With a virtual keyboard:

The Terminal Keyboard should be used to activate it. First press the "Ctrl" key and then the "Alt" key

How to run Android apps via Waydroid

Waydroid is not currently packaged within the main repos. To install it, follow the instructions here.

After installing, initialize the container by running

sudo waydroid init

This command should only be run once.

Starting Android

To start android, find the deskop icon that says "Waydroid". If you are a phosh user, this may be hidden in the desktop only section in the app drawer. To fix this, add X-Purism-FormFactor=Mobile; to ~/.local/share/applications to bring it to the mobile friendly section.

To shut it down, run waydroid session stop.

Note: if you are opening Waydroid, make sure the on screen keyboard is not on screen while you wait for it to open. Otherwise, the screen will only occupy the space left by the keyboard, and the only way to fix it is to restart Waydroid.

Tweaks

Hide android apps in phosh

To hide an app in the Phosh app drawer, one needs to add NoDisplay=true to the [Desktop Entry] section of the app's .desktop file.

This function does this for you (when given the .desktop file's name as its parameter):

hide_desktop_app() { sed -iE '/NoDisplay=true/d;/\[Desktop Entry\]/,/^$/{/^$/i NoDisplay=true
}' "$1"; }

Note that the newline between =true and } is required. It is not just line-wrap.

You can then use it to hide all the waydoid launchers, thus:

for i in ~/.local/share/applications/waydroid*desktop; do hide_desktop_app $i; done

To be more selective, you can use whichever of these you want:

        # Calculator
        hide_desktop_app ~/.local/share/applications/waydroid.com.android.calculator2.desktop
        # Contacts
        hide_desktop_app ~/.local/share/applications/waydroid.com.android.contacts.desktop
        # Clocks
        hide_desktop_app ~/.local/share/applications/waydroid.com.android.deskclock.desktop
        # Files
        hide_desktop_app ~/.local/share/applications/waydroid.com.android.documentsui.desktop
        # Gallery
        hide_desktop_app ~/.local/share/applications/waydroid.com.android.gallery3d.desktop
        # Music
        hide_desktop_app ~/.local/share/applications/waydroid.org.lineageos.eleven.desktop
        # Browser
        hide_desktop_app ~/.local/share/applications/waydroid.org.lineageos.jelly.desktop
        # Recorder
        hide_desktop_app ~/.local/share/applications/waydroid.org.lineageos.recorder.desktop
        # Calendar
        hide_desktop_app ~/.local/share/applications/waydroid.org.lineageos.etar.desktop
        # AOSP keyboard
        hide_desktop_app ~/.local/share/applications/waydroid.com.android.inputmethod.latin.desktop
        # Camera 
        hide_desktop_app ~/.local/share/applications/waydroid.com.android.camera2.desktop

The following you might not want to remove, though it is up to you.

        #Android Settings
        hide_desktop_app ~/.local/share/applications/waydroid.com.android.settings.desktop

Disable suspend within Waydroid

If you are experiencing problems due to suspend within Waydroid, the following will disable it:

        waydroid prop set persist.waydroid.no_suspend true
        waydroid prop set persist.waydroid.suspend false

Add app icons to manage waydroid sessions

You may find yourself needing to stop your waydroid session as often as you start it to conserve battery life. If you want to add a desktop icon to do this for you, use the following stopwaydroid.desktop file.

 [Desktop Entry]
 Type=Application
 Name=Stop Waydroid
 Exec=waydroid session stop
 X-Purism-FormFactor=Mobile;

You can add an optional Icon=... line if you want to add an icon to the entry.

If find that the android apps that you install are not being populated in the mobile friendly section of your app drawer in phosh, you can make the following updateandroidapps.desktop:

 [Desktop Entry]
 Type=Application
 Name=Update Android
 Exec=sed -i `/Icon/s/^/X-Purism-FormFactor=Workstation;Mobile;\n/` ~/.local/share/applications/waydroid.*
 X-Purism-FormFactor=Mobile;

You can add an icon like the previous one if you wish.

How to use the phone as an alarm

As of September 2023, you can use wake-mobile, which is a proof-of-concept alarm that uses systemd timers. You need to remain logged in for this to work.