GNU bug report logs - #36706
"guix gc --verify" fails with "FOREIGN KEY constraint failed"

Previous Next

Package: guix;

Reported by: Ingo Ruhnke <grumbel <at> gmail.com>

Date: Wed, 17 Jul 2019 17:35:02 UTC

Severity: normal

Full log


View this message in rfc822 format

From: Ingo Ruhnke <grumbel <at> gmail.com>
To: 36706 <at> debbugs.gnu.org
Subject: bug#36706: "guix gc --verify" fails with "FOREIGN KEY constraint failed"
Date: Wed, 17 Jul 2019 23:26:24 +0200
[Message part 1 (text/plain, inline)]
On Wed, Jul 17, 2019 at 10:02 PM Ricardo Wurmus <rekado <at> elephly.net> wrote:

> This is bad and you cannot recover from it.  The store should *never* be
> edited manually as it will become inconsistent with the database (which
> I assume you have not edited).
>

I recovered it just fine with a quick&dirty:

$ sqlite3 /var/guix/db.sqlite
delete from Refs where reference in (select id from ValidPaths where path
glob "*libreof*");
delete from Refs where referrer in (select id from ValidPaths where path
glob "*libreof*");
delete from DerivationOutputs where path glob "*libreof*";
delete from ValidPaths where path glob "*libreof*";

Which I assume is what `guix gc --verify=repair` was trying to do, but it's
not cleaning up Refs table and thus failing at the FOREIGN KEY constraint.

$ sqlite3 /var/guix/db/db.sqlite
[...]
sqlite> .schema
[...]
CREATE TABLE Refs (
    referrer  integer not null,
    reference integer not null,
    primary key (referrer, reference),
    foreign key (referrer) references ValidPaths(id) on delete cascade,
    foreign key (reference) references ValidPaths(id) on delete restrict
<-------- this one here
);
[Message part 2 (text/html, inline)]

This bug report was last modified 5 years and 328 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.