Skip to content

feat(desktop): Linux arm64 .deb for DGX Spark in the desktop release - #440

Merged
Brooooooklyn merged 15 commits into
mainfrom
feat/desktop-linux-arm64
Nov 29, 2026
Merged

Brooooooklyn merged 15 commits into
mainfrom
feat/desktop-linux-arm64

Conversation

@Brooooooklyn

@Brooooooklyn Brooooooklyn commented Nov 29, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Adds a Linux arm64 build of Portato (the desktop app) for NVIDIA DGX Spark to the desktop release pipeline. The release now has a .deb and a Linux update feed.

desktop-release.yml
 ├─ linux        (ubuntu-22.04-arm)  build addon with CUDA 13.0 → package app → Portato-<v>-linux-arm64.deb
 │                                    + latest-linux-arm64.yml, verify-linux-bundle.ts gate
 ├─ linux-smoke  (ubuntu-24.04-arm)  apt install → AppArmor check → headless launch (smoke switch) → apt remove
 └─ publish      needs windows + macos + linux; seven-asset gate
  • Dynamic CUDA link. The addon links libcudart.so.13, libcudnn.so.9 and libcuda.so.1 from the system. DGX OS ships them, so the .deb bundles no CUDA.
  • Install. The package installs to /opt/Portato with a portato command, a launcher entry and an AppArmor profile. Chromium's sandbox needs the profile on Ubuntu 24.04.
  • Updates on Linux are notify-only. LinuxFeedUpdater checks latest-linux-arm64.yml and never downloads or installs. The tray shows Download Portato <version>…, which opens the release page. The user runs sudo apt install ./Portato-<v>-linux-arm64.deb. No in-app pkexec/dpkg, so the app never runs root code from a file that the user can write.
  • Packaging probes on a GPU-less runner. CI has no driver, so the probes get the toolkit's stub libcuda.so.1 through LD_LIBRARY_PATH. This is Linux-only and is set only when --driver-lib-dir is given. The shipped app never sets it.
  • Agent. The bundled agent is found in the Electron resources/app layout.
  • The linux and linux-smoke jobs use no environment and only GITHUB_TOKEN, so a dry run works from any branch.

Verification

  • Dry run 46231879921: Package Linux ARM64 ✅ and Install and launch Linux ARM64 ✅. The macOS and Windows jobs do not start from a branch, because the desktop-release environment allows only main and v* tags.

  • I installed the dry-run .deb on real hardware: an RTX Spark N1X (sm_121, the same as DGX Spark), Ubuntu 24.04 WSL, CUDA 13.4.

    Check Result
    sha512 against latest-linux-arm64.yml match
    sudo apt install ./…deb ok, /usr/bin/portato → /opt/Portato/portato
    ldd on the addon every CUDA library resolves
    addon in the app's Electron backend=cuda, 64×64 matmul correct
    app launch (WSLg, smoke switch) [mlx] smoke: control panel brokered, exit 0
    apt remove + purge no files left
  • yarn typecheck and yarn lint pass. vp test on packages/desktop/__test__ and packages/agent/__test__: 969 passed, 3 skipped.

  • A real DGX Spark run of the first release is still open.

Review decisions (no change)

  • The AppArmor userns grant also covers ELECTRON_RUN_AS_NODE. The profile is the one electron-builder installs, and Ubuntu ships the same type for Electron apps. Splitting the CLI runtime from the GUI binary is a separate project.
  • The postinst overwrites /etc/apparmor.d/portato. The postinst copies the profile only after apparmor_parser --skip-kernel-load accepts it. Older AppArmor rejects abi/4.0, so a conffile would break apparmor.service there. Admin edits go in /etc/apparmor.d/local/portato (include if exists), which the package never touches.
  • The smoke test can pass with a blank Control Panel. The test checks that the sandboxed renderer and the preload start, which is the Linux-specific risk. A missing SPA chunk is a build problem on all platforms.

🤖 Generated with Claude Code

