Newbie here. "Pack ID does not match" errors. How to fix?

See below for the command and errors. I then ran the “check” command and it returned ‘no errors found’. Any way to fix these errors? I did some googling but didn’t find any solutions.

advait@advait-Bravo-15-A4DDR:~$ sudo restic -r /media/advait/Krishna2TB/rr check --read-data
using temporary cache in /tmp/restic-check-cache-111571993
enter password for repository: 
repository 2f144eba opened successfully, password is correct
created new cache in /tmp/restic-check-cache-111571993
create exclusive lock for repository
load indexes
check all packs
check snapshots, trees and blobs
[1:22] 100.00%  62 / 62 snapshots
read all data
Pack ID does not match, want 6e3859c7, got 28371114
Pack ID does not match, want 171de401, got 4fed4bd8
Pack ID does not match, want dc337fe4, got 33b55447
Pack ID does not match, want 3a7fd9c8, got 2f0df826
Pack ID does not match, want 78641c1e, got 3f3ecaba
Pack ID does not match, want d650ed80, got 91b679a2
Pack ID does not match, want 4df33e49, got 7aef2cc2
Pack ID does not match, want dc2d1600, got 11127f2e
Pack ID does not match, want a12b370d, got bcd09f2a
Pack ID does not match, want ed739e21, got 9742c976
Pack ID does not match, want 9b3362e0, got 270a5250
[13:39:31] 100.00%  232151 / 232151 packs
Fatal: repository contains errors

I cleared the cache, ran check and ran prune and rebuilt the index. The same Pack ID mismatch errors are still there.

Ubuntu 21.10. Correct me if I’m wrong, but looks like the best way to recover from a bunch of Pack ID mismatch errors is to locate the snapshots with the bad Pack IDs and delete those snapshots. I have the Pack IDs.

Can someone give me an example of a resctic find pack ID command? I’m a newbie and don’t know all the restic syntax.
sudo restic -r /media/advait/Krishna2TB/rr find --pack
How would I complete finalize this command to locate identify which snapshot has a particular Pack ID?

I read the restic man pages but there were no examples. I need examples cuz newbie.

I ran check and prune and rebuild-index; they didn’t fix errors.

Is there a better way to recover from Pack ID mismatch errors?

@m3110w I’ve merged your forum topics. Opening multiple topics for the same problem doesn’t help.

Which restic version is included in Ubuntu 21.10?

The usual steps to repair the repository are listed here: Recover from broken pack file · Issue #828 · restic/restic · GitHub

Just add the pack id at the end of the command line: restic find --pack 025c1d06 (that example is from restic find --help).
So in your case it would be restic find --pack 6e3859c7 171de401 dc337fe4 3a7fd9c8 78641c1e d650ed80 4df33e49 dc2d1600 a12b370d ed739e21 9b3362e0 (depending on your restic version you have to pass the pack file name individually and not all at once).

Great. Thanks! I’ll try it soon and report back. I’ve got restic 0.12.1. I think it’s pretty recent.

@MichaelEischer OK, I ran the find --pack command with the WANT IDs and GOT IDs. See below. I don’t know how to interpret the results. Any ideas? Thanks.

advait@advait-Bravo-15-A4DDR:~$ restic version
restic 0.12.1 compiled with go1.16.6 on linux/amd64
advait@advait-Bravo-15-A4DDR:~$ sudo restic -r /media/advait/Krishna2TB/rr find --pack 6e3859c7 171de401 dc337fe4 3a7fd9c8 78641c1e d650ed80 4df33e49 dc2d1600 a12b370d ed739e21 9b3362e0
[sudo] password for advait: 
enter password for repository: 
repository 2f144eba opened successfully, password is correct
header length is zero
readHeader
github.com/restic/restic/internal/pack.readRecords
	/restic/internal/pack/pack.go:206
github.com/restic/restic/internal/pack.readHeader
	/restic/internal/pack/pack.go:231
github.com/restic/restic/internal/pack.List
	/restic/internal/pack/pack.go:258
github.com/restic/restic/internal/repository.(*Repository).ListPack
	/restic/internal/repository/repository.go:685
main.(*Finder).packsToBlobs.func1
	/restic/cmd/restic/cmd_find.go:430
github.com/restic/restic/internal/repository.(*Repository).List.func1
	/restic/internal/repository/repository.go:676
github.com/restic/restic/internal/backend.(*RetryBackend).List.func1.1
	/restic/internal/backend/backend_retry.go:143
