Migrating from User to Service install on Windows

#29

May be better to put DB to ProgramData\Duplicati 2 folder? May be in subfolder named localsystem.

1 Like

#30

It’s a nice idea, but \ProgramData\Duplicati 2\ is already used if you run with the --portable-mode.

I may be mis-remembering, but on Windows the DEFAULT “data” folder ends up in:

  • C:\Users\<user name>\AppData\Local\Duplicati\ for tray-icon or service running as a specific user (with non-roaming user accounts, often home or small business situations)
  • C:\Users\<user name>\AppData\Roaming\Duplicati\ for tray-icon or service running as a specific user (with roaming user accounts, often in business or active-directory situations)
  • C:\ProgramData\Duplicati\ when run with the --portable-mode parameter, regardless of user account
  • C:\Windows\System32\config\systemprofile\AppData\Local\Duplicati\ (when running as Local System account)
0 Likes

#31

OK. My suggestion is C:\ProgramData\Duplicati 2\Local_System )

0 Likes

#32

When running Duplicati in portable mode, the data is stored in a subfolder Data, located under the program folder (usually C:\Program files\Duplicati 2).
One exception is the location of the files that are downloaded by the integrated updater, discussed here:

More info about the problem with missing config after major Windows 10 updates:

1 Like

#33

New user here. This whole service installation sounds horribly hacky, unreliable, and non-robust, tbh. Not to mention updating seems like it would be problematic. The best solution, IMO is for “install as service” to be added as an option by the developers at the installer itself. For an excellent example of how this is done, see the Resilio Sync* Windows installer. Best of all, with Resilio Sync you can transition from tray icon to service via the installer. Just run it again and select the service option.

*I’m not implying Resilio is a competitor, because it isn’t. Just giving an example of a Windows application that does this right.

0 Likes

#34

Hi @jdrch, welcome to the forum!

Thanks for your input & example about service installs. A feature like you’ve described has been discussed (see below), but so far development focus has been on performance and reliability improvements over installation (and even UI) experience.

I expect we’ll get to it at some point, but if you’d like to see it sooner than later and you, or somebody you know, has experience working with installers (or wants to gain some without the normal corporate time pressure) feel free to take a look at the code over at GitHub - duplicati/duplicati: Store securely encrypted backups in the cloud! and add the feature you think is missing. :slight_smile:


1 Like

#35

Appreciate the response. Right now I’ll just stick to running it as a tray icon. I do realize all projects like these have growing pains.

0 Likes

split this topic #37

A post was split to a new topic: Lose settings when changing service user account

0 Likes

#38

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.

1 Like

#39

Microsoft still kills systemprofile in the latest Windows Insider Fast Ring build. While it might not be a big issue in the total user base, the impact may be 100% for this thread. You lose databases with Windows.old in 10 days…

It’s too bad it’s hard to agree on the best spot (mine lives under ProgramData), but systemprofile is a major risk.

0 Likes

#40

Agreed, and while there was some discussion (can’t find it now) about alternatives I don’t know that any decision was made.

I still think the easiest path for now is if SystemProfile is the destination and no content found then an option to “migrate” anything found in Windows.Old or Users folders should be offered.

Bonus benefit - allow running that check even IF SystemProfile is already populated. :slight_smile:

0 Likes

#41

The only path for now may be to remove the systemprofile time bomb from the manual steps. Probably any reasonable folder OTHER than the one that steps now give will be safe from twice-yearly Windows clobber.

I’d think that’s kind of awkward to write into a beautiful step-by-step, so perhaps it’s time to pick something. There are many discussions around (Google can help find them). Maybe we need an “executive decision”.

Sorry to resurrect what’s been said here and elsewhere, but it seems a key issue as steps get polished up. Someday there may be code for this, and for initial install as a Service. Meanwhile, How-To has 8.9k views.

0 Likes

Installed Windows 10 Fall Creators Update - Now Everything is Missing In Duplicati
#42

Does anybody know what causes the tray icon to be automatically launched when users login and how to stop it?

I don’t see anything in the startup folder but this icon is always appearing on login (Windows Server 2012) even after manually quitting it.

