System Services & Customization
headless-phone keeps its Debian 13 (trixie) userspace deliberately small, standard, and transparent. Every customization lives in well-scoped overlay files under /etc/ and /usr/local/, tracked by installed-system-manifest.json and protected by 3-way conffile preservation during os-upgrade.
Systemd Units Reference
Section titled “Systemd Units Reference”| Service | Lifecycle / Type | Enabled by Default? | Role |
|---|---|---|---|
mount-vendor.service |
oneshot, RemainAfterExit=yes (before sysinit.target & cloud-init-local) |
Yes | Parses super LP metadata (SHA-256 verified), mounts /dev/mapper/headless-vendor read-only at /vendor, and runs modprobe for VENDOR_MODULES (bcmdhd4389, AoC, audio, haptics, ToF, GNSS). |
firstboot-setup.service |
oneshot, RemainAfterExit=yes (before network-pre.target) |
Yes | Online resize2fs of /, fallback <codename>-<serial6> hostname if unseeded, fallback ssh-keygen -A. |
charge-limit.service |
oneshot, RemainAfterExit=yes |
Yes | Sets battery charge window (55%–70% default, /etc/headless-phone/charge-limit.conf). |
brownout-guard.service |
simple, Restart=on-failure |
Yes | Monitors battery/charger sysfs and sheds heavy units before brownout (/etc/headless-phone/brownout-guard.conf). |
usb-role.service |
oneshot, StartLimitIntervalSec=0 |
Yes + udev | Switches USB-C between Host/DFP (Ethernet/docks) and Device/UFP (CDC ACM ttyGS0 serial console). |
display-off@.service |
oneshot |
Udev-triggered | Disables connected OLED CRTCs on /dev/dri/card* via DRM KMS. |
mark-boot-ok.service |
exec, retries exit 75 every 15s |
Yes | Marks booted A/B slot successful=1 once ssh.service + global uplink are live. |
bt-init.service |
simple, Restart=on-failure |
Opt-in (disabled) |
Runs bt-ctl attach to download BCM4389 firmware and expose native Linux hci0. Enable with sudo systemctl enable --now bt-init.service. |
docker.service / containerd.service |
Standard Debian/Docker | Yes (INSTALL_DOCKER=1) |
Docker Engine on cgroups v2, OverlayFS, and iptables-nft. |
systemd-networkd, systemd-resolved, ssh, avahi-daemon |
Standard Debian | Yes | Networking, DNS, OpenSSH, and .local mDNS advertisement. |
(Additionally, systemd-backlight@.service is masked to prevent restoring OLED backlight state.)
Systemd Drop-Ins
Section titled “Systemd Drop-Ins”| Drop-In Path | What It Customizes |
|---|---|
/etc/systemd/system.conf.d/10-watchdog.conf |
Sets RuntimeWatchdogSec=30s and RebootWatchdogSec=2min for hardware watchdog hand-off. |
/etc/systemd/system/cloud-init-main.service.d/10-headless-eisdir.conf |
Routes cloud-init through cloud-init-lite --all-stages to prevent the stacked-netdev (wpan0) EISDIR crash. |
/etc/systemd/system/cloud-init-hotplugd.service.d/10-headless-eisdir.conf |
Routes cloud-init hotplug hooks through cloud-init-lite. |
/etc/systemd/system/ssh.service.d/10-wait-cloud-init.conf |
Orders ssh.service After=cloud-config.service so SSH keys and ssh_pwauth apply before sshd listens. |
/etc/systemd/system/systemd-networkd-wait-online.service.d/10-timeout.conf |
Runs systemd-networkd-wait-online --any --timeout=15 so offline USB-only boots never stall for 2 minutes. |
Udev Rules & Hardware Permissions
Section titled “Udev Rules & Hardware Permissions”| Rule File | Effect |
|---|---|
/etc/udev/rules.d/90-headless-display-off.rules |
Triggers display-off@%k.service on add|change for drm_minor (card[0-9]*, excluding connector nodes like card0-DSI-1). |
/etc/udev/rules.d/90-headless-usb-role.rules |
Triggers usb-role.service on typec/udc events and starts serial-getty@ttyGS0.service when ttyGS0 appears. |
/etc/udev/rules.d/90-headless-hw-access.rules |
Sets /dev/kvm to 0660 root:kvm, and locks Exynos MFC DRM-secure V4L2 nodes (DRIVERS=="s5p-mfc", ATTR{name}=="*-secure*", /dev/video8..11) to 0600 root:root so non-root video-group tools never probe secure nodes ahead of /dev/video6..7. |
The default user (pixel) is placed in groups: sudo, dialout, plugdev, kvm, audio, video, and docker.
Networking Customization
Section titled “Networking Customization”Wired Ethernet & Wi-Fi Priority
Section titled “Wired Ethernet & Wi-Fi Priority”- Fallback wired DHCP:
/etc/systemd/network/90-wired-dhcp.networkmatchesName=en* eth*withDHCP=yes,MulticastDNS=no(Avahi handles.local),LLMNR=yes, andSendHostname=yes. - Because it is numbered
90-*, any Netplan configuration under/etc/netplan/(generated as10-netplan-*) automatically takes precedence. - When both wired Ethernet and Wi-Fi are configured via Netplan, wired uses route metric
100and Wi-Fi uses metric600, so plugging in a USB-C Ethernet dock seamlessly takes priority over Wi-Fi. - Unprogrammed Realtek NIC MACs: Some inexpensive bare-board Realtek USB-C Ethernet adapters lack a burned eFuse/EEPROM MAC and generate a random MAC per attach. To pin a stable MAC for DHCP reservations, add a
.linkfile:
[Match]Driver=r8152
[Link]MACAddress=02:48:50:00:01:01Editing Wi-Fi or Static IP After First Boot
Section titled “Editing Wi-Fi or Static IP After First Boot”Edit /etc/netplan/50-cloud-init.yaml (or create a higher-priority /etc/netplan/60-local.yaml) and apply with:
sudo netplan try # Safe 120s auto-revert test over SSHsudo netplan apply # CommitRead-Only /vendor Mount (mount-vendor)
Section titled “Read-Only /vendor Mount (mount-vendor)”mount-vendor parses Android’s super partition directly in Python (validating AOSP liblp geometry and header/table SHA-256 checksums), maps vendor read-only at /dev/mapper/headless-vendor via dmsetup create --readonly, verifies /sys/class/block/<dm>/ro == "1" and the exact DM table, mounts /vendor with -o ro, and loads VENDOR_MODULES configured in /etc/headless-phone/vendor.conf.
If the active slot has no populated vendor extents (common when stock Android lives on _a and Linux runs on _b), it automatically falls back to the opposite slot’s LP metadata.
Configuration Files Summary
Section titled “Configuration Files Summary”| File | Purpose | Preserved on OTA? |
|---|---|---|
/etc/headless-phone/device & device.conf |
Device codename, SoC, and metadata (build-generated) | Managed by OTA |
/etc/headless-phone/bootctrl.conf |
BOOTCTRL_BACKEND, BOOT_DEVICE, BOOTCTRL_ALLOW_BOOTLOADERS |
3-way conffile protected |
/etc/headless-phone/vendor.conf |
VENDOR_MODULES loaded after /vendor mounts |
3-way conffile protected |
/etc/headless-phone/charge-limit.conf |
Custom CHARGE_START / CHARGE_STOP battery thresholds |
Never overwritten (denylisted) |
/etc/headless-phone/brownout-guard.conf |
Brownout guard thresholds, hysteresis, and SHED_UNITS |
Never overwritten (denylisted) |
/etc/headless-phone/update.conf |
Custom default UPDATE_REPO=owner/repo for os-upgrade |
Never overwritten (denylisted) |
/etc/ssh/sshd_config.d/90-headless-phone.conf |
Base SSH policy (PermitRootLogin no, KbdInteractiveAuthentication no; overridden by 50-cloud-init.conf when key-only) |
3-way conffile protected |
/etc/sysctl.d/90-headless-phone.conf |
net.ipv4.ping_group_range = 0 2147483647 (unprivileged ping) |
3-way conffile protected |
/etc/modules-load.d/headless-phone.conf |
Preloads USB-C Ethernet drivers (r8152, r8153_ecm, cdc_ncm, cdc_ether) |
3-way conffile protected |
/etc/tmpfiles.d/90-headless-run.conf |
Ensures /run permissions are 0755 root:root |
3-way conffile protected |
Single-Command Health Check
Section titled “Single-Command Health Check”Run hw-status (or hw-status --json) anytime to audit all 22 onboard hardware subsystems, kernel drivers, /vendor mount, and runtime workers in one shot. See Hardware Overview.