MacOS / OSX service installation

I guess using open should take care of mono’s path. Although it seems I still need to pass --hosturl="http://localhost:8200" --no-hosted-server for it to work. I have updated net.duplicati.tray-icon.plist accordingly.

I did finally test the plists which seem to work, albeit with a couple of glitches:

  • The tray icon is always in the “error” mode, except when a backup is running. Yet the Web-GUI shows no errors or warnings whatsoever
  • The “Show Log” section of the Web-GUI doesn’t show any logs, even after running a couple of backups.

I think the two could be related, but I am not certain exactly what is causing this problem.

Heh. I too got around to testing today.

I found the service plist to work quite well, though in an unrelated issue I’m having permission issues between user accounts.

I didn’t have time to test the tray icon. Note that your “always error” icon might be related to a known install issue that is resolved by forcing an error (and subsequent icon reset) such as by starting then canceling a backup.

1 Like

I tried the net.duplicati.tray-icon.plist file in /Library/LaunchAgents but for some reason the auto-start (and manual start) tray icon is still opening to port 8300 .

I thought 8200 was the default port. Why would the tray icons open to 8300? :thinking:

Did you remove the regular Duplicati autostart from System Prefs->User->Login Items?

Yes, 8200 is the DEFAULT port - but when dealing with multiple “users” (including the service, if running) startup order can cause things to get messy.

I understand this behaviour when multiple users are each running their own Duplicati service + tray icon; but I wonder why this would happen when there is only a single instance of the service running as the root?

You are correct - if the service is the only Duplicati server running, then this wouldn’t happen as even individual users would be connecting to the same service server.

If there was something using port 8200 when the instance running as root started, it will try another port, and from then on it remembers which port worked and starts with that as the first attempt.

So maybe something else was using port 8200 ?

I’m having similar issues. I have the two .plist files in /Library/LaunchAgents and /Library/LaunchDaemons; both specify port 8200 and the tray-icon one specifies no-hosted-server.

However somehow I’ve ended up with my config using 8300, so when I start my system from scratch, neither localhost:8200 nor opening from the menu shows my config. I have to quit the menu and reopen Duplicati from /Applications (to launch on 8300) to see my config.

How do I get my config back on port 8200?

I’d have to test but I think the issue might be that you are telling the tray-icon one (is that LaunchAgents?) both a port number (which says “use this port for your server”) AND --no-hosted-server (which says “don’t host your own server”) so it’s getting conflicting parameters.

I suspect if you quit the tray-icon (right click on it and select Quit) port 8300 will stop working but port 8200 will continue to load. This means that the daemon/service is loading first (and taking port 8200) then the tray-icon is loading TRIES for port 8200 but sees it’s in use so moves on to port 8300.


Unless you’ve already got a big backup created or a lot of jobs configured, the easiest way to shift from port 8300 (tray-icon) to port 8200 (daemon/service) is probably to export the job from one then import into the other.

