From mboxrd@z Thu Jan 1 00:00:00 1970 From: Mike Gerwitz Subject: /var/guix/db/db.sqlite corruption Date: Fri, 02 Aug 2019 21:36:00 -0400 Message-ID: <87lfwbuj27.fsf@gnu.org> Mime-Version: 1.0 Content-Type: multipart/signed; boundary="=-=-="; micalg=pgp-sha512; protocol="application/pgp-signature" Return-path: Received: from eggs.gnu.org ([2001:470:142:3::10]:34651) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1htiyR-0008Ui-Hk for help-guix@gnu.org; Fri, 02 Aug 2019 21:36:44 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]:49430) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1htiyL-0006Iu-Ei for help-guix@gnu.org; Fri, 02 Aug 2019 21:36:39 -0400 Received: from localhost ([::1]:47104 helo=mikegerwitz-pc.gerwitz.local) by fencepost.gnu.org with esmtps (TLS1.2:DHE_RSA_AES_128_CBC_SHA1:128) (Exim 4.82) (envelope-from ) id 1htiyJ-0006re-Cb for help-guix@gnu.org; Fri, 02 Aug 2019 21:36:37 -0400 List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-guix-bounces+gcggh-help-guix=m.gmane.org@gnu.org Sender: "Help-Guix" To: help-guix@gnu.org --=-=-= Content-Type: text/plain Content-Transfer-Encoding: quoted-printable A while back, I ran out of disk space while running `guix package -i`, during a build. I then noticed that `guix gc` would, after outputting some number of "deleting" lines, fail with an error that's approximately this (I forgot to make a copy): guix gc: error: executing SQLite query: malformed database image This error appears to come from nix/libstore/sqlite.cc, and the last portion of the message comes from `sqlite3_errmsg`, so I don't think this is Guix's fault. I had already run e2fsck on many occasions since this happened a couple months back and there are no disk errors. To work around it, I dumped the DB: $ sqlite3 db.sqlite .dump > ~/bak.sql The final line of that file contains this: ROLLBACK; -- due to errors Understandable. I replaced that with "COMMIT;", and: $ mv db.sqlite{,-bak} $ sqlite3 db.sqlite < ~/bak.sql This produced a database that was 4MiB smaller than the original. :x But now `guix gc` works.[*] So my questions are: - Is there a way to regenerate the database? - What bad things could happen with what I just did? Thanks, and please nobody reading this message in a list archive in the future do the above without first reading replies to this thread; I don't want to be responsible for anything bad that may result! :) [*]: Actually, I had some other bizarre issues. After I recreated the DB, I started getting more generic I/O errors. There were no errors in dmesg. But when I moved the file to a different location (e.g. my home directory), it worked (via `sqlite3`). If I moved it back to `/var/guix/db/db.sqlite`, I/O errors once again. If I ran `.dump` from that dir, empty. If I moved it to my home dir and ran `.dump`, I got the full dump. This problem didn't resolve until after a reboot. I haven't seen anything like that before, and I don't want to speculate. I should have tried flushing the kernel I/O cache before rebooting to see if that would have fixed it. =2D-=20 Mike Gerwitz Free Software Hacker+Activist | GNU Maintainer & Volunteer GPG: D6E9 B930 028A 6C38 F43B 2388 FEF6 3574 5E6F 6D05 https://mikegerwitz.com --=-=-= Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 iQIcBAEBCgAGBQJdROUAAAoJEIyRe39dxRuijg8P/2JkJVvphJ+NBmUuR+opOrPF GYH+yZERPjlp+liEkebdTlObAfdFRj9DOOGPip35UAYrutLgk6/RYRNfExrBkBxh bpeXl2rca1n3KpnHFZOuYMtFT0DWXieOU3k1ip4ZsAuP+JVLNxzq2M0I7qw3myNz otmngYj3Nz+DJPQDx6QU7pfPhBaIPuFLGjrp4oP5tvq3QVGs1sWXnTdQfnEixt2u ekMlEILYo2Y03K8jK6Wz3PK2vfzfpnBCp6wADHUSDC/pnf6jjY+EdBKq+1C4AnGU IkM+/gTDcsUycSPFpP0ptpyGhtHCRuiRpT2HusZlg15fShzUYX9clL/tgZcYS5SH KJBCp+hLh7lDduQDUiY5X9X75e+HRP5dZO4ckA5G8Oelj+vJZeYAJz9C9ujnm5mP i+zqi3+ZDFfkYZd/2wNOWEwYcvVcqGyqIyIVGlC9OwIZJHlOB8wbAt7ON4dDoRBA E5Eoq3+CmWI5QT6AEVSG/Zvd3VNGqiV1E1f++vZHakJIe65YWePyrlMWPR0cLYQe N6iFRjpy3mK/dkdGjCGx/7fMk+E8BpioOja87HfMtBtTe+L14CLdb9wxJcBxAByA MGTS9DAe7VqRbcGBwHDjHK6NwO0+Vh6c2BCCiLsJ0uwHkyjBMPUtvS30FeFdDhJ2 8wZYYJoKKNhLl45+Ms0h =xTnT -----END PGP SIGNATURE----- --=-=-=--