Unable to build system due to database disk image is malformed

Unsure why my build seems to be failing. I might have two issues. Originally I was seeing this error message.

error: unable to download ‘https://pkg-config.freedesktop.org/releases/pkg-config-0.29.2.tar.gz’: Could not connect to server (7)

At some point, when debugging, I CTRL-C’d the process and now I see this when I rerun my rebuild command.

warning: executing SQLite statement ‘pragma synchronous = off’: database disk image is malformed, database disk image is malformed (in ‘/root/.cache/nix/binary-cache-v6.sqlite’)

I can share the full log message if that’s helpful.

That means you’re building pkg-config locally and cannot connect to the freedesktop forge.

The freedesktop forge has seen some downtime lately, so that may be it, or you’re behind a firewall or your DNS is pranking you.

That said, this should be downloaded from the binary cache, which…

Yikes. Well corruption in that database would explain why you’re building locally.

I think it’s safe to delete the nix cache directory, and that should just rebuild the database. Move it to a backup location just in case, and try building again.

Amazing! Looks like deleting that folder might have fixed everything for me! Thanks a bunch!!!

Will perform a reboot test before deleting the backup folder but I think we should be in the clear!