Running Tailscale on Yocto + Raspberry Pi

September 22, 2023

On my journey working with Yocto and deploying it on a Raspberry Pi I wanted to get Tailscale working. For those of you who don’t know what Tailscale its a seamless VPN for devices for my use case it gives SSH access to all my devices on my desk from anywhere in the world (and much more). Seriously go check them out!

Previously I tried running Tailscale on Ubuntu Core without luck (see my blog post ), I was hoping Yocto would be a bit easier.

Lucky Yes! I did get it running but did require some modifications.

I assume those reading this might have some familiarity with Yocto/OpenEmedded but if not go checkout their site. It’s a complex tool to help build a custom linux distro. Through the process it generally requires writing “recipes ” for software that is not currently in it’s ecosystem. Usually the recipe instructs yocto on how to build the tool/app from source and deploy it. Sometimes applying patches along the way. Recipes then get imported through meta-layers . You can find existing recipes and layers in their index .

And guess what I found one! https://layers.openembedded.org/layerindex/recipe/341013/ from Christoph Handschuh.

I tried adding it and no luck.

  1. It first failed because it defines a compatible target host as `arm-phytec-linux-gnueabi` which must be something he was using for his demo. I removed that from his recipe and got things built. One step closer!
  2. It failed to start. Hmm.. I tried running `tailscaled` and it was not the correct architecture. I’m using a 64bit arm and he was grabbing the arm versions. Ok some quick updates to pull the correct binary from Tailscale. Better!
  3. It got further running `tailscaled` but was complaining about missing iptables. The yocto image I was using was very minimal. And the recipe did not define it as a runtime dependency. More easy fixes. `RDEPENDS:${PN} = “iptables”`
  4. It gets closer but for some reason the systemd init files were missing. I removed some checks he was doing in the recipe and success!!!

After running and accepting the connection I could ssh into my Raspberry Pi.

tailscale up --ssh

I made a number of modifications and support a few more architectures. See my fork at https://github.com/AdamMagaluk/meta-tailscale

Note this recipe and mine included rely on pre-built binaries from Tailscale instead of building it from source in the recipe. This is generally not the Yocto thing to do. But building a large Golang application generally requires that you create recipes for every gomod dependency it uses. Tailscale is a pretty large project and I wasn’t taking the time to do that :)