RESTIC: rest-server - systemd

I have searched the existing open and closed issues

  • DietPi version
    G_DIETPI_VERSION_CORE=9
    G_DIETPI_VERSION_SUB=9
    G_DIETPI_VERSION_RC=0
    G_GITBRANCH=‘master’
    G_GITOWNER=‘MichaIng’
    G_LIVE_PATCH_STATUS[0]=‘applied’
    G_LIVE_PATCH_STATUS[1]=‘applied’
    G_LIVE_PATCH_STATUS[2]=‘not applicable’
    G_LIVE_PATCH_STATUS[3]=‘not applicable’

  • Distro version
    bookworm 0

  • Kernel version
    Linux DietPi 6.1.21-v8+ #1642 SMP PREEMPT Mon Apr 3 17:24:16 BST 2023 aarch64 GNU/Linux

  • Architecture
    arm64

  • SBC model
    RPi 3 Model B+ (aarch64)

I am trying to setup the rest-server.service on my above mentioned device.
I have downloaded this binary: https://github.com/restic/rest-server/releases/download/v0.13.0/rest-server_0.13.0_linux_arm64.tar.gz
Furthermore i added this rest-server.service file:
rest-server/examples/systemd/rest-server.service at 2513a698f353d757bc1a158ce01a105858b41f66 · restic/rest-server · GitHub

I am struggling what “User” and “Group” to use.
I am unable getting this thing up and running in dietpi-services aplication.
This is what i edited in /etc/systemd/system/rest-server.service so far:

[Unit]
Description=Rest Server
After=syslog.target
After=network.target
Requires=rest-server.socket
After=rest-server.socket

[Service]
Type=simple
# You may prefer to use a different user or group on your system.
User=dietpi
Group=root
ExecStart=/usr/local/bin/rest-server --path /mnt/dietpi_userdata/backup
Restart=always
RestartSec=5

# The following options are available (in systemd v247) to restrict the
# actions of the rest-server.

# As a whole, the purpose of these are to provide an additional layer of
# security by mitigating any unknown security vulnerabilities which may exist
# in rest-server or in the libraries, tools and operating system components
# which it relies upon.

# IMPORTANT!
# The following line must be customised to your individual requirements.
ReadWritePaths=/mnt/dietpi_userdata/backup

# Makes created files group-readable, but inaccessible by others
UMask=027

# If your system doesn't support all of the features below (e.g. because of
# the use of an older version of systemd), you may wish to comment-out
# some of the lines below as appropriate.
#CapabilityBoundingSet=
#LockPersonality=true
#MemoryDenyWriteExecute=true
#NoNewPrivileges=yes

# As the listen socket is created by systemd via the rest-server.socket unit, it is
# no longer necessary for rest-server to have access to the host network namespace.
PrivateNetwork=yes

#PrivateTmp=yes
#PrivateDevices=true
#PrivateUsers=true
#ProtectSystem=strict
#ProtectHome=yes
#ProtectClock=true
#ProtectControlGroups=true
#ProtectKernelLogs=true
#ProtectKernelModules=true
#ProtectKernelTunables=true
#ProtectProc=invisible
#ProtectHostname=true
#RemoveIPC=true
#RestrictNamespaces=true
#RestrictAddressFamilies=none
#RestrictSUIDSGID=true
#RestrictRealtime=true
# if your service crashes with "code=killed, status=31/SYS", you probably tried to run linux_i386 (32bit) binary on a amd64 host
#SystemCallArchitectures=native
#SystemCallFilter=@system-service

# Additionally, you may wish to use some of the systemd options documented in
# systemd.resource-control(5) to limit the CPU, memory, file-system I/O and
# network I/O that the rest-server is permitted to consume according to the
# individual requirements of your installation.
#CPUQuota=25%
#MemoryHigh=bytes
#MemoryMax=bytes
#MemorySwapMax=bytes
#TasksMax=N
#IOReadBandwidthMax=device bytes
#IOWriteBandwidthMax=device bytes
#IOReadIOPSMax=device IOPS, IOWriteIOPSMax=device IOPS
#IPAccounting=true
#IPAddressAllow=

[Install]
WantedBy=multi-user. Target

What can i do to get this up & running. Thx. in advance.
BTW: The server itself is running just fine if launched manually:

rest-server --path /mnt/dietpi_userdata/backup --no-auth

simply share an error message

systemctl start rest-server.service
systemctl status rest-server.service
journalctl -u rest-server.service

systemctl start rest-server.service

Failed to start rest-server.service: Unit rest-server.service has a bad unit file setting.
See system logs and 'systemctl status rest-server.service' for details.

systemctl status rest-server.service

Warning: The unit file, source configuration file or drop-ins of rest-server.ser                                                                                                             vice changed on disk. Run 'systemctl daemon-reload' to reload units.
○ rest-server.service - Rest Server
     Loaded: bad-setting (Reason: Unit rest-server.service has a bad unit file s                                                                                                             etting.)
    Drop-In: /etc/systemd/system/rest-server.service.d
             └─dietpi-services_edit.conf
     Active: inactive (dead)

Jan 21 16:51:05 DietPi systemd[1]: rest-server.service: Service has more than on                                                                                                             e ExecStart= setting, which is only allowed for Type=oneshot services. Refusing.
Jan 21 17:20:14 DietPi systemd[1]: rest-server.service: Service has more than on                                                                                                             e ExecStart= setting, which is only allowed for Type=oneshot services. Refusing.
Jan 21 17:21:10 DietPi systemd[1]: rest-server.service: Service has more than on                                                                                                             e ExecStart= setting, which is only allowed for Type=oneshot services. Refusing.
Jan 21 17:21:46 DietPi systemd[1]: rest-server.service: Service has more than on                                                                                                             e ExecStart= setting, which is only allowed for Type=oneshot services. Refusing.

journalctl -u rest-server.service

Jan 21 16:51:05 DietPi systemd[1]: rest-server.service: Service has more than one ExecStart= setting, which is only allowed for Type=oneshot services. Refusing.
Jan 21 17:20:14 DietPi systemd[1]: rest-server.service: Service has more than one ExecStart= setting, which is only allowed for Type=oneshot services. Refusing.
Jan 21 17:21:10 DietPi systemd[1]: rest-server.service: Service has more than one ExecStart= setting, which is only allowed for Type=oneshot services. Refusing.
Jan 21 17:21:46 DietPi systemd[1]: rest-server.service: Service has more than one ExecStart= setting, which is only allowed for Type=oneshot services. Refusing.

I guess you accidentally created a drop in configuration that duplicates your service definition now

You can check following for available files

systemctl cat rest-server.service

I think you are right …

# /etc/systemd/system/rest-server.service.d/dietpi-services_edit.conf
# /etc/systemd/system/rest-server.service

How to resolve that properly? As a matter of fact it’s obvious that i do not understand the concept of dietpi-services. How and where to add a .service file properly to make it work/manageable within the DietPi cosmos :wink:

Remove this configuration file and restart the service

Hi. Problem solved. Thx. I got it up and running NOT using the supplied, more complex dietpi-services_edit.conf but a pretty simple version like below:

[Unit]
Description=Restic Server
After=syslog.target
After=network.target

[Service]
Type=simple
User=root
ExecStart=/usr/local/bin/rest-server --path /mnt/1234567890/backups --no-auth
Restart=always
RestartSec=5

[Install]
WantedBy=multi-user.target

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.