Tailscale sysext not working after update - FIX

If you are installing or updating Tailscale (from 1.104.1 to 1.104.4 in my case) on ZimaOS using the system extension script (chicohaager/zimaos-tailscale-sysext) and notice that the tailscaled.service keeps restarting without establishing a connection, you are not alone.
Here is a quick guide on why this happens and how to fix it before running ./install.sh.

The Problem
Checking systemctl status tailscaled.service shows the unit stuck in an activating (auto-restart) loop, failing at the ExecStartPre step:
Process: ExecStartPre=/bin/sh /usr/libexec/tailscale/appdata-guard.sh /DATA/AppData/tailscale (code=exited, status=1/FAILURE)
Running the guard script manually in verbose mode (sudo sh -x /usr/libexec/tailscale/appdata-guard.sh /DATA/AppData/tailscale) reveals the underlying error:
appdata-guard: /DATA/AppData ist kein echter Ordner

Why does this happen?
The appdata-guard.sh script is a safety check designed to ensure root permissions and directory security. It explicitly checks that /DATA/AppData is a plain, traditional directory:
[ -d “$parent” ] && [ ! -L “$parent” ] || refuse “$parent ist kein echter Ordner”
Because ZimaOS mounts /DATA or /DATA/AppData via overlays or symlinks, the [ ! -L “$parent” ] condition triggers a false positive, refusing to start the service even when permissions are perfectly fine.

Since /usr on ZimaOS is a read-only file system, you cannot edit /usr/libexec/tailscale/appdata-guard.sh directly after installation. You need to patch it in the repository before running the installer.

The Solution
Follow these steps when cloning and installing the repository via SSH:

  1. Clone the repository as usual
    cd /tmp
    git clone GitHub - chicohaager/zimaos-tailscale-sysext: Tailscale as a systemd-sysext for ZimaOS. Mirrors the upstream Buildroot recipe — no Docker, full subnet-router/exit-node support · GitHub
    cd zimaos-tailscale-sysext

  2. Patch appdata-guard.sh
    Open the guard script inside the sysext directory:
    sudo nano ./sysext/appdata-guard.sh
    Find the following line (around line 38):
    [ -d “$parent” ] && [ ! -L “$parent” ] || refuse “$parent ist kein echter Ordner”
    Remove the strict ! -L check so it only verifies that the parent folder is a valid directory:
    [ -d “$parent” ] || refuse “$parent ist kein echter Ordner”
    Save and exit (Ctrl+O, Enter, then Ctrl+X).

  3. Run the installer
    Now run the installation script:
    sudo ./install.sh
    Once installed, check the service status:
    sudo systemctl status tailscaled.service
    You should see Active: active (running).

Hi,
thanks for the detailed report and sorry for the trouble. Please don’t use that patch long-term, though: it switches off the check exactly in the case it exists for.

What the check is for: since v1.0.5, tailscaled only starts if root can trust /DATA/AppData/tailscale (it holds the node key). On ZimaOS 1.8.0, /DATA/AppData is a plain directory, mode 0777 — anyone who can write there (e.g. over the SMB share of /DATA) can rename a folder in it and put their own in its place. The guard adds the sticky bit, so only the owner can rename. I checked two boxes today: /DATA/AppData is a real directory on both (ext4 on the data partition, no overlay, no symlink). So “ZimaOS mounts /DATA/AppData via overlays or symlinks” is not the general case; on your box something is different.

Why removing ! -L is unsafe: if /DATA/AppData is a symlink, the patched guard checks the link instead of the folder it points to, and never checks the folders above the real target. I tried it: with the real folder inside a world-writable (0777) directory, the original guard refuses, the patched one says OK and even sets the sticky bit on the target through the link.

What changes in 1.0.7: the guard follows a symlink owned by root one step to a real folder and checks that folder and everything above it up to /, instead of refusing. It still refuses a chain of symlinks, .. in the link target and a symlink owned by another user. A missing /DATA/AppData now says “fehlt” instead of “ist kein echter Ordner”. 1.0.7 also gives /DATA back to root if another user owns it (that happened on one of my boxes; the log line says how to undo it).

I don’t know yet whether that covers your box — it depends on what /DATA/AppData is there. If it turns out to be a chain or a relative link with .., or not a symlink at all, I’ll adapt the check to that. Could you post the output of these (all read-only):

ls -ld /DATA /DATA/AppData
readlink -f /DATA/AppData
stat -c '%F %u %a %N' /DATA/AppData "$(readlink -f /DATA/AppData)"
namei -l /DATA/AppData/tailscale
findmnt -T "$(readlink -f /DATA/AppData)"
grep VERSION_ID /etc/os-release

Until 1.0.7 is out, your patched build keeps tailscaled running. What it does not check is the folder the link points to and the folders above it: namei -l above shows whether any of them is writable by group or others (a w in the 6th or 9th position, without a t at the end).

Thanks for the detailed explanation, Lintux! That makes total sense regarding the security implications of bypassing the parent directory checks.

To give you the context for your v1.0.7 logic:

  • Setup: On my box (Zimaboard2), /DATA/AppData is indeed a single-step symlink owned by root:root pointing to an HDD storage mount at /media/Zima-HDDstorage/AppData.

  • Target permissions: The target directory /media/Zima-HDDstorage/AppData currently has mode 01777(drwxrwxrwt, owned by root:root), so the sticky bit is active on the target destination.

Based on what you described for v1.0.7 (following a single root-owned symlink and checking the target along with its parent paths), it sounds like v1.0.7 will handle this setup properly out of the box.