Skip to content

Backup fails with stale Restic lock when apply-updates runs during a backup #8077

Open

Description

@piviul

Steps to reproduce

  • Configure a scheduled backup (e.g. hourly) so that its start minute coincides with apply-updates.timer (default 03:12)
  • Wait for both timers to fire at the same time on a node where the backup of a large module (e.g. mail) is still running when the update starts
  • Observe the following backup runs for that module

Expected behavior

Module updates and backup runs do not interfere: either the update waits for the running backup to complete, or the backup is stopped gracefully so that Restic releases its repository lock. Subsequent backup runs succeed.

Actual behavior

The module update restarts the module's containers while backup1.service is mid-operation. The restic-<module>-<pid> container is killed with SIGTERM (backup1.service: Main process exited, code=killed, status=15/TERM) and Restic cannot release its lock. A stale lock file remains in the repository locks/ directory, and every subsequent backup run for that module fails during forget --prune with:

[ERROR] restic backup failed. Command '[...restic...] forget --prune --keep-last=360' returned non-zero exit status 11.

The failure chain persists until the lock is removed manually (restic unlock). Modules with short backup times are rarely affected; large modules (e.g. mail with ~400GB of data) are hit systematically.

Components

  • core 3.19.2 (ghcr.io/nethserver/restic:3.19.2)

Activity

  1. added this to the NethServer 8.10 milestone on Jul 3, 2026
  2. DavidePrincipi commented on Jul 3, 2026

    @DavidePrincipi
    Member

    Hi Piviul, thanks for the report — this hasn't been reported before.

    The cause is a scheduling conflict: apply-updates.timer and your hourly backup both fire at minute :12, so the update restarts the module while Restic is running. The SIGTERM leaves a stale lock, and all subsequent runs fail until it's cleared.

    Workarounds while we fix the job conflict:

    • change the backup schedule minute so it doesn't overlap with apply-updates.timer;
    • to recover, run restic unlock on the mail1 repository instead of deleting the lock file manually.

    Please note this tracker follows specific bug report guidelines: for future issues use the community forum or, with a support plan, Nethesis support. We'll reformat the issue accordingly.

  3. changed the title [-]mail1 backup fails periodically with restic: exit status 11 after container SIGTERM — orphaned lock file in locks/[/-] [+]Backup fails with stale Restic lock when apply-updates runs during a backup[/+] on Jul 3, 2026
  4. moved this from ToDo to In Progress in NethServeron Nov 13, 2026
  5. DavidePrincipi commented on Nov 16, 2026

    @DavidePrincipi
    Member

    In Testing core 3.26.0-dev.3

    Test case

    Setup: install an app with update scripts, e.g. dokuwiki1, and configure a backup for it. Below, <ID> is the backup ID.

    1. Make the backup last longer, with a temporary dump script:
      runagent -m dokuwiki1 bash -c 'printf "#!/bin/bash\nsleep 120\n" > $AGENT_INSTALL_DIR/bin/module-dump-state; chmod +x $AGENT_INSTALL_DIR/bin/module-dump-state'
      
    2. Start the backup with runagent -m node run-backup --backup=<ID>, and while it runs, update the app from another shell:
      update-module ghcr.io/nethserver/dokuwiki:latest dokuwiki1 --force
      
      Expected: the journal shows A module backup is running: waiting for its completion..., the update proceeds only after the backup completes, and both the backup and the update succeed.
    3. Remove the temporary dump script, and add a slow update script instead:
      runagent -m dokuwiki1 bash -c 'rm -f $AGENT_INSTALL_DIR/bin/module-dump-state; printf "#!/bin/bash\nsleep 60\n" > $AGENT_INSTALL_DIR/update-module.d/05sleep; chmod +x $AGENT_INSTALL_DIR/update-module.d/05sleep'
      
    4. Run the update-module command again, and while the 05sleep script runs, start the backup. Expected: the backup output says dokuwiki1: already running, queued for retry, then dokuwiki1: backup <ID> completed (retry) after the update ends.
    5. Clean up: runagent -m dokuwiki1 bash -c 'rm -f $AGENT_INSTALL_DIR/update-module.d/05sleep'
  6. removed their assignment
    on Nov 16, 2026
  7. added
    testing
    on Nov 16, 2026
  8. moved this from In Progress to Testing in NethServeron Nov 16, 2026
  9. added
    verified
    on Nov 16, 2026
  10. DavidePrincipi commented on Nov 16, 2026

    @DavidePrincipi
    Member

    VERIFIED

  11. removed
    testing
    on Nov 16, 2026
  12. moved this from Testing to Verified in NethServeron Nov 16, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    verified

    Type

    Projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions