kopia / kopia

Cross-platform backup tool for Windows, macOS & Linux with fast, incremental backups, client-side end-to-end encryption, compression and data deduplication. CLI and GUI included.
https://kopia.io
Apache License 2.0
7.76k stars 391 forks source link

Kopia doesn't automatically run overdue snapshots when waking from sleep #3512

Open elydpg opened 10 months ago

elydpg commented 10 months ago

I noticed that #3319 is supposed to fix overdue snapshots not automatically running. And it does. However, overdue snapshots do not run when the computer was put to sleep (with Kopia running of course) before the designated snapshot time and woken from sleep after the snapshot was supposed to have been run. Instead, Kopia needs to be restarted in order for the missed snapshot to be automatically run.

For further info, I am running Kopia 0.15.0 on Kubuntu 23.10.

elydpg commented 10 months ago

Kopia upon waking from system sleep, before restarting Kopia

Screenshot_20231217_012103

After restarting Kopia

Screenshot_20231217_012353

lupusA commented 10 months ago

Hi,

can you post your policy?

Cheers

elydpg commented 10 months ago

No problem! My policy is specified by this JSON representation:

{
    "retention": {},
    "files": {
        "ignore": [
            "[censored]"
        ]
    },
    "errorHandling": {},
    "scheduling": {
        "timeOfDay": [
            {
                "hour": 4,
                "min": 0
            }
        ]
    },
    "compression": {},
    "actions": {},
    "logging": {
        "directories": {},
        "entries": {}
    },
    "upload": {}
}

The global policy that it inherits from is defined by this:

{
    "retention": {
        "keepLatest": 10,
        "keepHourly": 48,
        "keepDaily": 7,
        "keepWeekly": 4,
        "keepMonthly": 24,
        "keepAnnual": 3,
        "ignoreIdenticalSnapshots": false
    },
    "files": {
        "ignoreDotFiles": [
            ".kopiaignore"
        ]
    },
    "errorHandling": {
        "ignoreFileErrors": false,
        "ignoreDirectoryErrors": false,
        "ignoreUnknownTypes": true
    },
    "scheduling": {
        "runMissed": true
    },
    "compression": {
        "compressorName": "none"
    },
    "actions": {},
    "logging": {
        "directories": {
            "snapshotted": 5,
            "ignored": 5
        },
        "entries": {
            "snapshotted": 0,
            "ignored": 5,
            "cacheHit": 0,
            "cacheMiss": 0
        }
    },
    "upload": {
        "maxParallelSnapshots": 1,
        "parallelUploadAboveSize": 2147483648
    }
}
tessus commented 10 months ago

The same happens on macOS. My workaround is to click the refresh button:

image
elydpg commented 7 months ago

Still happens on 0.16.0

blm768 commented 5 months ago

I've confirmed similar behavior on Windows in 0.17.0. I only see the behavior on a repository that's stored on an SMB share; my other machine that backs up to an S3-compatible object store doesn't exhibit the issue. Kopia does seem to try to run the snapshots, but they fail (perhaps because the SMB share isn't ready yet). This also seems to block later hourly snapshots from running until I refresh the UI.

DarkArc commented 2 months ago

I'm seeing this as well on my laptop running Fedora 40.

Possibly relevant is that darkman (also written in Go) seems to handle this correctly via https://gitlab.com/WhyNotHugo/darkman/-/blob/main/boottimer/boottimer.go?ref_type=heads