Skip navigation
You might have seen you can run a full Linux kernel in a Durable Object.
0:00 / 0:22

You might have seen you can run a full Linux kernel in a Durable Object.

Steve Faulkner

@southpolesteve8.1K followers

Visit on X
904 likesDownloadOriginal post

50,326 views

You might have seen you can run a full Linux kernel in a Durable Object. Thanks to unkernel by Pooya Parsa [1] So obviously I wired it up to Cloudflare TCP Workers. Now you get a full Linux env running in a DO. Try it: ssh The DO is keyed by your SSH key [2], so the computer is entirely yours. The filesystem is backed by SQLite and persists across hibernation. But there is more... of course I also want a coding agent, but most of them won't fit. The guest has 64 MB of RAM and a 128 MB disk. The guest linux VM is just running inside a Worker, so you can run code on the host and expose it as cli commands in the guest. I put Pi Durable on the JS host side and exposed it in the linux guest as "agent" command. It flips the usual Workers model: the host is JS and the guest is native Linux running on a wasm CPU. Any command in the guest can be a shim that calls out to JS. And the secrets and the model never enter the VM. [1] unkernel: doing Linux in a DO: and [2] No SSH key. Run: ssh-keygen -t ed25519 -f ~/.ssh/id_ed25519 -N ""

38 Comments

Comments from the original post on X (Twitter)

  • Steve Faulkner's profile picture

    @southpolesteve

    Almost two years ago I was walking around London with @threepointone talking about the power of Durable Objects. DOs are lightweight enough that you could give literally everyone on the planet their own tiny computer. That vision felt years away. But with AI it's already here.

    39 likes

  • brandon's profile picture

    @burcs

    @_pi0_ this is so cool, now is time to run containers on DOs?

    10 likes

  • Steve Faulkner's profile picture

    @southpolesteve

    @_pi0_ heh. Already got an agent on this. Seems that a docker "compiler" is totally doable

    9 likes

  • brandon's profile picture

    @burcs

    @_pi0_ amazing!!

  • Dominik Picheta's profile picture

    @d0m96

    @_pi0_ That `agent` command is amazing

    9 likes

  • Steve Faulkner's profile picture

    @southpolesteve

    @_pi0_ I hadn't even considered using the built in `agent` to customize the box. Awesome.

    4 likes

  • Néstor's profile picture

    @nstlopez

    @_pi0_ I see you Steve 😂 Build a unikernel for it next and try to strip as much as possible

    5 likes

  • Ivar Vong's profile picture

    @ivarvong

    @_pi0_ have you added zswap backed by sqlite yet?

    2 likes

  • Steve Faulkner's profile picture

    @southpolesteve

    @_pi0_ Not yet, but I'm spinning up an agent to try it out now.

    1 like

  • noel's profile picture

    @noelkimx

    @_pi0_ Secrets and the model staying outside the VM is my favorite bit

    2 likes

  • Estéban's profile picture

    @soubiran_

    @_pi0_ What do you mean by guest and host? And just 🤯 this unlocks so much

    1 like

  • Steve Faulkner's profile picture

    @southpolesteve

    @_pi0_ Host = Durable Object V8 isolate Guest = Linux VM compiled to WASM running in Host

    8 likes

  • @chaz6@ipv6.social's profile picture

    @chaz_6

    @_pi0_ Very cool!

    1 like

  • firtoz's profile picture

    @firtoz

    @_pi0_ Can you page the ram to durable sqlite

    1 like

  • fuzzybear3965's profile picture

    @fuzzybear3965

    @_pi0_ I use psi on OpenStick. You should check it out: `$ USR=$OPENSTICK_IMG; comm -23 <(nix-store -qR $(readlink -f $USR/bin/psi) | sort) <(nix-store -qR $(readlink -f $USR/bin/* | grep -v psi) | sort) | xargs du -shc --apparent-size | tail -1 | cut -f1 7.4M`

    1 like

  • tynan's profile picture

    @training_loop

    @_pi0_ love the host-side shim keeping secrets out of the guest. we ended up using the exact same ssh-key-as-identity trick for full KVM microVMs (ssh zero signup over ssh is so underrated

    1 like

  • Enoch Klu's profile picture

    @gotnoklu

    @_pi0_ @delali

  • Advait Shinde's profile picture

    @advait3000

    @_pi0_ The things men will do to get around DO compute limitations

  • C8's profile picture

    @chunkygooo

    @_pi0_ Can we make it work with MacOS? Also hows the performance?

  • vaish's profile picture

    @wishee0

    @_pi0_ bro what