github.com/restic/restic/internal/backend/local.visitFiles
	/restic/internal/backend/local/local.go:322
github.com/restic/restic/internal/backend/local.visitDirs
	/restic/internal/backend/local/local.go:282
github.com/restic/restic/internal/backend/local.(*Local).List
	/restic/internal/backend/local/local.go:246
github.com/restic/restic/internal/backend.(*RetryBackend).List.func1
	/restic/internal/backend/backend_retry.go:137
github.com/cenkalti/backoff/v4.RetryNotifyWithTimer
	/home/build/go/pkg/mod/github.com/cenkalti/backoff/v4@v4.1.1/retry.go:55
github.com/cenkalti/backoff/v4.RetryNotify
	/home/build/go/pkg/mod/github.com/cenkalti/backoff/v4@v4.1.1/retry.go:34
github.com/restic/restic/internal/backend.(*RetryBackend).retry
	/restic/internal/backend/backend_retry.go:46
github.com/restic/restic/internal/backend.(*RetryBackend).List
	/restic/internal/backend/backend_retry.go:136
github.com/restic/restic/internal/repository.(*Repository).List
	/restic/internal/repository/repository.go:670
main.(*Finder).packsToBlobs
	/restic/cmd/restic/cmd_find.go:417
main.runFind
	/restic/cmd/restic/cmd_find.go:615
main.glob..func10
	/restic/cmd/restic/cmd_find.go:40
github.com/spf13/cobra.(*Command).execute
	/home/build/go/pkg/mod/github.com/spf13/cobra@v1.2.1/command.go:856
github.com/spf13/cobra.(*Command).ExecuteC
	/home/build/go/pkg/mod/github.com/spf13/cobra@v1.2.1/command.go:974
github.com/spf13/cobra.(*Command).Execute
	/home/build/go/pkg/mod/github.com/spf13/cobra@v1.2.1/command.go:902
main.main
	/restic/cmd/restic/main.go:98
runtime.main
	/usr/local/go/src/runtime/proc.go:225
runtime.goexit
	/usr/local/go/src/runtime/asm_amd64.s:1371
advait@advait-Bravo-15-A4DDR:~$ sudo restic -r /media/advait/Krishna2TB/rr find --pack 28371114 4fed4bd8 33b55447 2f0df826 3f3ecaba 91b679a2 7aef2cc2 11127f2e bcd09f2a
enter password for repository: 
repository 2f144eba opened successfully, password is correct
Fatal: unable to find pack(s): [11127f2e 28371114 2f0df826 33b55447 3f3ecaba 4fed4bd8 7aef2cc2 91b679a2 bcd09f2a]
advait@advait-Bravo-15-A4DDR:~$ 

@MichaelEischer [ ISSUE RESOLVED ]
It took some sleuthing but I found out that all 62 snapshots in this repo are corrupted (every snapshot contains a pack ID that’s corrupted). Sigh. I’ll format the disk and start over. Takes about 45 hours to backup the 1st snapshot. Sigh.

From now on I’ll do a “–read-data” check after every snapshot.

The header length is zero shows that the filesystem / hdd did not properly store the data as requested by restic. restic explicitly requests the OS to completely store the files in the repository before continuing during a backup.

Thanks. Does “header length zero” means every file was stored incorrectly? Or something else? Some metadata stored incorrectly? Details would be helpful if possible. Thx!

I’m now redoing the backup. I’ll check it after it’s done. Fingers crossed! :slight_smile:

Normally the last four bytes of a pack file contain the header length. However, in your case they were all zero. That usually means that only the filelength was stored but not the data This could be caused e.g. by a power loss when the filesystem hasn’t written everything yet (and ignored restic’s request to store the data before continuing). Btw, which filesystem does the storage drive use?

1 Like

All my drives are ext4. (When I get some free time I’ll switch to btrfs.) I redid the backup and then ran check --read-data. No errors found. Yay! I’ll do a check --read-data after every third or forth snapshot. It takes 13 hours but it’s worth it to make sure my repo is actually restorable…

ext4 should be fine, I’ve been worried that the drive might use NTFS or so (which can be problematic on Linux).

1 Like

No NTFS here. I want no reminders of past Windows trauma. :smile:

I finally got HDSentinal (HDS) working in my Windows VM. HDS says the drive is in perfect shape, no errors detected. It’s now doing a surface scan test.