Subject: Re: bug#33862: "guix gc" failing to complete

From: Danny Milosavljevic <[email-masked]>
Date: Tue, 25 Dec 2018 08:51:05 +0100

Hi,

On Mon, 24 Dec 2018 22:33:47 +0000
Ethan O'Quin <[email-masked]> wrote:

> Every time I run "guix gc" the process fails with:
> 
> "guix gc: error: build failed: executing SQLite statement: FOREIGN KEY constraint failed"
> 
> This occurs every time "guix gc" is run, although it progresses for a moment before it fails.
> 
> The issue was encountered on guix 0.16.0-7.6f1e0bb on GuixSD as of December 24, although I have encountered it repeatedly back to some time in October, possibly earlier.

Try

# guix gc --verify

If that doesn't work, then

$ cp /var/guix/db/db.sqlite /tmp/
$ sqlite3 /tmp/db.sqlite
sqlite> .tables
sqlite> .schema Refs

Do you see a foreign key here with "on delete restrict", Refs.reference ?

sqlite> .schema DerivationOutputs

No "on delete restrict" here?

sqlite> .schema FailedPaths

No "on delete restrict" here?

sqlite> .schema ValidPaths

No "on delete restrict" here?

Also, is there a hash value somewhere in the error messages?