Problems running as root

I’m on Arch Linux and trying to backup some root dirs.

I have duplicati running as a service (sudo systemctl enable duplicati). Top command shows me (not root) as “User” for processes involving duplicati and mono-sgen.

I’m not quite sure how to proceed from here. I’m getting 106 errors due to access on my attempts to backup /etc/.

Thanks

The user can be specified in the systemd file.

$ systemctl status duplicati
● duplicati.service - Duplicati web-server
   Loaded: loaded (/usr/lib/systemd/system/duplicati.service; disabled; vendor preset: disabled)

Editing /usr/lib/systemd/system/duplicati.service so that it has the User=root variable defined under Service

[Unit]
Description=Duplicati web-server
After=network.target

[Service]
User=root
Nice=19
IOSchedulingClass=idle
EnvironmentFile=-/etc/sysconfig/duplicati
ExecStart=/usr/bin/duplicati-server $DAEMON_OPTS

[Install]
WantedBy=multi-user.target

Then reloading system and restarting Duplicati

$ sudo systemctl daemon-reload
$ sudo systemctl restart duplicati.service
2 Likes

That did it. Thanks.

Alright, this is weird.

I made the change to duplicati.service you suggested and it was working.

I had copied my ~/.config/Duplicati folder to /root/.config/Duplicati (so I didn’t have to recreate my profiles, etc) and was having success.

Then I wanted to pause duplicati and try to play some games (something is eating up my ram; is it mono-sgen, which keeps auto-spawning). I’m never to confident in the pause function, as it still displays transfer rates.

So I stopped the upload, then disabled and stopped duplicati.

When I restarted duplicati, my backup’s configuration was missing the source dirs added and other advanced option configurations changed while I was (I assume) running it as root.

It reverted back to running as a user. I can confirm this because:

  • removing contents of /home/user/.config/Duplicati removed my backup profiles from the web interface
  • copying contests of /root/.config/Duplicati to /home/user/.config/Duplicati reverted to the source dirs, advanced settings, etc I had changed while running as root.

my duplicati.service file:

[Unit]
Description=Duplicati
After=network.target

[Service]
ExecStart=/usr/bin/mono /opt/duplicati-latest/Duplicati.Server.exe      --webservice-port=8200
Restart=on-failure
User=root
Group=duplicati

[Install]
WantedBy=default.target

EDIT: It looks like I got it working again. I think what did it (but I’m not sure) is su to root, then start the service. Sudo systemctl didn’t seem to do it… which doesn’t seem quite right.

It’s not necessary to su before starting the service, so this sounds pretty odd.

1 Like

yeah, it doesn’t make a bit of sense to me. I’ll have to test some more. But I think I’ll wait till my backups are complete, as I don’t currently have a legitimate backup (just a sub folder on my local storage drive… bad form, I know. I have a separate drive that will be read-only (except when writing backups via rsync) on the way).

1 Like