I’d then suggest renaming the port 8300 job to something like “DO NOT USE” or “WRONG PORT!” - that way if this happened again you’d have a visual notice of what was going on rather than “crap, all my configs disappeared!”. If you do decide to delete the 8300 job (after confirming it works at port 8200) make sure to only delete the config. You can delete the database only if you didn’t point the port 8200 job to the old port 8300 .sqlite file. (If you do delete the database, that’s OK - it can be recreated, but it takes a while for Duplciati to chunk through every thing.

Unless you’re planning to start your backups from scratch, whatever you do, DO NOT delete the destination files as this is your already backed up content. If you delete that there’s no recovering it - you’ll just have to start your backups from the beginning again.

1 Like

Thank you for the response :+1:

You’re exactly right in your analysis; I tried to export my config from 8300 to 8200 but this caused problems with some of my source file paths.

However, I realise I was over-complicating things for myself. I have removed both plist files and have simply added Duplicati.app to my login items. I only have one user on this machine so this works well enough for me.

Slight disadvantage though is that this causes the browser to open at http://localhost:8200/ on login but I can live with that (perhaps an option to control this could be included in a future release).

You mean when you log in your browser opens to Duplicati? If so,that’s odd as I have a similar set-up (i think) but that doesn’t happen to me…

My mistake; I must have had “reopen windows on login” selected when I logged off… Didn’t happen to me just now after a restart :flushed:

As you were!

1 Like

Hope I can jump in this thread as I’m having a similar issue. If you want, I can create a new thread if that is better…

Summary of my issue:

  • I created the 2 plists per above and put them in the appropriate directories
  • When I start up, the icon has a X in it
  • If I select open on the open, it opens a web page (8200) but it doesn’t have any backup sets in it
  • If I try launching the app, nothing happens
  • If I try going to 8300 it can’t find anything

I originally just added the app to my start up items, but like the others, it launches the web browser upon log in. I made sure ‘reopen windows at login’ in not selected, and I even quit safari prior to logging out.

Any ideas? I assume this is working successfully for someone.

Thanks!

This may not apply to you, but it is a known scenario for the icon to show the “X” if no jobs have been run yet.

What backups are you expecting to see? Did you already create some that “disappeared” when you shifted to service installation?

What “app” are you trying to open? Other than the GUI (which is the tray icon / web interface) things are pretty much all command line, so it’s possible the shell is opening, showing an error message or help screen then closing again before you can see it.

Port 8300 should only come into play if you’re running more than one instance of Duplicati, such as the service and self-serving try icon or perhaps a self-serving tray icon in two different user logins.

Thanks, Jon. I guess i could have been more clear…

This is happening on 3 different macs. But I’m doing it the same way on all three, so I’m not surprised it is consistent…

Prior to installing the plist files, I created multiple duplicate jobs. I ran them a couple of times and they worked as expect.

I then added the plist files and restarted the machine. When I logged in, I noticed the icon had an X in it. When i clicked open in the icon, the webpage did not chow any jobs scheduled. I expected to see the ones I had created/run before.

Here is where things are not always consistent. Some times, if I select quit in the icon, I can then launch the duplicate app and things work as expected-- the icon shows up without the X and the webpage shows my expected job. Other times, after selecting quit in the icon, I cannot launch the duplicati app-- nothing happens.

I only have the 2 duplicati related plist files:

  1. net.duplicati.server.plist in /Library/LaunchDaemons/
  2. net.duplicati.tray-icon.plist in /Library/LaunchAgents
    They are unmodified from the the ones linked above.

Above you mention different user logins. The 2 plists are owned by root. They have the same owner, group, and permissions as the other plists in their respective directories. The user that I’m logging in as when I try running a backup is not root.

When it is working (after I logged in, quit the one that auto started, and relaunched the duplicati app), the following processes are running SUCCESSFULLY:

As root:
Duplicati Server Duplicati.Server.exe --webservice-port=8200
/bin/bash /Applications/Duplicati.app/Contents/MacOS/duplicati-server --webservice-port=8200

As user:
Duplicati Duplicati.GUI.TrayIcon.exe
/System/Library/Frameworks/Python.framework/Versions/2.7/Resources/Python.app/Contents/MacOS/Python /Applications/Duplicati.app/Contents/Resources/OSXTrayHost/osx-trayicon-rumps.py
/bin/bash /Applications/Duplicati.app/Contents/MacOS/duplicati

Is which jobs it is running tied to the tray icon? So now it is running the user jobs where as before the tray icon (I think) was running at root so it was looking for root jobs?
Just speculating… Maybe going down a rabbit hole…

Appreciate the help

Nope, I think you’re on the right track.

I’m a bit rusty on this (and don’t have access to a Mac to test) so somebody please correct me if I’m misremembering…

Basically, Duplicati as tray-icon ONLY stores things in ~/.config/Duplicati (so user specific) while Duplicati as a service /daemon stores things in /root/.config/Duplicati (or possibly /private/var/root/.config/Duplicati/).

If you look in those folders you should see (among other things):

  • dbconfig.json (list of jobs)
  • Duplicati-server.sqlite (Duplicati global settings & logs)
  • ABCDEFGHIJ.sqlite (job specific settings & logs)

So assuming you have NOTHING you care about in the service / daemon “version” you should be able to copy the files out of ~/.config/Duplicati to /root/.config/Duplicati and things should work as expected.

Note that if it DOES work, you might want to either consider deleting the user-specific ~/.config files OR running in that mode and renaming a job to something like “You are in user mode - go find service mode!”.

1 Like

Little long… Trying to explain my understanding and make sure I get it…

I understand that things are stored in ~/.config/Duplicati

If I run normal (launching the app myself as a user), it would store my jobs in ~user/.config/Duplicati. If the plists are owned by root, and they launch duplicati at startup, they would look for my jobs in ~root/.config/Duplicati. Obviously, they are not there, so the job list is empty. That makes sense to me.

When I run duplicate as a user, I see the following run:

$ ps aux |grep -i duplica
st                 567   0.0  0.5  4189112  39892   ??  S     8:12PM   0:01.04 /System/Library/Frameworks/Python.framework/Versions/2.7/Resources/Python.app/Contents/MacOS/Python /Applications/Duplicati.app/Contents/Resources/OSXTrayHost/osx-trayicon-rumps.py
st                 499   0.0  0.6  4310468  47420   ??  S     8:12PM   0:01.72 Duplicati Duplicati.GUI.TrayIcon.exe 
st                 451   0.0  0.0  4226288   1100   ??  S     8:12PM   0:00.00 /bin/bash /Applications/Duplicati.app/Contents/MacOS/duplicati --hosturl="http://localhost:8200" --no-hosted-server
root               108   0.0  1.1  4498896  92644   ??  S     8:12PM   0:02.63 Duplicati Server Duplicati.Server.exe --webservice-port=8200
root               110   0.0  0.0  4299788   1100   ??  Ss    8:12PM   0:00.01 /bin/bash /Applications/Duplicati.app/Contents/MacOS/duplicati-server --webservice-port=8200
st                 1247   0.0  0.0  4278252    872 s000  S+    8:19PM   0:00.00 grep -i duplica

some of it is run as root and some is run my user (st).

When I run duplicati via plist owned by root at startup, all is run by root. So I’m thinking that the part that looks for the jobs is in the tray icon code <-- speculation, need to confirm. If it was run by the user, so it would look in ~user/.config/Duplicati

So, what I did was move the tray icon plist from /Library/LaunchAgents to ~/Library/LaunchAgent. That way it is run by the user. I restarted, and now I see:

st                 529   0.0  0.5  4420112  39892   ??  S     8:35PM   0:01.04 /System/Library/Frameworks/Python.framework/Versions/2.7/Resources/Python.app/Contents/MacOS/Python /Applications/Duplicati.app/Contents/Resources/OSXTrayHost/osx-trayicon-rumps.py
st                 487   0.0  0.6  4391568  47420   ??  S     8:35PM   0:01.72 Duplicati Duplicati.GUI.TrayIcon.exe --hosturl="http://localhost:8200" --no-hosted-server
st                 483   0.0  0.0  4273588   1100   ??  S     8:35PM   0:00.00 /bin/bash /Applications/Duplicati.app/Contents/MacOS/duplicati --hosturl="http://localhost:8200" --no-hosted-server
root               169   0.0  1.1  4460196  92644   ??  S     8:35PM   0:02.63 Duplicati Server Duplicati.Server.exe --webservice-port=8200
root               100   0.0  0.0  4287788   1100   ??  Ss    8:35PM   0:00.01 /bin/bash /Applications/Duplicati.app/Contents/MacOS/duplicati-server --webservice-port=8200
st                 687   0.0  0.0  4267752    872 s000  S+    8:37PM   0:00.00 grep -i duplica

OK. Tray stuff is running as user, but still no luck.

I notice that when I run via startup, the the tray icon command looks like:

Duplicati Duplicati.GUI.TrayIcon.exe --hosturl="http://localhost:8200" --no-hosted-server

When I run by opening the application, it looks like:

Duplicati Duplicati.GUI.TrayIcon.exe

So i modified the plist file to remove the extra switches, restarted, and IT SORT OF WORKS!

  • The icon doesn’t have the X in it anymore.

  • When i click on the icon and select open it brings up a webpage on port 8300. Hmm-- see below

  • The webpage shows my jobs!! (In my case, I had on outstanding, so it started to run it)

  • The first time it brought up the webpage, it had this popup error-- Missing XSRF Token

  • After click OK to close the error window, I stopped my job and tried editing the configuration. When I got to the last step, clicking OK would do nothing.

  • I closed the webpage, reopened it via the icon, didn’t get the error message and was able to successfully edit the configuration

Questions I currently have:

  • Why port 8300? If I look at the Duplicati jobs running, I only see port 8200:

      $ ps aux | grep -i duplica
      st                 421   0.0  1.5  4526060 127724   ??  S     8:47PM   9:48.28 Duplicati Duplicati.GUI.TrayIcon.exe
      st                 417   0.0  0.0  4270516   1084   ??  S     8:47PM   0:00.01 /bin/bash /Applications/Duplicati.app/Contents/MacOS/duplicati
      root               161   0.0  0.9  4440516  73600   ??  S     8:46PM   0:02.82 Duplicati Server Duplicati.Server.exe --webservice-port=8200
      st                 778   0.0  0.0  4286184    920 s001  S+    9:01PM   0:00.01 grep -i duplica
      root               100   0.0  0.0  4279596   1100   ??  Ss    8:46PM   0:00.01 /bin/bash /Applications/Duplicati.app/Contents/MacOS/duplicati-server --webservice-port=8200
      st                 699   0.0  0.5  4427592  40288   ??  S     8:58PM   0:01.05 /System/Library/Frameworks/Python.framework/Versions/2.7/Resources/Python.app/Contents/MacOS/Python /Applications/Duplicati.app/Contents/Resources/OSXTrayHost/osx-trayicon-rumps.py
    

If I go to 8200, it cannot connect to the server.

  • What is Missing XSRF Token? Something I need to worry about?

  • What are they switches in the plist that I removed. Are they needed?

I’m not sure if I’m doing thing correctly, or if I’m setting myself up for failure. Backups are kind of important so I want to make sure I’m doing it the right way.

I want to get this working. How are others running? What am i doing different?

Thanks in advance

That’s good detective work there!

This is a bit difficult to explain, so I apologize up front if it’s a bit rambling…oh, and this all assumes default settings. :slight_smile:


Duplicati has two parts - the “server” and the client (Tray Icon / web GUI).

How (and by whom) the server is executed controls where settings and jobs are stored. So if the server is executed by root, they get stored in /root/.config/Duplicati. If the server is executed by the user, they get stored in ~/.config/Duplicati (aka /[users]/.config/Duplicati).

By default the Tray Icon client creates it’s own server - so if you run the Tray Icon as yourself, settings / jobs will come from ~/.config/Duplicati but if you sudo run the Tray Icon as root they’ll come from /root/.config/Duplicati.

Adding the --no-hosted-server parameter to the Tray Icon call tells it to attach to an existing server rather than start it’s own.

The reason you’re getting the X when attached to the root executed service / daemon is because that set of configs (in /root/.config/Duplicati) has never had a job run against it.

The reason you don’t see your jobs when attached to the root executed service / daemon is because it’s looking in /root/.config/Duplicati for settings / jobs, but the ones you created running as “USER” are stored in /USER/.config/Duplicati.

You can resolve this in a few ways, but the easiest ones are probably:

  • copy the /USER/.config/Duplicati files to /root/.config/Duplicati
  • use the --server-datafolder parameter in your /Library/LaunchAgents plist file to tell the root run server to get it’s data from /USER/.config/Duplicati (instead of the default /root/.config/Duplicat). Though personally I would not recommend this option.
  • use the --server-datafolder parameter in your ~/Library/LaunchAgent plist file to tell the user run server to get it’s data from /root/.config/Duplicati (instead of the default ~/.config/Duplicati). Note that you might run into permission issues with this option
  • run your Tray Icon as root

Note that if you want backups to run whether or not you’re logged into the machine you’ll want to attach to the service / daemon server on port 8200 by using the --no-hosted-server parameter in your user specific ~/Library/LaunchAgent plist file.


Note that the Tray Icon is NOT needed for the service / daemon process to actually run backups. You can skip the ~/Library/LaunchAgent Tray Icon plist and just manually open a browser page to localhost:8200 (that’s what I do via a browser bookmark).

The service / daemon runs before any user login stuff, so it grabs port 8200. When the user logon Tray Icon runs, if it does NOT have the --no-hosted-server parameter then it will start it’s own server. Since the default port 8200 is already in use, it will try to use port 8300. If that’s in use it will go to port 8400, then 8500, etc.


The XSRF error is a known issue with “older” versions of Duplicati. It’s not anything to worry about since it just means the web GUI client couldn’t talk to the server. Refresh the web page until the error goes away and you should be fine.


Does any of that make sense or have I just confused you more? :slight_smile: