Startup using system user service

Hi,

I try to startup Duplicati 2.0.2.12 using a systemd user session, but it always fails:

% systemctl --user status duplicati.service   
● duplicati.service - Duplicati
   Loaded: loaded (/usr/lib/systemd/user/duplicati.service; enabled; vendor preset: enabled)
   Active: failed (Result: exit-code) since Mon 2017-11-06 19:18:01 CET; 15h ago
  Process: 725 ExecStart=/usr/bin/mono /opt/duplicati-latest/Duplicati.GUI.TrayIcon.exe --webservice-port=8200 (code=exited, status=1/FAILURE)
 Main PID: 725 (code=exited, status=1/FAILURE)

Nov 06 19:17:59 horus systemd[719]: Started Duplicati.
Nov 06 19:18:01 horus mono[725]: Server gestartet und hört auf 127.0.0.1, Port 8200
Nov 06 19:18:01 horus mono[725]: (Duplicati.GUI.TrayIcon:732): Gtk-WARNING **: cannot open display:
Nov 06 19:18:01 horus systemd[719]: duplicati.service: Main process exited, code=exited, status=1/FAILURE
Nov 06 19:18:01 horus systemd[719]: duplicati.service: Failed with result 'exit-code'.

Using the same service file to start up manually after login, it works just fine.

The service file:

[Unit]
Description=Duplicati

[Service]
ExecStart=/usr/bin/mono /opt/duplicati-latest/Duplicati.GUI.TrayIcon.exe --webservice-port=8200
Restart=on-abort

[Install]
WantedBy=default.target

I also tried to add

[Service]
Environment=DISPLAY=:0

but that changed nothing.

Thanks,
Florian

Hi Horus, am I understanding correctly that you are trying to start the tray icon even when you’re not logged in?

Normally one would use systemctl duplicati enable for the “nobody is logged on” systemd server and then duplicati --no-hosted-server --hosturl=http://localhost:8200 for the “somebody logged on and wants the tray icon” helper icon.

Note that enable only sets the Duplicati server to run at next startup, systemctl duplicati start can be used to start the server immediately (but it won’t “stick” through a reboot).

No, a systemd user service starts together with the user session. Thats when the user logs in. I am trying to start duplicati and the tray icon when I log in.

Ok. My distribution ships a service file for a user session duplicati-user.service - aur.git - AUR Package Repositories which tricked me into believing that it could be started that way.

What is the recommended way of starting duplicati --no-hosted-server ... ? XDG autostart with desktop file?

Sure.

Good to know, thanks! It takes a while to drown out decades of Windows experience with more useful Linux knowledge. :slight_smile:

Unfortunately, that also means we’ve reached the end of my help-ability here. I expect a more Linux focused member to be along shortly to help answer your questions (and enlighten me).

Looking at the AUR file, I think that would probably fail. The tray-icon needs the window manager to be present, but if you start it on login, that is before the WM is ready (for the user).

Perhaps you can have a dependency on the WM in the service file?

Otherwise, I would go with a simple file like described here (depending on what WM you have of course):