<div dir="ltr">Oh, now that's a new way of doing it. I'll definitely give that a shot. That sounds like it has the best chance of working.<br></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Sat, Oct 8, 2022 at 12:20 PM Luca Boccassi <<a href="mailto:bluca@debian.org">bluca@debian.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">On Sat, 2022-10-08 at 11:13 -0400, Duncan Gibson wrote:<br>
> The problem wasn't mounting the system extension automatically. That<br>
> worked<br>
> just fine. It was that systemd would try to start the service before<br>
> the<br>
> system extension mounted, which would fail, for obvious reasons. This<br>
> weekend I think I'm going to try the BindReadOnlyPaths option and see<br>
> if I<br>
> can get that to work.<br>
<br>
Don't do that. system-wide extensions are not supposed to add units,<br>
and it will not work. Portable services are for distributors - for<br>
locally built extensions, you can simply use a normal service with<br>
ExtensionImages= that points to your extension, and it will be<br>
overlayed with the rootfs.<br>
<br>
> On Fri, Oct 7, 2022 at 3:35 PM David Anderson <<a href="mailto:dave@natulte.net" target="_blank">dave@natulte.net</a>><br>
> wrote:<br>
> <br>
> > Yeah, so far we (tailscale) haven't found a good way to run on the<br>
> > Steam<br>
> > Deck at bootup, and also survive the A/B OS updates. Systemd system<br>
> > extensions _can_ be activated during bootup, if you place the<br>
> > extension in<br>
> > one of the well-known locations (/var/lib/extensions would be the<br>
> > one to<br>
> > use on Deck, as iirc it survives A/B upgrades), and the systemd-<br>
> > sysext<br>
> > service is enabled.<br>
> > <br>
> > I would check if systemd-sysext.service is enabled on the deck, and<br>
> > if<br>
> > not, file a request with Valve to enable that service in a future<br>
> > update.<br>
> > You should present it as enabling further customization of their<br>
> > platform.<br>
> > <br>
> > Another possible reason that sysexts aren't working for you, is<br>
> > that the<br>
> > Deck's /etc/os-release doesn't define a SYSEXT_LEVEL, and the<br>
> > VERSION_ID<br>
> > changes with every OS update. Because of this, the system extension<br>
> > will<br>
> > refuse to activate after every update (either SYSEXT_LEVEL or<br>
> > VERSION_ID<br>
> > must match exactly), until you rebuild a new image with the right<br>
> > OS<br>
> > metadata. Asking Valve to set SYSEXT_LEVEL to a stable value would<br>
> > make it<br>
> > even easier to provide Deck OS extensions reliably :)<br>
> > <br>
> > - Dave<br>
> > <br>
> > On Thu, Oct 6, 2022, at 12:08, Arian van Putten wrote:<br>
> > <br>
> > Afaik Portable services run in an isolated root and dont have<br>
> > access to<br>
> > the hosts rootfs. You'd have go include iptables and all its<br>
> > dependencies<br>
> > in the portable services directory. If you don't want to do that<br>
> > you'd have<br>
> > to use BindReadOnlyPaths= to give the service access to the<br>
> > required host<br>
> > paths or you'd have to use a system extension.<br>
> > <br>
> > That's probably why they advice running as a system extension.<br>
> > <br>
> > I think there are mechanisms for setting up system extensions on<br>
> > startup<br>
> > but I'm not familiar enough with the details. Maybe someone else in<br>
> > the<br>
> > list knows.<br>
> > <br>
> > <br>
> > <br>
> > <br>
> > On Thu, 6 Oct 2022, 20:21 Duncan Gibson, <<a href="mailto:legowerewolf@gmail.com" target="_blank">legowerewolf@gmail.com</a>><br>
> > wrote:<br>
> > <br>
> > Hi, everyone.<br>
> > <br>
> > The high-level overview: I'm trying to install Tailscale as a<br>
> > portable<br>
> > service on my Steam Deck.<br>
> > <br>
> > Tailscale is a point-to-point VPN service, essentially a wrapper<br>
> > around<br>
> > Wireguard that helps with network setup and management. The Steam<br>
> > Deck is<br>
> > Valve's handheld PC running SteamOS 3, which is derived from Arch.<br>
> > It uses<br>
> > an A/B partition system for system files, meaning you can't install<br>
> > a<br>
> > service the normal way.<br>
> > <br>
> > There *is* a guide to do this, posted on their own blog, but it<br>
> > uses<br>
> > system extensions which aren't good for services that you want to<br>
> > run on<br>
> > startup. Indeed, following that guide puts me in a state where I<br>
> > have to<br>
> > manually start the daemon every time I reboot my Deck, even with<br>
> > the<br>
> > service enabled.<br>
> > <br>
> > Let's move on to how I've started to do this.<br>
> > <br>
> > Tailscale is available through most package managers, but they also<br>
> > publish static binaries with systemd unit files.<br>
> > <br>
> > This script grabs that binary, extracts it, and moves it into a<br>
> > portable<br>
> > service directory structure.<br>
> > <br>
> > # download and extract Tailscale<br>
> > tarball="$(curl -s '<a href="https://pkgs.tailscale.com/stable/?mode=json" rel="noreferrer" target="_blank">https://pkgs.tailscale.com/stable/?mode=json</a>' |<br>
> > jq -r<br>
> > .Tarballs.amd64)"<br>
> > version="$(echo ${tarball} | cut -d_ -f2)"<br>
> > tar_dir="$(echo ${tarball} | cut -d. -f1-3)"<br>
> > curl -s "<a href="https://pkgs.tailscale.com/stable/$%7Btarball%7D" rel="noreferrer" target="_blank">https://pkgs.tailscale.com/stable/${tarball}</a>" -o<br>
> > tailscale.tgz<br>
> > tar xzf tailscale.tgz<br>
> > test -d $tar_dir<br>
> > <br>
> > # Set up our target directory structure<br>
> > mkdir -p<br>
> > tailscaled/{usr/{bin,sbin,lib/systemd/system},etc,proc,sys,dev,run,<br>
> > /var/tmp}<br>
> > <br>
> > # Copy tailscale-distributed files to the right place<br>
> > cp -rf $tar_dir/tailscaled tailscaled/usr/sbin/tailscaled<br>
> > cp -rf $tar_dir/systemd/tailscaled.service<br>
> > tailscaled/usr/lib/systemd/system/tailscaled.service<br>
> > <br>
> > # Write service os-release file<br>
> > source /etc/os-release<br>
> > cp -rf /etc/os-release tailscaled/etc/os-release<br>
> > <br>
> > Not automated yet is patching the provided unit file - you need to<br>
> > remove<br>
> > the EnvironmentFile line and "--port $PORT $FLAGS" options, and add<br>
> > [Exec]<br>
> > Environment="PATH=/usr/bin"<br>
> > <br>
> > Attach the portable service: sudo portablectl attach ./tailscaled<br>
> > --profile=trusted<br>
> > and try starting it: sudo systemctl start tailscaled<br>
> > <br>
> > It fails, leaving this in the logs:<br>
> > <br>
> > logtail started<br>
> > Program starting: v1.30.2-t24c524c78-gc399ae6fa, Go 1.19.1-<br>
> > tsb13188dd36:<br>
> > []string{"/usr/sbin/tailscaled",<br>
> > "--state=/var/lib/tailscale/tailscaled.state",<br>
> > "--socket=/run/tailscale/tailscaled.sock"}<br>
> > LogID:<br>
> > 0f59ed267a2b19cc28aac9ee7119914000ca478234af8d56893a025ae72cc647<br>
> > logpolicy: using $STATE_DIRECTORY, "/var/lib/tailscale"<br>
> > wgengine.NewUserspaceEngine(tun "tailscale0") ...<br>
> > wgengine.NewUserspaceEngine(tun "tailscale0") error: creating<br>
> > router:<br>
> > could not get iptables version: fork/exec /usr/bin/iptables: no<br>
> > such file<br>
> > or directory flushing log.<br>
> > logger closing down<br>
> > createEngine: creating router: could not get iptables version:<br>
> > fork/exec<br>
> > /usr/bin/iptables: no such file or directory<br>
> > <br>
> > iptables is, in fact, at /usr/bin/iptables, so what am I missing?<br>
> > Before I<br>
> > added the Environment line, I was getting errors that iptables<br>
> > wasn't on<br>
> > the PATH, so I suspect that now tailscaled can *see* iptables, but<br>
> > systemd isn't letting tailscaled run it.<br>
> > <br>
> > Thanks for having a look at this.<br>
> > <br>
> > <br>
> > <br>
<br>
-- <br>
Kind regards,<br>
Luca Boccassi<br>
</blockquote></div>