Migrating from User to Service install on Windows

I ran into some of the same issues others had noted and after running the process on 3 different systems (converting them all over to a service after they’d been running as a user app for awhile) came up with a similar but slightly different process that seems to work a little smoother (eg: without running into missing files / missing db errors).

So, plagiarizing @JonMikelV’s original comment (with changes)…

Here we’re going to go over method #1.

  1. Stop the tray icon if you currently have it running
  2. Create a folder called Duplicati in C:\Windows\System32\config\systemprofile\AppData\Local\. So you end up with C:\Windows\System32\config\systemprofile\AppData\Local\Duplicati
    ** If you are prompted to give yourself access when accessing folders in C:\Windows\System32\, confirm that you want to continue
  3. Move the file C:\Users\[your user name]\AppData\Local\Duplicati\Duplicati-server.sqlite to the folder you created in step 1, so that you end up with C:\Windows\System32\config\systemprofile\AppData\Local\Duplicati\Duplicati-server.sqlite
    **If you were running the portable version, your “from” location will be C:\Program Files\Duplicati 2\Data\Duplicati-server.sqlite instead
  4. Open a command prompt as an administrator (right click and select “Run as administrator”) and run Duplicati.WindowService.exe install in your Duplicati install folder (likely "C:\Program Files\Duplicati 2\Duplicati.WindowsService.exe" install )
  5. If you get the “Installation has completed” message, you can start the service with sc start Duplicati (or use a Windows Service GUI, your choice)
    But if you get an error such as the following then you probably didn’t open your command prompt as an authorized administrator, try again
    System.UnauthorizedAccessException: Access to the path 'C:\Program Files\Duplicati 2\Duplicati.WindowsService.InstallState' is denied.
  6. Once the service has been started go ahead and close the command prompt window (we’re done with it now)
  7. Open a browser window and go to http://localhost:8200 to make sure the service is working and found your existing settings (if that fails but http://localhost:8300 works, then you may have forgotten to stop the tray icon)
  8. Use the “Move existing database” feature for each existing backup set
    8.1 Click on one of your backup sets to open the menu
    8.2 Click on “Database” under the “Advanced” heading
    8.3 Under the “Location” section, click in the “Local database path” field
    8.4 Replace the C:\Users\ [your user name]\AppData\Local\Duplicati\ part with C:\Windows\System32\config\systemprofile\AppData\Local\, leaving the XXXXXXXXXX.sqlite part alone. So you’ll end up with something like C:\Windows\System32\config\systemprofile\AppData\Local\ABCDEFGHIJ.sqlite
    8.5 If this backup set has already run at some point, click “Move existing database”. If the move button is disabled because the backup hasn’t run yet, click the “Save” button instead.
    8.6 Repeat step 8.1 to 8.5 for any other backup sets you have
  9. The Tray icon is no longer needed so you can remove Duplicati from your Startup programs (on my system this was found in C:\ProgramData\Microsoft\Windows\Start Menu\Programs\StartUp). However, if you like having the icon around then be sure to update the properties of any shortcuts to it (such as in the Startup folder) to include --no-hosted-server parameter** as part of the Target field (this tells the Tray Icon to connect to the service instead of starting it’s own instance).
    ** Note there’s an outstanding issue where the tray icon doesn’t work with this parameter. You can still set it up and try it, and when the bug is fixed it should start working again.

There you’re done! Duplicati should now run when the machine starts up whether or not a user is actually logged on.

2 Likes