SCALE App - Autostart after Unlocking Dataset

Hello,

my TrueNAS SCALE Dragonfish-24.04.2.1 hosts Syncthing as an App. Syncthing is using the content of a passphrase encrypted dataset and, therefore, cannot access the dataset on system startup, until I manually unlock the dataset.
My Virtual Machines which are located on passphrase encrypted datasets do automatically start after I unlocked the dataset via passphrase. However, the Syncthing App is not automatically starting after the unlock and I have to trigger the start of the App manually.

Is this the way it should be?
Is it possible to auto-start the App after the dataset got unlocked?

Thanks a lot in advance,

Thomas

Is really noone else here with Apps accessing locked datasets?

Did you ever find a solution to this? I have the same inconvenience.

No, I don’t have a solution, yet. This still seems to be a bug in TrueNAS and I have to manually (re-)start the App everytime.

Has anyone found a solution for this? I’m in the same boat, custom app in which in need to mount a passphrase protected path. So after every reboot the app is in “crashed” state and needs to be started manually after unlocking the encrypted dataset.

No, still no solution.

If VMs work, have you considered running everything as VMs with the ‘app’ functionality in a VM instead of as an App?

Running a VM would work, but if there is a feature called “Apps”, I expect it to also work without issues.

You can try Report a Bug if you believe it isn’t working as it should or creating a Feature Request on the forum. I figure you have given it enough time for replies. Github might be an option too GitHub · Where software is built

You could also try to write a script as a cronjob which checks for dataset unlock and then starts the app. I don’t know if it’s possible but maybe I’ll try that

So I just use this small script now. It’s on an unencrypted dataset and runs as a cronjob every minute.

#!/bin/sh
DATASET="tank/YOURENCRYPTEDDATASET"
APP="YOURAPPNAME"

KS="$(zfs get -H -o value keystatus "$DATASET" 2>/dev/null)"
[ "$KS" = "available" ] || exit 0

STATE="$(midclt call app.query | python3 -c '
import sys, json
app = sys.argv[1]
data = json.load(sys.stdin)
for a in data:
    if a.get("name") == app:
        print(a.get("state",""))
        break
' "$APP")"

[ "$STATE" = "RUNNING" ] && exit 0

midclt call app.start "$APP" >/dev/null 2>&1
exit 0