0 Likes

#43

Sysinternals Autoruns can find and control launch. On my Windows 10 system, it found tray icon launching in:

C:\ProgramData\Microsoft\Windows\Start Menu\Programs\Startup (agreeing with you finding here).

0 Likes

#44

I’ve build myself a workaround:
I’ve created a planned task that starts the Duplicati GUI at Startup, with the Admin-Rights of my personal user.
This way works with VSS and without login, but could keep all my made settings.
On the other hand the tray icon seems gone for now, but i quite liked it.
The --no-hosted-server parameter only wokrs when its startet as a service, but in my case its startet as the GUI Icon, the icon just never establishes in the tray-bar.
Is there a way to bring it back when I log in?

0 Likes

#45

The problem you’re having is that Duplicati.GUI.TrayIcon.exe is correctly started with privs and your user name, that’s why it works, but if you start it “at startup” it cannot connect to the “desktop” (since no user is logged in yet) and so does not show up in the system tray.

I don’t know any solution to that problem.

0 Likes

#46

Building on @ravisorg post 38

Version 3

Attempts to solve the problem with C:\Windows\System32\config\systemprofile\AppData\Local\Duplicati deleted with windows upgrades (called windows updates in windows 10)

  1. Stop the tray icon if you currently have it running
  2. Create a folder called C:\ProgramData\Duplicati\Data **
    (this is what solves the windows update problem)
    (If you’re running portable, choose a dir under the program directory, eg D:\Duplicati\Data)
    **If you are prompted to give yourself access when accessing folders on the way to C:\ProgramData\Duplicati\Data, confirm that you want to continue or accept.
  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:\ProgramData\Duplicati\Data\Duplicati-server.sqlite
    **If you were running the portable version, your “from” location may be C:\Program Files\Duplicati 2\Data\Duplicati-server.sqlite instead, in which case you might not have to choose a new directory nor move anything, or from might be D:\Duplicati\Data instead, in which case you can leave it there–it’s not subject to the windows 10 update problem.
  4. Open a command prompt as an administrator (right click and select “Run as administrator”) and run Duplicati.WindowService.exe install --server-datafolder=C:\ProgramData\Duplicati\Data in your Duplicati install folder (likely "C:\Program Files\Duplicati 2\Duplicati.WindowsService.exe" install --server-datafolder=C:\ProgramData\Duplicati\Data )
  5. If you get the “Installation has completed” message, you can start the service with sc start Duplicati (or use the Windows “Services” GUI, or reboot, 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, actually if :8300 works, then somethings wrong. Just :8200 should work normally.)
  8. Use the “Move existing database” feature for each existing backup set
    1. Click on one of your backup sets to open its drop-down menu
    2. Click on “Database” under the “Advanced” heading
    3. Under the “Location” section, click in the “Local database path” field. (Note, the buttons underneath are grayed out until the path actually changes.)
    4. Replace the text C:\Users\[your user name]\AppData\Local\Duplicati\ part with C:\ProgramData\Duplicati\Data\ , leaving the XXXXXXXXXX.sqlite part alone. So you’ll end up with something like C:\ProgramData\Duplicati\Data\ABCDEFGHIJ.sqlite
    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.
    6. Repeat these inner steps 1 to 5 (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** (this goes outside (after) the double-quotes) 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.
0 Likes

Fatal error System.Exception: Detected non-empty blocksets with no associated blocks!
Job log-file missing after migrating from user to service installation
Windows Service Alternative
#47

Hi all!

I normally install Duplicati as service because it’s more convenient but I’ve run into a problem. I need to install Duplicati as service in a PC where other service is already listening on port 8200 and cannot be changed. I found that the default port can be changed when using the tray icon but I can’t find how to change it when running as service.

I hope somebody can help, thanks in advance!

0 Likes

#48

Duplicati.WindowsService.exe accepts the same command line options as Duplicati.Server.exe. Just add the --webservice-port to the install command, something like:

Duplicati.WindowsService.exe install --webservice-port=8300
2 Likes

#49

Worked like a charm :grin:

Thank you!

0 Likes