Skip to content

Support offline/air-gapped backups (avoid restic image re-pull) #8095

Description

@gsanchietti

Description

NS8 backups currently require internet access even when the restic backup image is already cached locally. core/imageroot/var/lib/nethserver/node/update-core.d/96cleanup_restic_images unconditionally removes cached restic image tags on every core update, and prepare_restic_command() (agent/pypkg/agent/__init__.py:215-271) never passes --pull=missing (or similar) to podman. So every backup run tries to re-pull ghcr.io/nethserver/restic:<version> first.

In air-gapped or intermittently-offline clusters this means backups either hang for minutes (3 retries against an unreachable registry) or fail outright, even though a working local image is available.

We want backups to work offline when a compatible restic image is already present locally, using it instead of always trying to re-pull.

Backup related logs:

Jul 07 16:06:59 ns8 agent@node[3314501]: Trying to pull ghcr.io/nethserver/restic:3.20.0...
Jul 07 16:07:29 ns8 agent@node[3314501]: time="2026-07-07T16:07:29+02:00" level=warning msg="Failed, retrying in 1s ... (1/3). Error: initializing source docker://ghcr.io/nethserver/restic:3.20.0: pinging container registry ghcr.io: Get \"https://ghcr.io/v2/\": dial tcp 140.82.121.33:443: i/o timeout"
Jul 07 16:08:00 ns8 agent@node[3314501]: time="2026-07-07T16:08:00+02:00" level=warning msg="Failed, retrying in 1s ... (2/3). Error: ...same..."
Jul 07 16:08:31 ns8 agent@node[3314501]: time="2026-07-07T16:08:31+02:00" level=warning msg="Failed, retrying in 1s ... (3/3). Error: ...same..."
Jul 07 16:09:03 ns8 podman[924198]: ... image pull-error ghcr.io/nethserver/restic:3.20.0 unable to copy from source docker://ghcr.io/nethserver/restic:3.20.0: ...i/o timeout
Jul 07 16:09:03 ns8 agent@node[3314501]: [ERROR] restic stats failed for 86d1a8ac-ef89-557a-8e19-8582ab86b7c4/traefik/e410ec36-ab9d-4eb9-9dc0-4e3ae4710825: Command '['podman', 'run', ...]' returned non-zero exit status 125.

Alternative solutions

  1. Use cached rootfull image: distribute rootfull restic image to all module agents.
  2. Pull policy fix only: pass --pull=missing to the podman run invocation so a cached local image is used when present, and pull is only attempted when missing.
  3. Pull policy fix + safer cleanup: additionally stop 96cleanup_restic_images from removing the currently-in-use image tag, so a cached image always survives across updates for offline use.

References

Activity

  1. added this to the NethServer 8.10 milestone on Jul 9, 2026
  2. moved this from ToDo to In Progress in NethServeron Dec 3, 2026
  3. DavidePrincipi commented on Dec 3, 2026

    @DavidePrincipi
    Member

    Fixed by NethServer/ns8-core#1437 and NethServer/ns8-core#1436, available in core 3.26.0-dev.7.

    Test case

    1. Prepare a backup that includes a rootless app (e.g. Mail) and a rootfull app with volumes (e.g. Samba), then update the cluster core to 3.26.0-dev.7: /var/lib/nethserver/node/restic-store/ holds the Restic image, and runagent -m mail1 podman images lists no Restic image.
    2. Run the backup, then restore both apps as new instances: backup and restore succeed, and Mail still has no Restic image.
    3. Append 0.0.0.0 ghcr.io pkg-containers.githubusercontent.com to /etc/hosts and run the backup again: it succeeds, and the journal has no Trying to pull line. Remove the line afterwards.
    4. Install a new node with 3.26.0-dev.7: it has the image store, and backups work.
  4. added
    testing
    on Dec 3, 2026
  5. moved this from In Progress to Testing in NethServeron Dec 3, 2026
  6. DavidePrincipi commented on Dec 3, 2026

    @DavidePrincipi
    Member

    QA verification: passed

    Tested on a 3-node cluster with Rocky Linux 9 (SELinux enforcing). Nodes 1 and 2 were installed with core 3.25.1 and updated with update-core to main (with #1436, #1437) and then to 3.26.0-dev.7. Node 3 was installed directly with the new core and joined the cluster later. Backup destination: cluster local storage on node 2.

    Apps: Mail 2.0.0 (rootless), CrowdSec 1.5.1 (rootfull, with the data volume), Samba 3.5.1 (rootless since this release, so CrowdSec covers the rootfull case).

    1. Update — PASS. Every node has /var/lib/nethserver/node/restic-store/<image> and no module, Mail included, has a Restic image. On the next update the previous store is kept next to the new one, as designed.
    2. Backup and restore — PASS. Backups succeed for all instances. Mail was restored as a new instance on node 2 and on node 3, CrowdSec as a new instance on node 1: messages, IMAP folders and the CrowdSec volume content are intact, and the new Mail instances have no Restic image.
    3. Offline backup — PASS. With 0.0.0.0 ghcr.io pkg-containers.githubusercontent.com in /etc/hosts on both nodes, two backups succeeded, including retention (forget and prune), with no Trying to pull line in the journal. For comparison, the same backup on 3.25.1 logged Trying to pull ghcr.io/nethserver/restic:3.25.1.
    4. New node — PASS. A node installed with the new core has the image store, and backup and restore of Mail on it work.

    No SELinux denials (ausearch -m avc) on any node.

  7. added
    verified
    on Dec 3, 2026
  8. removed
    testing
    on Dec 3, 2026
  9. moved this from Testing to Verified in NethServeron Dec 3, 2026
  10. DavidePrincipi commented on Dec 4, 2026

    @DavidePrincipi
    Member

    Release NethServer/ns8-core 3.26.0

  11. removed
    verified
    on Dec 4, 2026
  12. moved this from Verified to Done in NethServeron Dec 4, 2026
  13. moved this from Done to In Progress in NethServeron Dec 4, 2026
  14. moved this from In Progress to Done in NethServeron Dec 4, 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

    No labels
    No labels

    Projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions