Data and removal
An upgrade keeps your app’s data, and an uninstall keeps it too unless the user ticks one box in the wizard. Handler data in the data folder survives upgrades, and Compose named volumes are always kept.
Where data lives
Section titled “Where data lives”A native-go backend writes to /var/packages/<package>/var, which DSM stores at @appdata/<package>. Files inside the SPK are replaced on upgrade, so write anything that must survive to the data folder.
| Location | Holds | Data box ticked |
|---|---|---|
@appdata/<package> | Handler data; Compose ${SYNOPKG_PKGVAR} bind mounts | Contents deleted |
@apphome/<package> | Home folder with generated secrets | Contents deleted |
@appconf/<package> | Saved configuration | Contents deleted |
| A Shared Folder | Files in a folder chosen at install | Never deleted |
| A Docker named volume | Container state, Compose only | Never deleted |
All of them survive upgrades.
Change the data format between versions
Section titled “Change the data format between versions”A native-go project uses github.com/synopackageland/syno-pkg-land-sdk/datamigrate to apply numbered schema steps to the data folder. Add steps to Migrations() in backend/internal/app/migrations.go:
{ Version: 1, Name: "example", Apply: func(ctx datamigrate.Context) error { // Read ctx.DataDir. Write a temporary file, then rename it. return nil },},| Rule | Detail |
|---|---|
| Numbering | Versions start at 1; a version never changes meaning |
| When it runs | Pending steps run at the start of each request; a failed step fails that request. Progress is stored in <data folder>/data-version |
| Idempotent | Each step must be safe to run twice; a crash before the version is recorded runs it again |
| Failure | The last successful version stays recorded and the next request resumes; the helper never deletes or rewrites data |
| Versions | ctx.OldPkgVer is the pre-upgrade version, ctx.NewPkgVer the running one |
Back up
Section titled “Back up”The CLI backs nothing up, and the wizard says Hyper Backup is not checked and no recoverable backup can be verified. Back up @appdata/<package> always, plus @apphome/<package> and @appconf/<package> when used, the Shared Folder when the app uses one, and named volumes for Compose.
Approvals and delegations are not data: a reinstall needs a fresh approval and new destinations.
Upgrade
Section titled “Upgrade”An upgrade keeps the data folder and runs pending schema steps. If @appdata/<package> exists, the install wizard says the install reuses that data and how to start empty. Version and build rules are in Ship.
Uninstall
Section titled “Uninstall”The wizard has one checkbox, unchecked by default: “Also delete the app data listed above”. It lists the folders it empties and says Shared Folders, the package account and other apps’ data are never deleted.
| Choice | Result |
|---|---|
| Unchecked | Data stays; reinstalling the same package name reuses it |
| Checked | Empties @appdata, @apphome and accessible @appconf contents; the folders stay. A folder outside the package’s own area is skipped |
| An upgrade with the box checked | Nothing is deleted |
For Compose, the wizard lists the named volumes from app_data and warns that delete-data keeps them; the message marks them COMPOSE_DATA_RETAINED (see Container apps). To run the uninstall, see the CLI reference.
DSM may keep empty @appdata, @appconf, @apphome and @appshare folders, the /usr/syno/etc/packages/<package> link and the package account; an administrator can review and remove them.
Application Privileges and Login Portal
Section titled “Application Privileges and Login Portal”DSM keeps an uninstalled app’s rules in Control Panel > Application Privileges, and a later install under the same name applies them again. For a portal app, DSM removes the alias but the web server serves it until reload. Only root can clean either; see Capabilities.
| Kind | Rules | Login Portal address |
|---|---|---|
Executor app (delegate or root-ops) | Deleted by the executor at uninstall | Reloaded by the executor, so the address stops |
| App without privileges | Kept; the wizard names the manual step | None; it cannot declare portal |
The executor logs failures to synopkgland-executor and the uninstall continues; the manual steps are the fallback.
Administrator approvals
Section titled “Administrator approvals”Only delegate and root-ops packages have one; see Capabilities and Root operations.
- Install:
statusshowsneeds-admin-approvaluntil a DSM administrator confirms their password once in the app window. - Upgrade: the executor resumes when the approved policy still matches, and a new executor installs only if its SHA-256 matches
synopkgland_executor_sha256in the root-owned INFO. Changingentry, scope, destinations, lifetime, operations orroot/*.shneeds a new approval; a version bump does not. A scope change revokes delegations, and users pick destinations again. - Uninstall: the approval, delegations, the
<package> executor boot,<package> executor controland<package> executor selectiontasks, and the Application Privileges rules are removed. Tasks go in the background after a name, owner and script check, so a timeout does not stop the uninstall.
Remove leftovers by hand
Section titled “Remove leftovers by hand”An executor app whose cleanup failed (the synopkgland-executor log says why) can leave root tasks, Application Privileges rules and a Login Portal address. An administrator removes them by hand:
| Leftover | Remove it |
|---|---|
<package> executor control and <package> executor selection | Control Panel > Task Scheduler |
<package> executor boot | DSM refuses to delete it over HTTP (error 119). As root, run /usr/syno/bin/synowebapi --exec api=SYNO.Core.EventScheduler method=delete version=1 task_name="<package> executor boot" |
| Application Privileges rules | Control Panel > Application Privileges |
| A Login Portal address that still opens | Save any alias in Control Panel > Login Portal > Applications, which reloads the web server, or restart the NAS |
Limits
Section titled “Limits”- The uninstall box deletes only
@appdata,@apphomeand@appconfcontents; Shared Folders, named volumes and the package account are never deleted. - No backup is configured or verified, and the schema step helper is
native-goonly.
Troubleshooting
Section titled “Troubleshooting”| Symptom | Cause | Fix |
|---|---|---|
| A reinstall starts with the earlier settings, or empty folders remain after a box-ticked uninstall | The earlier uninstall kept the data, or DSM kept folder roots | Uninstall again with the box ticked; remove folders as an administrator |
needs-admin-approval or blocked: executor_status_mismatch | The policy changed, the INFO anchor does not match, or the executor reports other digests | A DSM administrator approves in the app window; otherwise reinstall that executor’s package |