Migrating from User to Service install on Windows

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.

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.

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).

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?

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.

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.WindowsService.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.
9 Likes

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!

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
3 Likes

Worked like a charm :grin:

Thank you!

Thanks John, very helpful consolidated info…

Two notes:
For those that might encounter it… I did get an error when I tried to install the service with the option to locate Duplicati-server.sqlite in the new folder but not because I didn’t have elevated access. Basically the error said the service already existed (apologies for not copying the details). So I first uninstalled the service and then installed with the --server-datafolder option and it was successful.

The other thing is a minor spelling issue that caught me via Copy/Paste.
In the upper portion of step 4 it is written: WindowService.exe (missing the ‘s’) but just below it is correct as WindowsService.exe

Thanks @Daine! I fixed the typos but figured I’d let you handle adding your experience to the Notes section.

The l post is a Wiki so you should be able to edit it directly yourself. :slight_smile:

Thank you so much for this… I just ran into the issue where windows below away all my settings and I had (unfortunately) already cleaned up the windows.old folder due to space constraints.

I had to rebuild my databases, but updated the service to point to a new datafolder location to prevent this from happening again. Cheers!

I’ve run through these steps to install the duplicati as a service, it installed successfully and I can start the service, but I don’t get the GUI, just the unable to connect page.

image

Any idea why? Is there a log file I can look at to try to understand why it’s failing?

You can look around in C:\ProgramData\Duplicati\Data for a duplicati-crashlog.txt.
If that’s not there, what is? That might depend on how far the server startup progressed.

[SOLVED] Is it ok that I see 5 processes of Duplicati in Windows Task manager?
shows perhaps a bigger set than your Task Manager will see, but what do you observe?

No log there, but I have a Duplicati-crashlog.txt file in the C:\ProgramData\Duplicati\updates\ folder but it’s from July. It’s the only crashlog file I could find.

Regarding the running processes I had 3:

I managed to solve the issue like this:
I stopped the service manually, renamed the Duplicati-server.sqlite file and started the service again.
I finally got the web server started and I could access the web GUI with no jobs (I only had 1 previously) and with the default settings.

One thing I noted, I was running the version 2.0.5.111_canary_2020-09-26, but the service launched the version 2.0.3.2_canary_2018-03-16. I had to upgrade again to the latest version, already available on the folder C:\ProgramData\Duplicati\updates\2.0.5.111\

I’m wondering if the issue I’ve seen was due to a mismatch between the db version (last used on 2.0.5.111) and the expected one from the 2+ years old version 2.0.3.2 that was launched.

Anyway, it’s solved. Luckily I had just 1 job and I had a backup of it’s configuration.

Sounds like some sort of version scramble. 2.0.3.2 would have known database version 5 but seen 6.
Installed WindowsService, decided I didn’t like it, tried to go back to Duplicati.GUI.TrayIcon.exe, now crashes on startup is the sort of duplicati-crashlog.txt it gets, except the 4 would be a 5 for your case.

But two questions would be why you don’t find it, and why there are still processes up, after DB error.

Downgrading / reverting to a lower version shows where updates are kept for different ways of install:

Windows
a. C:\ProgramData\Duplicati\updates (most Windows service instances)
b. C:\Users\<Duplicati user account>\AppData\Local\Duplicati\updates\ (most Windows user / tray-icon instances)

so one might think it left a non-service-install update behind in your user profile, except you say it was alaready where it should be for a service (are there dates on files to show how long it was installed?).

If the problem was still sitting there, one can use Task Manager to check process Properties to check version information by the path to the executable, but it’s too late now. Regardless, I’m glad you’re up.

The renamed Duplicati-server.sqlite might have the old job info in it, but you already set up a new one.

Thank you @johnvk!

The guide works perfectly but I did notice a small issue that may affect some users.

When moving my existing backup sets that contained selections in the User data folders section they will need to be updated to use the full path in the Computer section to get to that users data instead.

This should be expected but I had overlooked it, now that Duplicati is running as under the local system account those selections are no longer valid and you will get an error when trying to run the job something about %documents% not being found or valid (sorry didn’t get a screen cap).

Before the change I was backing up my Desktop and Documents folders as shown in image 1.

Image1
image

Now that Duplicati is running as a service I need to specify my Desktop and Documents folders via full path in the Computer section as shown in image 2. Notice how the User data now only contains Application Data and Home and neither contain anything of use.

Image 2

The next time the backup runs it will take a bit longer than usual while it figures out that nothings really changed but it still has to do some housecleaning on the paths.

I also renamed the Duplicati folder in my user profile to C:\Users\Jimbo\AppData\Local\DuplicaiOld so I don’t accidentally launch the “old” tray config (which will now run @ 8300) but that is totally optional and will be deleted once I’m confident I’ve update all my trayicon shortcuts.

Adding the --no-hosted-server to the tray icon worked like a charm for me, don’t forget to update the shortcut on the Start Menu, right-click More, click Open File Location. In the window that opens right-click on the Duplicati 2 icon and add the --no-hosted-server to the end of the target path. Can also be found directly via C:\ProgramData\Microsoft\Windows\Start Menu\Programs

My power shell script still runs jobs like it should and VSS is now working so I’m really quite pleased, thanks again.

3 Likes

If you use the Tray Icon and have password protection on the web user interface, then you will need to add additional parameters to the Tray Icon shortcut for it to work, after migrating Duplicati to a service.

Open the folder: C:\ProgramData\Microsoft\Windows\Start Menu\Programs\StartUp
Right-click the ‘Duplicati 2’ Shortcut → Properties → Remove what is currently in the ‘Target’ field and replace it with (adjust the path accordingly between the quotes of --server-datafolder=“”):

Duplicati.GUI.TrayIcon.exe --no-hosted-server --server-datafolder="<path_to_Duplicati_data_folder>" --read-config-from-db

So, for example, in the latest instructions in post 46 from @johnvk , the Duplicati Data Folder is now at “C:\ProgramData\Duplicati\Data” (where the sqlite files now are), so the ‘Target’ field of the ‘Duplicati 2’ shortcut should be:

Duplicati.GUI.TrayIcon.exe --no-hosted-server --server-datafolder="C:\ProgramData\Duplicati\Data" --read-config-from-db

duplicati_tray_icon_data_folder

Furthermore, as @JimboJones points out, in the same way, don’t forget to also correct the (actual) Start Menu shortcut in the folder of: C:\ProgramData\Microsoft\Windows\Start Menu\Programs (scroll to find it in there!)
…and you may also find a shortcut on your Desktop, which also requires correcting in the same way (located in: C:\Users\Public\Desktop).

(Thanks to @kees-z for originally posting the shortcut fix and also to @johnvk for the service migration instructions).

1 Like

Yes, the spelling mistake is still present and it also caught me out today! Please could a moderate correct it?
In this post, step 4, it says:

Open a command prompt as an administrator (right click and select “Run as administrator”) and run Duplicati.WindowService.exe install

It is missing the ‘s’ after ‘.Window’, it should be:

and run Duplicati.WindowsService.exe install

Thank you so much!

Spelling has been fixed. Thanks for noticing it.

1 Like