From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp2 ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms11 with LMTPS id SHCtOhHi2F7KEQAA0tVLHw (envelope-from ) for ; Thu, 04 Jun 2020 11:59:13 +0000 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp2 with LMTPS id EMSBNhHi2F4bSAAAB5/wlQ (envelope-from ) for ; Thu, 04 Jun 2020 11:59:13 +0000 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id 2627B940B2B for ; Thu, 4 Jun 2020 11:59:13 +0000 (UTC) Received: from localhost ([::1]:43236 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jgoWc-0008Q4-Se for larch@yhetil.org; Thu, 04 Jun 2020 07:59:10 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:46800) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jgoWU-0008Ma-Kh for bug-guix@gnu.org; Thu, 04 Jun 2020 07:59:02 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:33709) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jgoWU-0007eF-9I for bug-guix@gnu.org; Thu, 04 Jun 2020 07:59:02 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1jgoWU-0000z8-7M for bug-guix@gnu.org; Thu, 04 Jun 2020 07:59:02 -0400 X-Loop: help-debbugs@gnu.org Subject: bug#41607: Deleted store items are not actually deleted Resent-From: Ludovic =?UTF-8?Q?Court=C3=A8s?= Original-Sender: "Debbugs-submit" Resent-CC: bug-guix@gnu.org Resent-Date: Thu, 04 Jun 2020 11:59:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 41607 X-GNU-PR-Package: guix X-GNU-PR-Keywords: To: Chris Marusich Received: via spool by 41607-submit@debbugs.gnu.org id=B41607.15912719093744 (code B ref 41607); Thu, 04 Jun 2020 11:59:02 +0000 Received: (at 41607) by debbugs.gnu.org; 4 Jun 2020 11:58:29 +0000 Received: from localhost ([127.0.0.1]:45255 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jgoVx-0000yJ-08 for submit@debbugs.gnu.org; Thu, 04 Jun 2020 07:58:29 -0400 Received: from eggs.gnu.org ([209.51.188.92]:33890) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jgoVu-0000y1-EZ for 41607@debbugs.gnu.org; Thu, 04 Jun 2020 07:58:27 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]:58882) by eggs.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jgoVp-0007aK-13; Thu, 04 Jun 2020 07:58:21 -0400 Received: from [2a01:e0a:1d:7270:af76:b9b:ca24:c465] (port=45522 helo=ribbon) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1jgoVn-0001mj-Lj; Thu, 04 Jun 2020 07:58:20 -0400 From: Ludovic =?UTF-8?Q?Court=C3=A8s?= References: <20200528181043.GC23745@jasmine.lan> <20200529170820.GA30828@jasmine.lan> <20200529180245.GA3754@jasmine.lan> <20200529190942.GA8440@jasmine.lan> <87r1v0k8hl.fsf@gmail.com> X-URL: http://www.fdn.fr/~lcourtes/ X-Revolutionary-Date: 17 Prairial an 228 de la =?UTF-8?Q?R=C3=A9volution?= X-PGP-Key-ID: 0x090B11993D9AEBB5 X-PGP-Key: http://www.fdn.fr/~lcourtes/ludovic.asc X-PGP-Fingerprint: 3CE4 6455 8A84 FDC6 9DB4 0CFB 090B 1199 3D9A EBB5 X-OS: x86_64-pc-linux-gnu Date: Thu, 04 Jun 2020 13:58:17 +0200 In-Reply-To: <87r1v0k8hl.fsf@gmail.com> (Chris Marusich's message of "Sat, 30 May 2020 21:56:38 -0700") Message-ID: <87eeqvcaau.fsf@gnu.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.3 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Score: -2.3 (--) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-Spam-Score: -3.3 (---) X-BeenThere: bug-guix@gnu.org List-Id: Bug reports for GNU Guix List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: 41607@debbugs.gnu.org, Stephen Scheck Errors-To: bug-guix-bounces+larch=yhetil.org@gnu.org Sender: "bug-Guix" X-Scanner: scn0 Authentication-Results: aspmx1.migadu.com; dkim=none; dmarc=none; spf=pass (aspmx1.migadu.com: domain of bug-guix-bounces@gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=bug-guix-bounces@gnu.org X-Spam-Score: -1.01 X-TUID: dhQcGETcsIg1 Hi, Chris Marusich skribis: > The reason Guix is failing to GC dead items in the Docker container is > because those dead items are not on the "top layer", so Docker returns > an EXDEV error: > > https://docs.docker.com/storage/storagedriver/overlayfs-driver/ > > "Renaming directories: Calling rename(2) for a directory is allowed only > when both the source and the destination path are on the top > layer. Otherwise, it returns EXDEV error ('cross-device link not > permitted'). Your application needs to be designed to handle EXDEV and > fall back to a 'copy and unlink' strategy." > > You can observe this by running guix-daemon with strace in the > container, and watching what happens when you try to delete one of the > offending store items (make sure it is a directory). For example: > > 685 rename("/gnu/store/xib50iqk3w1gw9l770mad59m9bi3bcpc-manual-database= ", "/gnu/store/trash/xib50iqk3w1gw9l770mad59m9bi3bcpc-manual-database") =3D= -1 EXDEV (Invalid cross-device link) > > In most cases, when guix-daemon GC's a dead directory, it does this > (see: nix/libstore/gc.cc): > > - Create a trash directory (usually /gnu/store/trash) > - Move dead directories into the trash directory. > - Delete the trash directory. > > The trash directory is on the "top layer" because it gets created in the > running container. However, in practice many store items from lower > layers are made dead when Stephen's script runs "guix pull" and deletes > the old profiles. If any of those store items were directories, > guix-daemon will fail to GC them because of an XDEV error. If this is > confusing to you, I suggest you experiment with Docker a little bit, and > look closely at the steps that Stephen's script is running. I outlined > this in the email I accidentally deleted, but I'm a little too tired to > reproduce it all a second time. I hope you'll understand. Interesting, thanks for the analysis! > Should Guix do anything about this? We could change guix-daemon to take > correct action in the face of an XDEV error. We could also improve the > logging, since currently it silently swallows the XDEV error. I guess we could delete recursively right away upon EXDEV. It should be just two lines of code, right? > To work around the issue, Stephen can build the images from the same > base image, rather than daisy-chaining new images from old ones. That > way, they would not accumulate layers without bound. Maybe that too. Thanks, Ludo=E2=80=99.