Brooooooklyn and others added 15 commits November 29, 2026 15:21
`Portato-<version>-linux-arm64.deb` is spelled once and parsed back, like
the DMG, ZIP and Windows installer names, and `assertVersionsAgree` now
checks it. `debPackageVersion` maps a semver prerelease separator to `~` so
dpkg orders `0.0.26~rc.1` before `0.0.26`.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
The Linux package ships `mlx-agent` at `/opt/Portato/resources/native`,
beside `resources/app`, not under a macOS `Contents/Resources/app` anchor.
The lookup still returns only a file that exists, so the Windows layout,
which ships no agent, is unaffected.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
`verifyBundledCli` takes the executable, resources directory, addon name
and platform instead of hard-coding the macOS `.app` layout; package.ts
passes today's values. `verifyPackagedCoreAddon` loads `@mlx-node/core`
from the packaged app through `MLX_CORE_NATIVE_LIBRARY_PATH`, calls
`getRuntimeCapabilities()` and accepts only `cuda` or `cpu`. An optional
driver library directory lets a runner without the NVIDIA driver resolve
the addon's NEEDED `libcuda.so.1`.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
The black macOS template disappears on Ubuntu's dark top bar, and
Electron Packager sets no window icon on Linux. make-icons.ts now also
writes `icon.png` (512px), `tray.png` (24px) and `[email protected]` (48px) from
the square Windows tile, and stage-app stages exactly those three on
Linux. The generator is deterministic: no committed output changed.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
linux-payload.ts resolves the addon (40 MiB floor), the three NVRTC
header trees beside it, the SPA and the built app, and checks a packaged
app's native payload. No CUDA library is collected: the device's system
CUDA provides them.

verify-linux-bundle.ts is the Linux twin of verify-bundle.ts: required
files, every ELF is AArch64 (read from the header in TypeScript), the
addon's dynamic section under the same rules as ci.yml, no bundled CUDA
runtime, no build-machine RUNPATH/RPATH, and with --runtime the CLI,
agent, native-module and core-addon probes. The parsers are line parsers
with captured readelf output as fixtures.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
linux-deb.ts packs the Electron Packager output under /opt/Portato with
a /usr/bin/portato symlink, a desktop entry and a hicolor icon, using
dpkg-deb --root-owner-group. The maintainer scripts follow
electron-builder's: chrome-sandbox is setuid only where user namespaces
do not work, and an AppArmor profile grants the app userns where
AppArmor accepts it. postrm acts on remove/purge only.

Depends is electron-builder's Electron list with the Ubuntu 24.04 t64
names first and the 22.04 names as alternatives, plus libblas3 and
liblapack3, which the addon links. CUDA is not a dependency: the
device's system CUDA provides it.

verifyLinuxDeb reads the package back (fields, maintainer scripts,
file list, root ownership, no CUDA library, nothing outside /opt/Portato
and the launcher entries).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
package-linux.ts is the Linux twin of package-windows.ts: it stages the
addon, the three NVRTC header trees and the bundled agent into native/,
stages the JS closure with the Linux icons, runs Electron Packager for
linux/arm64 with the `portato` executable, writes the AppArmor profile
and (with --release) app-update.yml, checks the packaged CLI, native
modules and core addon, then builds and verifies the .deb and writes
out/linux-package-result.json.

--release requires the agent and its tag and stamps autoUpdates, as
--sign does on macOS. --driver-lib-dir lets the core-addon probe resolve
libcuda.so.1 on a build machine without the NVIDIA driver.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
update-artifacts.ts writes latest-linux-arm64.yml from the final .deb
(streamed sha512 and size, no blockmap, no minimumSystemVersion, which
electron-updater would compare with the kernel version on Linux).
generate-update.ts gains a --deb mode; check-release.ts resolve emits
linux_deb_name and a new verify-linux command ties the packaged app,
the .deb name and its control fields to the tag and manifest.

