DEV Community

Ai2th
Ai2th

Posted on

Linxr | Part 5 — Live Boot Logs, SAF Storage & Merging Docker

In Part 4, we showcased Linxr booting Alpine Linux in QEMU on non-rooted Android devices. Today in Part 5, we dive deep into the major architectural updates that powered our v3.0.0 release: bringing live serial boot diagnostics, seamless Storage Access Framework (SAF) file sharing, and embedding full Docker container management directly into Linxr.


1. Opening the Black Box: Live Serial Log Streaming

In earlier builds, VM startup was a bit of a black box—users saw a spinning loading indicator until port 2222 opened for SSH. If the kernel panicked or a system service hung during boot, there was no visibility inside the app UI.

To solve this, we redirected Alpine’s kernel console to serial output (/dev/ttyS0):

  • Kernel & OpenRC Logs: Intercepted dmesg, init scripts, and sshd startup logs directly from the guest virtual serial console.
  • Flutter UI Integration: Added a real-time System & VM Logs console widget on the Home Screen with live auto-scroll, search, and copy-to-clipboard actions.

2. Bridging Host & Guest Storage: Virtio-9P + SAF

Linux virtual machines running under QEMU require clean POSIX filesystem access to exchange files with the Android host system.

  • Virtio-9P Passthrough: Configured QEMU's virtio-9p-pci driver to expose host directories to the guest OS, mounting /storage/emulated/0/LinxrShare inside Alpine Linux at /mnt/sdcard.
  • SAF Document Tree Picker: Built a Kotlin MethodChannel handler (pickFolder) calling Android’s Storage Access Framework (ACTION_OPEN_DOCUMENT_TREE) to allow users to select custom host folders from Settings.

3. Merging Pockr: Native Docker Container Dashboard

Previously, container management lived in a separate project named Pockr. For v3.0.0, we unified our architecture by deprecating standalone Pockr and embedding its container controls directly into Linxr:

  • Containers Tab: Inspect running Docker containers, view CPU/RAM usage, and launch containerized microservices (nginx, redis, alpine).
  • Live Container Logs: Stream real-time container stdout/stderr logs from the Docker daemon socket inside the Alpine VM.

4. Hardened Boot Probing & SSH Lock Guard

When launching QEMU, the OpenSSH daemon takes a few seconds to initialize. Probing TCP port 2222 concurrently from Flutter while QEMU bound socket ports caused intermittent race conditions.

We introduced a thread-safe SSH probe lock in Kotlin (VmManager.kt):

  • Suppresses redundant socket connection attempts until QEMU signals full network initialization.
  • Guarantees instant terminal auto-reconnection as soon as the root shell becomes active.

What’s Next?

Linxr v3.0.0 is officially live on Google Play and GitHub Releases!

Join our community for feature requests and discussions:
👉 Google Group: https://groups.google.com/g/ai2th

Top comments (0)