Wiki / Backup and restore

Restoring a backup

You need administrator rights, because the service has to stop.

1. Stop Kustos. In an elevated PowerShell:

powershell
Stop-Service Kustos

Wait for it to actually stop before continuing — Stop-Service can return while the process is still shutting down.

powershell
Get-Service Kustos    # Status must read Stopped

2. Move the current database aside — do not delete it. If the restore is not what you wanted, this is the only way back.

powershell
cd $env:ProgramData\Kustos
Rename-Item kustos.db kustos.db.before-restore

3. Copy the backup into place. Pick the one you want from backups\ and copy it — copy, do not move, so the backup survives.

powershell
Copy-Item backups\kustos-20260930-155318.db kustos.db

4. Delete the -wal and -shm files. This is the step that matters.

powershell
Remove-Item kustos.db-wal, kustos.db-shm -ErrorAction SilentlyContinue

Those two files belong to the database you just moved aside, not to the one you restored. Leaving them is how a restore appears to work and then does not: at best SQLite ignores them, at worst you get a database that is part old and part new with nothing to tell you which parts.

5. Start Kustos.

powershell
Start-Service Kustos

6. Check it came up. Open Kustos and look at a screen whose data you know changed, such as Activity. The Backups list will look the same as before: it reads the files in backups\, not the database. If Kustos does not answer at all, the service log in %ProgramData%\Kustos\logs\ says why.