publish-release.ts takes --linux-deb and --linux-manifest, and the
publication gate now requires all seven assets: a release without the
Linux feed would break update checks for every installed Linux client.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
On Linux arm64 the app loads mlx-core.linux-arm64-gnu.node, uses the
colored tray.png for the tray (a black template vanishes on Ubuntu's
dark top bar) and icon.png for the window, which Electron Packager does
not set on Linux. nativeRuntimeDir stays null: the addon links the
system CUDA through its RUNPATH.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Stable Linux arm64 release packages now take part in the update feed
through electron-updater's DebUpdater, whose own update-downloaded is
the "payload staged" event. Two updater options keep macOS unchanged:
installOnPlainQuit (Linux false: dpkg -i needs an administrator
password, which must follow the user's Restart to Update, not a quit)
and isSystemSupported (Linux true: electron-updater would compare the
feed's minimumSystemVersion with the kernel version).

MLX_DESKTOP_SMOKE=1 skips the app and agent update checks, and on the
first brokered Control Panel prints "[mlx] smoke: control panel
brokered" and quits normally, for the release workflow's headless
launch.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
`linux` (ubuntu-22.04-arm) builds the addon with ci.yml's CUDA 13.0 SBSA
toolchain, packages the .deb with --release, runs the bundle gate with
the runtime probes, ties versions together with verify-linux, writes
latest-linux-arm64.yml and uploads both with their SHA-256 digests.
The toolkit's libcuda stub stands in for the driver library the addon
links, for the core-addon probe only.

`linux-smoke` (ubuntu-24.04-arm) checks the digests, installs only the
CUDA runtime libraries plus cuda-compat, turns the AppArmor user
namespace restriction on, installs the .deb with apt, checks the
installed tree (version, launcher, desktop entry, ldd, AppArmor
profile), runs the gate on /opt/Portato, launches the app headless
with its sandbox until the Control Panel is brokered, and uninstalls.

Neither job uses the desktop-release environment or any secret beyond
GITHUB_TOKEN. `publish` now needs both, checks the Linux commit,
version, package name and both digests, and uploads seven assets.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
The first dry run failed in package-linux.ts: `mlx download dataset
--help` loads the Linux addon, which links libcuda.so.1, but the CLI
probes ran with only PATH and HOME, so on the GPU-less runner the
addon could not load ("Cannot find native binding"). Only the separate
core-addon probe received --driver-lib-dir.

driverLibraryEnv() now adds LD_LIBRARY_PATH to every probe subprocess
that can load the addon: `agent --version`, each `download --help`, the
native-runtime probe and the core-addon probe. Linux only, only when a
directory is given; the shipped app and its CLI launcher never set it.
package-linux.ts and verify-linux-bundle.ts pass the directory through,
which also covers the linux-smoke gate.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
DebUpdater verifies the .deb in the user's cache, then hands that same
user-writable path to `pkexec dpkg -i`: another process of the same
user can swap the file in between and have root run its maintainer
scripts behind the user's password prompt. Its `apt-get install -f`
fallback also reports success after a cancelled or failed dpkg.

On Linux the app now only checks latest-linux-arm64.yml, through a
LinuxFeedUpdater that keeps electron-updater's provider, rollout and
version rules but never downloads or installs. A newer release shows
as "Download Portato <version>…" in the tray, which opens its GitHub
release page; the user installs it with `sudo apt install`. The feed
and the seven-asset publish gate stay. DebUpdater is no longer
constructed, and its test is replaced by one that runs the real check
and asserts downloadUpdate and quitAndInstall are never called.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@coderabbitai

coderabbitai Bot commented Nov 29, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 4ce85ef4-4361-4c7d-8412-8f97d93c68bc

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • Trigger review
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 29, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-29T07:24:57.250953Z 5c08a42 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@Brooooooklyn
Brooooooklyn merged commit 97fa480 into main Nov 29, 2026
21 checks passed
@Brooooooklyn
Brooooooklyn deleted the feat/desktop-linux-arm64 branch November 29, 2026 08:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant