Skip to content

Set HOME to private /tmp for borgbackup

borg writes to $HOME/.config but in our case it also works on $HOME (/var/vmail).

This could cause the following error when running the backup: file changed while we backed it up

× borgbackup.service - borgbackup
     Loaded: loaded (/etc/systemd/system/borgbackup.service; linked; preset: ignored)
    Drop-In: /nix/store/8iqfrm23vqm9vb4dhfrkm2gp53rhds65-system-units/service.d
             └─10-all-failure-handler.conf
     Active: failed (Result: exit-code) since Tue 2025-01-21 11:00:14 UTC; 54ms ago
   Duration: 11.283s
 Invocation: 1712129869394f1f8eabc4cd26d3ab4c
TriggeredBy: ● borgbackup.timer
       Docs: man:borgbackup
    Process: 78255 ExecStart=/nix/store/khkr1l6395czf0sn79i0kmfp7pvimlm5-unit-script-borgbackup-start/bin/borgbackup-start (code=exited, status=1/FAILURE)
   Main PID: 78255 (code=exited, status=1/FAILURE)
         IP: 16.6K in, 18.8K out
         IO: 24K read, 628K written
   Mem peak: 66.2M
        CPU: 1.887s

Jan 21 11:00:02 revelations systemd[1]: Started borgbackup.
Jan 21 11:00:13 revelations borgbackup-start[78267]: /var/vmail/.config/borg/security/25276a6702fe342e099d0c711d20ff31752131884fd017bf76c0169ba84682b2/nonce: file changed while we backed it up
Jan 21 11:00:14 revelations systemd[1]: borgbackup.service: Main process exited, code=exited, status=1/FAILURE
Jan 21 11:00:14 revelations systemd[1]: borgbackup.service: Failed with result 'exit-code'.
Jan 21 11:00:14 revelations systemd[1]: borgbackup.service: Triggering OnFailure= dependencies.
Jan 21 11:00:14 revelations systemd[1]: borgbackup.service: Consumed 1.887s CPU time, 66.2M memory peak, 24K read from disk, 628K written to disk, 16.6K incoming IP traffic, 18.8K outgoing IP traffic.

This commit fixes it by setting HOME to private /tmp for borg.

Merge request reports

Loading