Skip to content

Local backup succeeded but remote backup failed (Running as a systemd service) #363

@ViciousBadger

Description

@ViciousBadger

Hey, I'm having a strange issue with remote backups, probably related to systemd's handling of $PATH and such.

I run my server in a systemd service because it generally works well, auto-restarts on failure and lets me run remote commands etc.

Here is the service file: (The /nix/store/[...] paths are because I run NixOS)

[Install]
WantedBy=default.target

[Service]
Environment=PATH=$PATH:/nix/store/h2zihm0hb2n4ha5g96prrmgi71ixxvlr-git-2.47.1/bin:/nix/store/755838ir1rbivbx7hfd95d5qhlxw5iaa-git-lfs-3.5.1/bin
ExecStart=/nix/store/4sz9aqdvqrpnawdxlvjbaxrmwn8ivivf-start-minecraft-server
Restart=on-failure
RestartSec=10
Sockets=minecraft.socket
StandardError=journal
StandardInput=socket
StandardOutput=journal
StartLimitBurst=100
Type=simple
WorkingDirectory=/home/minecraft/server/

[Unit]
After=network-online.target
Description=Minecraft server
Requires=minecraft-server.socket

For Fastback I added git and git-lfs to the service's "Environment" section and it seems like Fastback can work with this and create local backups fine. However, when trying to set up a remote file backup it fails, looking in the server log it prints out these messages:

[...]
[15:02:50] [pool-11-thread-2/ERROR]: [STDERR] failed to find custom transfer command "git-lfs" remote: executable file not found in $PATH
[15:02:50] [pool-11-thread-2/ERROR]: [STDERR] failed to find custom transfer command "git-lfs" remote: executable file not found in $PATH
[15:02:50] [pool-11-thread-2/ERROR]: [STDERR] error: failed to push some refs to 'file:///storage/backup/minecraft-server'
[15:02:50] [pool-11-thread-2/ERROR]: Exit 1 when executing: git -C /home/minecraft/server/world -c push.autosetupremote=false push --progress --set-upstream origin 9uZj/2025-01-15_15-02-49
net.pcal.fastback.utils.ProcessException: Exit 1 when executing: git -C /home/minecraft/server/world -c push.autosetupremote=false push --progress --set-upstream origin 9uZj/2025-01-15_15-02-49
        at knot/net.pcal.fastback.utils.ProcessUtils.doExec(ProcessUtils.java:81) ~[fastback-0.20.0+1.21.1-fabric.jar:?]
        at knot/net.pcal.fastback.utils.ProcessUtils.doExec(ProcessUtils.java:44) ~[fastback-0.20.0+1.21.1-fabric.jar:?]
        at knot/net.pcal.fastback.repo.PushUtils.native_doPush(PushUtils.java:133) ~[fastback-0.20.0+1.21.1-fabric.jar:?]
        at knot/net.pcal.fastback.repo.PushUtils.doPush(PushUtils.java:110) ~[fastback-0.20.0+1.21.1-fabric.jar:?]
        at knot/net.pcal.fastback.repo.RepoImpl.doCommitAndPush(RepoImpl.java:104) ~[fastback-0.20.0+1.21.1-fabric.jar:?]
        at knot/net.pcal.fastback.commands.FullCommand.lambda$run$1(FullCommand.java:65) ~[fastback-0.20.0+1.21.1-fabric.jar:?]
        at knot/net.pcal.fastback.commands.Commands.lambda$gitOp$0(Commands.java:131) ~[fastback-0.20.0+1.21.1-fabric.jar:?]
        at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:572) ~[?:?]
        at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:317) ~[?:?]
        at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1144) ~[?:?]
        at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:642) ~[?:?]
        at java.base/java.lang.Thread.run(Thread.java:1583) [?:?]

The first two messages are printed 30 times or so and they seem to indicate that git can't find git-lfs, which is strange because it works totally fine when creating a local backup. Do you know what could be different with remote file backups that could cause it to complain?

When I manually run the command git -C [...] shown in the error, it works fine, so that's nice at least.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions