You are not logged in.
I have a set of systemd.service and .timer files to automatically back up my laptop to my home server via rsync. They used to work pretty well, but yesterday I noticed that they stopped doing that some time ago (not quite sure when, so I can't pinpoint the update that did this, unfortunately). So far, I have had no luck debugging, so I thought I'd turn to this forum for help.
The error message in the journal is:
Sep 07 12:05:35 alien-arch systemd[1]: Started daily snapshot backup via rsync-snapshot script.
Sep 07 12:05:35 alien-arch systemd[1]: Dependency failed for rsync-snapshot backup.
Sep 07 12:05:35 alien-arch systemd[1]: rsync-snapshot.service: Job rsync-snapshot.service/start failed with result 'dependency'.
However, if I then start the service manually, via CLI, then it runs without any error messages. What's going on here?
Here is the .timer file:
[Unit]
Description=daily snapshot backup via rsync-snapshot script
After=multi-user.target remote-fs.target
[Timer]
OnCalendar=10:00
Persistent=true
Unit=rsync-snapshot.service
[Install]
WantedBy=timers.target
The actual service file:
[Unit]
Description=rsync-snapshot backup
Requires=remote-fs.target
After=remote-fs.target multi-user.target
RequiresMountsFor=/mnt/r-harch/snapshot.001
[Service]
Type=oneshot
ExecStart=/usr/bin/rsync-snapshot.sh
And the relevant line in fstab:
Rumpelwicht:/volume1/Honk-Arch /mnt/r-harch nfs4 rsize=32768,wsize=32768,users,noauto,x-systemd.automount,x-systemd.device-timeout=10,nofail,x-systemd.requires=network-online.target,x-systemd.idle-timeout=1min 0 0
Last edited by Taijian (2017-09-07 12:44:51)
Offline
The timer has triggered at 12:05:35, while it has 'OnCalendar=10:00'. That can happen if the machine was not active at 10:00 and was re-started later at 12:05 after the OnCalendar time.
Is the machine rebooted each day?
If the service works when started manually but not when triggered by the timer with a 'Dependency failed' error, it's probably that the connection to the remote server was not ready yet. It's probably a synchronization problem at the machine startup, or the connection was down.
You could see all the sequence in the entire systemd journal.
And I am not sure you need 'After=multi-user.target remote-fs.target' for the timer, because the timer can start without remote-fs.target (it's the service that needs it).
Also I am not sure you need the 'Requires=' and the 'After=' lines of the service, because remote-fs.target is already a dependency of multi-user.target, and so should already be active when the timer triggers it.
'RequiresMountsFor=/mnt/r-harch/snapshot.001': is not '/mnt/r-harch' the mountpoint, as shown in the fstab entry, and 'snapshot.001' a file which should not be mounted?
Offline