Skip to content

Failed intialization when using restic with rclone #283

@zsbai

Description

@zsbai

Hi, I'm not sure what's going on with the container.

The first time I start it, everything works fine and the backup uploads successfully to the remote repository. However, after that, every subsequent start fails during the initialization stage.

From the logs it looks like the startup script is running some restic operations, but somehow rclone exits first. Because of that, restic can't finish properly and leaves a lock in the repository.

I tried removing the locks manually using:

docker run --rm -it \
                                          --entrypoint restic \
                                          -v $(pwd)/rclone:/config/rclone \
                                          -e RCLONE_CONFIG=/config/rclone/rclone.conf \
                                          -e RESTIC_REPOSITORY="rclone:remote:path" \
                                          -e RESTIC_PASSWORD="password" \
                                          itzg/mc-backup \
                                          unlock --remove-all

But the same issue happens again the next time the container starts. During startup it seems to create a lock in the repo and exit. I set auto restart so the container keep restarting — when I ran unlock --remove-all I had to remove around 8 locks.

I also tried settiing INITIAL_DELAY to 2m but problem still exists.

Log:

backup-1 exited with code 255
                                            signal terminated received, cleaning up
backup-1   | 2026-03-13T19:57:32+0000 ERROR Remove(<lock/03000d88fa>) returned error, retrying after 1.198940815s: client.Do: Delete "http://localhost/locks/03000d88fa1d8371bbb4ddb8847dd697b978e67d1a715afb2d2dd23d0abc53f5": unexpected EOF
backup-1   | 2026-03-13T19:57:32+0000 ERROR Remove(<lock/03000d88fa>) failed: rclone stdio connection already closed
backup-1   | 2026-03-13T19:57:32+0000 ERROR unable to create lock in backend: context canceled
backup-1   | 2026-03-13T19:57:32+0000 INTERNALERROR Unhandled restic repository state.
backup-1   | 2026-03-13T19:57:32+0000 INTERNALERROR Please report this: https://github.com/itzg/docker-mc-backup/issues
backup-1 exited with code 2 (restarting)
backup-1 exited with code 2 (restarting)
                                            signal terminated received, cleaning up
backup-1   | 2026-03-13T19:57:42+0000 ERROR Remove(<lock/8268ab5d82>) failed: rclone stdio connection already closed
backup-1   | 2026-03-13T19:57:42+0000 ERROR unable to create lock in backend: context canceled
backup-1   | 2026-03-13T19:57:42+0000 INTERNALERROR Unhandled restic repository state.
backup-1   | 2026-03-13T19:57:42+0000 INTERNALERROR Please report this: https://github.com/itzg/docker-mc-backup/issues
                                            signal terminated received, cleaning up
backup-1   | 2026-03-13T19:57:53+0000 ERROR unable to create lock in backend: context canceled
backup-1   | 2026-03-13T19:57:53+0000 INTERNALERROR Unhandled restic repository state.
backup-1   | 2026-03-13T19:57:53+0000 INTERNALERROR Please report this: https://github.com/itzg/docker-mc-backup/issues
backup-1 exited with code 2 (restarting)
                                            signal terminated received, cleaning up
backup-1   | 2026-03-13T19:58:03+0000 ERROR unable to create lock in backend: context canceled
backup-1   | 2026-03-13T19:58:03+0000 INTERNALERROR Unhandled restic repository state.
backup-1   | 2026-03-13T19:58:03+0000 INTERNALERROR Please report this: https://github.com/itzg/docker-mc-backup/issues
backup-1 exited with code 2 (restarting)
                                            signal terminated received, cleaning up
backup-1   | 2026-03-13T19:58:13+0000 ERROR unable to create lock in backend: context canceled
backup-1   | 2026-03-13T19:58:13+0000 INTERNALERROR Unhandled restic repository state.
backup-1   | 2026-03-13T19:58:13+0000 INTERNALERROR Please report this: https://github.com/itzg/docker-mc-backup/issues
backup-1 exited with code 2 (restarting)
                                            signal terminated received, cleaning up
backup-1   | 2026-03-13T19:58:24+0000 ERROR unable to create lock in backend: context canceled
backup-1   | 2026-03-13T19:58:24+0000 INTERNALERROR Unhandled restic repository state.
backup-1   | 2026-03-13T19:58:24+0000 INTERNALERROR Please report this: https://github.com/itzg/docker-mc-backup/issues
backup-1 exited with code 2 (restarting)
                                            signal terminated received, cleaning up
backup-1   | 2026-03-13T19:58:34+0000 ERROR unable to create lock in backend: context canceled
backup-1   | 2026-03-13T19:58:34+0000 INTERNALERROR Unhandled restic repository state.
backup-1   | 2026-03-13T19:58:34+0000 INTERNALERROR Please report this: https://github.com/itzg/docker-mc-backup/issues
backup-1 exited with code 2 (restarting)
                                            signal terminated received, cleaning up
backup-1   | 2026-03-13T19:58:44+0000 ERROR unable to create lock in backend: context canceled
backup-1   | 2026-03-13T19:58:44+0000 INTERNALERROR Unhandled restic repository state.
backup-1   | 2026-03-13T19:58:44+0000 INTERNALERROR Please report this: https://github.com/itzg/docker-mc-backup/issues
backup-1 exited with code 2 (restarting)
                                            signal terminated received, cleaning up
backup-1   | 2026-03-13T19:58:55+0000 ERROR unable to create lock in backend: context canceled
backup-1   | 2026-03-13T19:58:55+0000 INTERNALERROR Unhandled restic repository state.
backup-1   | 2026-03-13T19:58:55+0000 INTERNALERROR Please report this: https://github.com/itzg/docker-mc-backup/issues
backup-1 exited with code 2 (restarting)

My docker compose files(only keep the necessary info):

services:
  mc:
    image: itzg/minecraft-server:java21-jdk
    container_name: mc-server
    tty: true
    stdin_open: true
    ports:
      - "25565:25565"
      # rcon
      - "127.0.0.1:25575:25575"
    volumes:
      - "./data:/data"
      - "./plugins:/plugins"
  backup:
    image: itzg/mc-backup
    restart: unless-stopped
    environment:
      BACKUP_NAME: world
      INITIAL_DELAY: 2m
      RCON_HOST: mc
      RCON_PORT: 25575
      RCON_PASSWORD: "password"
      RCON_RETRIES: 5
      # run save-all though rcon before backup
      ENABLE_SAVE_ALL: true
      BACKUP_INTERVAL: 1h
      PAUSE_IF_NO_PLAYERS: false
      BACKUP_ON_STARTUP: true
      BACKUP_METHOD: restic
      RESTIC_ADDITIONAL_TAGS: mc_backups
      RESTIC_HOSTNAME: hostname
      RESTIC_RETRY_LOCK: 5m
      RESTIC_PASSWORD: "password"
      RESTIC_REPOSITORY: rclone:remote:path
    volumes:
      - ./rclone:/config/rclone
      - ./data:/data:ro
    stop_grace_period: 1m

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