pcal43 / fastback

Fast, incremental Minecraft world backups. Powered by Git.
https://pcal43.github.io/fastback/
GNU General Public License v2.0
125 stars 19 forks source link

git-lfs fails to install when it's already installed #316

Closed Jozufozu closed 6 months ago

Jozufozu commented 6 months ago

I've got fastback running on my (mostly vanilla) server in a docker container. My Dockerfile looks like this:

FROM itzg/minecraft-server

# https://github.com/git-lfs/git-lfs/wiki/Installation
# per instructions by https://pcal43.github.io/fastback/native-git.html
RUN build_deps="curl" && \
    apt-get update && \
    DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends ${build_deps} ca-certificates && \
    curl -s https://packagecloud.io/install/repositories/github/git-lfs/script.deb.sh | bash && \
    DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends git-lfs && \
    git lfs install && \
    DEBIAN_FRONTEND=noninteractive apt-get purge -y --auto-remove ${build_deps} && \
    rm -r /var/lib/apt/lists/*

I recently rebuilt the image and started getting this error in time with my auto-backup schedule:

[17:14:19] [pool-3-thread-323/INFO]: Starting auto-backup
[17:14:19] [pool-3-thread-323/ERROR]: [STDERR] Hook already exists: pre-push
[17:14:19] [pool-3-thread-323/ERROR]: [STDERR] #!/bin/sh
[17:14:19] [pool-3-thread-323/ERROR]: [STDERR] command -v git-lfs >/dev/null 2>&1 || { echo >&2 "\nThis repository is configured for Git LFS but 'git-lfs' was not found on your path. If you no longer wish to use Git LFS, remove this hook by deleting the 'pre-push' file in the hooks directory (set by 'core.hookspath'; usually '.git/hooks').\n"; exit 2; }
[17:14:19] [pool-3-thread-323/ERROR]: [STDERR] git lfs pre-push "$@"
[17:14:19] [pool-3-thread-323/ERROR]: [STDERR] To resolve this, either:
[17:14:19] [pool-3-thread-323/ERROR]: [STDERR] 1: run `git lfs update --manual` for instructions on how to merge hooks.
[17:14:19] [pool-3-thread-323/ERROR]: [STDERR] 2: run `git lfs update --force` to overwrite your hook.
[17:14:19] [pool-3-thread-323/ERROR]: Exit 2 when executing: git -C /data/world lfs install --local
net.pcal.fastback.utils.ProcessException: Exit 2 when executing: git -C /data/world lfs install --local
        at net.pcal.fastback.utils.ProcessUtils.doExec(ProcessUtils.java:75) ~[fastback-0.17.0+1.20.4-fabric.jar:?]
        at net.pcal.fastback.utils.ProcessUtils.doExec(ProcessUtils.java:44) ~[fastback-0.17.0+1.20.4-fabric.jar:?]
        at net.pcal.fastback.repo.PreflightUtils.updateNativeLfsInstallation(PreflightUtils.java:85) ~[fastback-0.17.0+1.20.4-fabric.jar:?]
        at net.pcal.fastback.repo.PreflightUtils.doPreflight(PreflightUtils.java:73) ~[fastback-0.17.0+1.20.4-fabric.jar:?]
        at net.pcal.fastback.repo.CommitUtils.doCommitSnapshot(CommitUtils.java:67) ~[fastback-0.17.0+1.20.4-fabric.jar:?]
        at net.pcal.fastback.repo.RepoImpl.doCommitAndPush(RepoImpl.java:97) ~[fastback-0.17.0+1.20.4-fabric.jar:?]
        at net.pcal.fastback.commands.SchedulableAction$3.lambda$getTask$0(SchedulableAction.java:61) ~[fastback-0.17.0+1.20.4-fabric.jar:?]
        at net.pcal.fastback.mod.AutosaveListener.lambda$run$0(AutosaveListener.java:72) ~[fastback-0.17.0+1.20.4-fabric.jar:?]
        at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source) ~[?:?]
        at java.util.concurrent.FutureTask.run(Unknown Source) ~[?:?]
        at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source) ~[?:?]
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) ~[?:?]
        at java.lang.Thread.run(Unknown Source) ~[?:?]

I couldn't tell you why I wasn't getting it before I rebuilt the image, but it seems that trying to install git-lfs on this line now fails since the hooks git-lfs is trying to install already exist.

I think adding --force to that command should fix it, though I doubt that's the best solution.

pcal43 commented 6 months ago

This almost definitely a path issue in your image. I can't really help you with that. Try logging into the image and seeing if you can run git-lfs.

pcal43 commented 6 months ago

You might want to try asking on the discord channel, maybe somebody there else has tried something similar and can help you.