Installed WindowsService, decided I didn't like it, tried to go back to Duplicati.GUI.TrayIcon.exe, now crashes on startup

Windows 10 Pro 1809 x64, Duplicati 2.0.4.5.

After a string of backups ending with warnings due to access to in-use files being denied because, well, they were in use, I tried enabling VSS with `–snapshot-policy=on’. That requires high privs, so I ran ‘Duplicati.WindowsService.exe install’ as administrator.

What I didn’t realize was that this would wipe the slate and start me over with a completely new config, with all of my previously configured backups gone. Oh. I have encrypted copies of the backup configs, so I restored one. That immediately failed… because it referenced %MY_DOCUMENTS% in several paths, and now it’s running as a different user. It’s never straightforward, is it?

So I decided to back out the change and go back to running Duplicati as me, via Duplicati.GUI.TrayIcon.exe. I shut down the service, uninstalled it, and launched the GUI/ It immediately crashes, according to C:\ProgramData\Duplicati\updates\Duplicati-crashlog.txt:

–BEGIN CRASHLOG–

System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.Exception: A serious error occurred in Duplicati: System.Exception: Failed to create, open or upgrade the database.
Error message: 
The database has version 6 but the largest supported version is 4.

This is likely caused by upgrading to a newer version and then downgrading.
If this is the case, there is likely a backup file of the previous database version in the folder C:\Users\tar\AppData\Local\Duplicati.
   at Duplicati.Server.Program.GetDatabaseConnection(Dictionary`2 commandlineOptions)
   at Duplicati.Server.Program.RealMain(String[] _args) ---> System.Exception: Failed to create, open or upgrade the database.
Error message: 
The database has version 6 but the largest supported version is 4.

This is likely caused by upgrading to a newer version and then downgrading.
If this is the case, there is likely a backup file of the previous database version in the folder C:\Users\tar\AppData\Local\Duplicati.
   at Duplicati.Server.Program.GetDatabaseConnection(Dictionary`2 commandlineOptions)
   at Duplicati.Server.Program.RealMain(String[] _args)
   --- End of inner exception stack trace ---
   at Duplicati.GUI.TrayIcon.HostedInstanceKeeper..ctor(String[] args)
   at Duplicati.GUI.TrayIcon.Program.RealMain(String[] _args)
   --- End of inner exception stack trace ---
   at System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor)
   at System.Reflection.RuntimeMethodInfo.UnsafeInvokeInternal(Object obj, Object[] parameters, Object[] arguments)
   at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
   at Duplicati.Library.AutoUpdater.UpdaterManager.RunMethod(MethodInfo method, String[] args)

–END CRASHLOG–

How screwed am I? What is the easiest recovery to just get back to where I was with my existing backups running as me, and pretend this never happened, I will never try to twiddle knobs again? I have 3 backup jobs defined, and I have backups of each of their configs.

Thanks for any wisdom.

At what point (and how) was 2.0.4.5 installed or updated to? Your TrayIcon install acts like it’s on 2.0.3.3 beta or similar vintage, therefore won’t try to do the 2.0.4.5 database format (formats change with time). Maybe it’s just looking in the wrong place. For example, if you updated as SYSTEM, the update might be in the SYSTEM profile. Basically it might be the %LOCALAPPDATA% version of %MY_DOCUMENTS% move for a user move. While I’m not sure updates would go there, I’m pretty sure that any new job databases done as service would.

Migrating from User to Service install on Windows says some places updates live. To view the SYSTEM profile without permanently opening up access, start a Command Prompt with “Run as administrator” and check out C:\Windows\System32\config\systemprofile\AppData\Local\Duplicati
to see if you can find an updates folder with 2.0.4.5, or databases such as Duplicati-server.sqlite and others.

Downgrading / reverting to a lower version talks about downgrades. Probably best to get back 2.0.4.5 though, assuming you can figure out which updates folder it went into – and the article mentions some possible spots.

Probably just a combination of version mismatches (does Duplicati About → General actually say 2.0.4.5?), and possibly things in the wrong place. The TrayIcon errors are good. It found databases to complain about. Should it turn out to be too hard to work out where the 2.0.4.5 update went, you can always install from .msi. Databases + the right Duplicati version to handle them (in this case, 2.0.4.5 for version 6 ones) should work.

1 Like

Hello @tar, welcome to the forum!

Sorry to hear you’re running into these issues - but don’t worry, I don’t think you’re particularly “screwed” - the trick is figuring out what’s where on your system to which we don’t have any visibility. :slight_smile:

Yes - when running as a service it defaults to running as LOCALSYSTEM (or something like that) which means databases and configs are likely stored in C:\Windows\System32\config\systemprofile\AppData\Local\Duplicati rather than %appdata%\Duplicati (aka C:\users\[your profile]\AppData\Roaming).

If you want to keep working with the service (thus getting access to Snapshot features) I’d suggest stopping Duplicati, renaming the Duplicati folder in windows to something else then try COPYING your AppData Duplicati folder into the Windows\System32… path.

Then when you start Duplicati it should see all your existing jobs & stuff - HOWEVER, you will still need to edit your job to use absoluteC:\.. paths instead of %MY_DOCUMENTS%.

As for the version error - did you actually try to downgrade? If not, my guess is you did an in-app update (which is fine, I do them all the time) but are now directly running the tray icon from your C:\Program Files path. What happens if you try running it from C:\ProgramData\Duplicati\updates\\<most-recent-version>?

1 Like

Thank you, everyone, for your quick and helpful responses. Here’s what I did:

I decided that I wanted the VSS, so that seems to mean running as a Windows service as System. I uninstalled Duplicati and removed C:\Windows\System32\config\systemprofile\AppData\Local\Duplicati to get a clean start. Installed 2.0.4.5beta. Set it up to run as a service. Restored my backups from the .json.aes archives and fixed up the file paths. Repaired the local databases.

All seems much happier now. Thank you again for your help.

Glad to hear you got things set the way you want - sorry it was a bit stressful getting there. :slight_smile:

1 Like