An experiment running ROS 2 Lyrical Luth (arm64) on unkernel, the Linux kernel compiled to WebAssembly. It runs under Node.js, and it can also be published as a web page that runs entirely in the browser.
Demo: https://unkernel-lyrical.pages.dev/ (tested with desktop Chrome; the page checks for what unkernel needs, such as WebAssembly JSPI. The first boot downloads about 10 MB of kernel and reads about 100 MB of the image on demand).
unkernel ships Alpine and Debian distros only.
This project converts the root file system of the official Docker image ros:lyrical-ros-base (arm64, built from Ubuntu 26.04 packages) into an unkernel distro image (file system label kwroot).
Nothing arm64 runs on the host, so qemu binfmt is not needed.
- Docker: pulls and exports the image, and runs
mke2fsandmkfs.erofsin an amd64 container. - Node.js 24 or later (unkernel's
engines); tested with Node.js 25.9.0. The scripts are TypeScript, which Node runs directly (type stripping, stable since 25.2), so there is no compile step. - pnpm (
packageManagerinpackage.json; tested with 12.22.0).pnpm-workspace.yamlallows the build scripts of esbuild and workerd (wrangler's dependencies), and exempts the pinned unkernel release from pnpm's minimum release age. - Google Chrome, for the browser test (
scripts/browser-test.tsdrives it through playwright-core).
pnpm install # also installs wrangler, used by scripts/publish.sh
./build.sh # builds out/ros2-lyrical-arm64.{erofs,ext4} (about 4 minutes)
scripts/run.sh # interactive shell under Node; Ctrl-] quits; changes persist in out/data.img
node scripts/smoke.ts # ROS 2 checks under Node (exits 1 on failure)
node scripts/colcon.ts # ros2 pkg create -> colcon build -> run, inside the guest
pnpm dev # the page at http://localhost:5173/
node scripts/browser-test.ts # checks the page in headless Chrome
pnpm typecheck # tsc for scripts/ and web/scripts/smoke.ts and scripts/colcon.ts take environment variables:
DISTRO: an image file.smoke.tsalso accepts an http(s) URL.DATA: the data disk;noneruns without one.MEM: guest memory in MiB (default 3072).
If out/data.img does not exist yet, create it once with scripts/run.sh --timeout 60 --input '{8}poweroff\n'.
docker exportthe arm64ros:lyrical-ros-baseand apply unkernel's changes to it in an amd64 container (scripts/stage.sh).- Boot that image on unkernel and
apt-get installtheBAKE_PKGSinside the guest (default:ros-lyrical-demo-nodes-cppandros-lyrical-demo-nodes-py). The files the install changed in the overlay's upper layer come out as a tar (scripts/bake.ts), the same way unkernel builds its Debian image. - Merge that tar and write two images:
.erofs: 274 MB, zstd-compressed, for the web. unkernel's kernel cannot read lz4-compressed erofs..ext4: 1.4 GB, uncompressed, for Node.
| Check | Node (3 GiB of memory) | Chrome 156 (headless, memory chosen by the SDK) |
|---|---|---|
| Boot to the first prompt | About 7 s to the first vm.exec completing (includes waiting for DHCP) |
4.4 s (image served from a local server) |
| C++ talker → listener | 11 of 11 messages received, with discovery range SUBNET (the default) and LOCALHOST |
5 messages 8 s after pressing the button |
ros2 run and ros2 topic list --no-daemon |
ros2 topic list alone takes about 10 s |
/chatter shown 19 to 25 s after typing the command |
colcon build of one ament_cmake and one ament_python package from ros2 pkg create (scripts/colcon.ts) |
Both built in 37 s, and the built nodes ran. Same with ext4 and a data disk as with erofs, no data disk and 2 GiB of memory | Not tried |
HTTP Range reads, whole session (boot, demo, ros2) |
106 MB in 231 requests | 101 MB in 216 requests |
- In the browser, both a cross-origin isolated page (the kernel runs in a Web Worker) and a page that is not isolated (the kernel runs inline) work.
- The page boots on load and keeps the root file system's changes (the home directory, installed packages, a colcon workspace) on a persistent data disk in the browser: in OPFS when the kernel runs in a worker, else in IndexedDB. One tab at a time holds it (a Web Lock); another tab boots without it. Reset disk erases it, and
?persist=0boots without it.scripts/browser-test.tschecks, with either store, that a file survives a reload, that a second tab starts without the disk, and that Reset disk erases it. - The browser's HTTP cache does not keep the image's Range reads: a second visit fetched the same 47 MB in 109 requests again. A service worker (
web/src/sw.ts, served at/sw.js) keeps every 256 KiB chunk it fetched in Cache Storage, and the page boots once it is in control; a second visit then fetched nothing (dev server and production build, worker and inline). The chunks of other images are deleted on load;?cache=0removes the service worker and its chunks. - A production build (
vite build, thenvite preview) reads the image from another origin with CORS only, as it would from R2. - The build tools (g++ 15.2, cmake 4.2, colcon) already come with
ros:lyrical-ros-base; nothing is installed forcolcon build. - The boot message says
Welcome to Ubuntu 26.04.1 LTS(from the image's os-release). - The first
ros2 topic listthrough the daemon does not list/chatteryet.
Published at https://unkernel-lyrical.pages.dev/ (page on Cloudflare Pages, image on R2 behind a custom domain), the same headless Chrome test from Japan:
| Check | No edge cache (cf-cache-status: DYNAMIC) |
With a Cache Everything rule on the image's domain |
|---|---|---|
| Boot to the first prompt | 15.8 s, 18.6 s | 6.7 to 7.7 s (4 runs) |
| 5 messages heard by the listener | about 11 s after the prompt | about 7.5 s after the prompt |
A boot makes about 200 Range reads, each a round trip; served from the edge, they cost a few seconds more than from a local server. The image's keys include its hash, so caching it at the edge never serves a stale image.
Not tried: services and actions, DDS with anything outside the guest, more than one CPU, and phones (memory drops to 512 MiB).
scripts/publish.sh publishes one versioned set:
- the image, under a key that includes its hash, never overwritten;
- its package list (
scripts/manifest.ts) and the source of this project's own changes; - the page (
web/dist, deployed to Cloudflare Pages).
Unmodified upstream source (Ubuntu and ROS packages, unkernel) is not mirrored: the licenses page links to it upstream.
scripts/sources.py finds every source package of the image in the upstream archives: about 1.05 GB in 1405 files, with 6 already gone from the current archives (openssl and util-linux among them).
The Pages project is configured in wrangler.jsonc: its name (unkernel-lyrical, the *.pages.dev subdomain) and its output directory (web/dist).
The R2 bucket needs a CORS policy that allows GET with a Range header from the page's origin (r2-cors.json).
Once, before the first publish:
pnpm exec wrangler login
pnpm exec wrangler pages project create unkernel-lyrical --production-branch main
pnpm exec wrangler r2 bucket create BUCKET
# enable the bucket's public URL (r2.dev or a custom domain), and put the
# page's origin in r2-cors.json
pnpm exec wrangler r2 bucket cors set BUCKET --file r2-cors.jsonThen each publish:
R2_BUCKET=BUCKET PUBLIC_URL=https://BUCKET-PUBLIC-URL scripts/publish.shLicensing and trademarks are covered in docs/licensing.md (in Japanese).
/usr/local/sbin/kw-init(PID 1): unkernel's Debian init without sysv-rc and box64. It also mounts a tmpfs on/dev/shmwhen nothing is mounted there, which never happens with the current base.poweroff,halt,reboot,/etc/sudoers.d/kw-user, the apt configuration90kwand the prompt come unchanged from unkernel's Debian image./etc/profile.d/ros2.sh: login shells source/opt/ros/lyrical/setup.bash.- The uid 1000 user
ubuntuis renameduser, the default user of unkernel's SDK and console. /usr/lib/kw-distro(ubuntu),/etc/hostnameand/etc/hostsare written.- The
BAKE_PKGSare installed.
The SDK's vm.exec() does not read the profile: run commands that need ROS's environment with bash -lc.
The files under rootfs/ that come from unkernel's guest/distro/debian/rootfs/ are GPL-2.0-or-later (each has an SPDX header).
For the licenses of everything distributed, see docs/licensing.md.