Using a phone as a server
This guide explains how to make a phone into a minimal home server over Wi-Fi, similar to a SBC. Other devices with different form factors may also work.
Initial setup
Select console, buffyboard or fbkeyboard as the UI.
Connect to a Wi-Fi
This must be done on the device itself, either by SSH over USB or with an on-screen keyboard.
$ nmcli device wifi connect {YOUR_WIFI_SSID} --ask
Check the local IP address
After connecting to your Wi-Fi, check the local IP adress for remote SSH connection. Consider setting up a DMZ or a port forward in your router with the IP associated to your device if you want to host services exposed to the Internet. (e.g. HTTP, E-mail, game server, etc.)
$ ip address
Optional steps
Turn off display backlight
| WARNING: Do not do this unless SSH access is confirmed to be working. |
Unlike dedicated server hardware, devices with a mobile form factor typically have an embedded non-removable panel. It can be annoying for those who dislike the bright TTY login screen constantly shown. You can set the backlight brightness to zero to get rid of it and reduce power consumption.
First, you need to know the name of the backlight class. On a Google Pixel 3a XL (google-bonito), the output is ae94000.dsi.0. This can vary between devices.
$ ls /sys/class/backlight/
Create a shell script called nobacklight and make it executable.
$ cd /usr/local/bin
$ sudo vi nobacklight
$ sudo chmod +x nobacklight
#!/bin/sh
sleep 2
echo 0 > /sys/class/backlight/ae94000.dsi.0/brightness
Check if it works well.
$ sudo nobacklight
Now create a systemd system service to run it automatically.
$ cd /etc/systemd/system
$ sudo vi nobacklight.service
$ sudo systemctl daemon-reload
$ sudo systemctl enable nobacklight
[Unit]
Description=Turn off display backlight
After=basic.target
[Service]
Type=oneshot
ExecStart=/usr/local/bin/nobacklight
RemainAfterExit=yes
[Install]
WantedBy=multi-user.target
Done! It may look like the phone is dead afterwards, but you can still access it via SSH like a remote server. If you want to use the TTY again, simply disable the systemd service.
Backlight to 0 is fine aesthetically but the panel will continue to consume a good amount of power. If you want to poweroff the panel and related regulator you can use:
$ sudo sh -c 'setterm --blank force --term linux </dev/tty1'