Bypassing Flatpak Sandbox Crashes: Building Native ARM64 Electron Apps on Linux Phones
The Reality of Mobile Linux Dependencies
Moving to Linux for my mobile phone has been full of surprise pain points. Years of using Linux on the desktop did not lend themselves to an easy transition into making Linux work for me on mobile, because I missed one essential truth: my mobile usage patterns are far more dependent on proprietary services than any desktop setup ever was.
This requires pragmatism. How do I maintain access to modern benefits these services bring without losing the Linux ecosystem I want to establish myself within?
One app I have become dependent on is Duolingo. It is by no means the only way to learn languages, and I am exploring other FOSS alternatives in the Linux ecosystem like Anki and PolyGlot. But what Duolingo offers as an integrated learning experience is hard to replicate elsewhere. This is not about ideological purity – it is about practical access to tools that work for me while everything else stays within boundaries I control.
Here is how I built an unsupported Android app natively on the FuriLabs FLX1s running an aarch64 processor, complete with Flatpak pitfalls and Wayland fixes.
The Problem: Zypak, Wayland, and Mobile GPUs
Running a standard x86_64 Linux desktop makes installing Electron-wrapper apps simple. Open your software center, grab the Flatpak from Flathub, or download an AppImage directly from the developer’s GitHub releases, and you are good to go.
Daily-driving a Linux phone on an aarch64 processor changes things. Recently I wanted dl-desktop – an open-source desktop client for Duolingo – running on my FLX1s. There is no official ARM64 Flatpak build, so I decided to compile the Flatpak myself from source.
The result: an immediate segmentation fault caused by zypak-wrapper.
When you run a Chromium-based app (like Electron) inside a Flatpak, it uses a specialized sandbox called Zypak. On certain ARM64 devices utilizing Mali GPUs and modern Wayland compositors, Zypak fundamentally panics when trying to initialize EGL graphics drivers through the container. Passing --disable-gpu or --no-sandbox flags does not help because Zypak crashes before the app even reads them.
The Solution: Build a Native .deb Instead
The cleanest way through this obstacle is to strip away the Flatpak container entirely. By building and installing a native Debian package, the Electron app talks directly to your Wayland compositor and GPU without a middleman breaking the connection.
Here is how to pull the source code and build it natively on your ARM64 device.
Step 1: Install Build Dependencies
sudo apt update
sudo apt install git nodejs npm
electron-builder has a known bug on ARM64 where it tries to download an Intel (x86_64) version of fpm to pack the Debian file, which crashes on your phone. Bypass this by installing fpm natively through Ruby:
sudo apt install ruby ruby-dev build-essential
sudo gem install fpm
Step 2: Clone and Install Dependencies
Pull down the source code for dl-desktop and install its Node dependencies:
git clone https://github.com/hmlendea/dl-desktop.git
cd dl-desktop
npm install
Because you are running this natively, npm automatically fetches the correct ARM64 binaries for Electron.
Step 3: Build the .deb Package
Tell electron-builder to ignore its broken downloaded version of fpm and use the native system package you installed in Step 1:
USE_SYSTEM_FPM="true" npx electron-builder --linux deb --arm64
Give it a minute to compile. Once it finishes, the new native package sits waiting inside the dist/ or out/ folder.
Step 4: Install
sudo apt install ./dist/dl-desktop*.deb
Done. That was easy. But wait – there is one more step for smooth execution on a mobile Linux phone.
The Wayland Fix: Native Display Integration
Mobile Linux relies on Wayland, and XWayland Electron apps sometimes look blurry or fail to trigger the on-screen keyboard. Force the app to run in native Wayland mode by editing its .desktop shortcut file:
sudo nano /usr/share/applications/dl-desktop.desktop
Depending on the app, this might be located in ~/.local/share/applications/ instead. Find the line starting with Exec= and append --ozone-platform-hint=auto:
Exec=/opt/dl-desktop/dl-desktop --ozone-platform-hint=auto %U
Save the file (Ctrl+O, Enter, Ctrl+X in nano).
You can now launch the app directly from your app drawer. By bypassing Flatpak and compiling a native package, you sidestepped the Zypak segmentation faults entirely while retaining hardware-accelerated performance on your ARM64 device.
The Bigger Picture: Pragmatism Over Purity
This guide solved one specific problem with dl-desktop, but it applies to any Electron-based desktop app you want running natively on Linux phones or other ARM64 devices that do not have Flatpak builds available. When the container gets in the way, building from source is a better path forward.
Flatpak exists to solve real problems: sandboxing, reproducible builds, and runtime dependency isolation. But when the container becomes an obstruction instead of a solution, knowing how to work around it means you do not have to choose between your favorite tools and your preferred platform. On mobile Linux especially, that flexibility matters.
Relevant Links
- The dl-desktop GitHub Repository: https://github.com/hmlendea/dl-desktop
- Flathub (for x86_64 users): https://flathub.org/apps/com.github.hmlendea.dl-desktop