From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp12.migadu.com ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms0.migadu.com with LMTPS id yPxmGlR53WEQZAAAgWs5BA (envelope-from ) for ; Tue, 11 Jan 2022 13:34:28 +0100 Received: from aspmx1.migadu.com ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp12.migadu.com with LMTPS id rFH7FlR53WEcDwAAauVa8A (envelope-from ) for ; Tue, 11 Jan 2022 13:34:28 +0100 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 015191E110 for ; Tue, 11 Jan 2022 13:34:28 +0100 (CET) Received: from localhost ([::1]:47964 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1n7GM6-0007pz-Oj for larch@yhetil.org; Tue, 11 Jan 2022 07:34:26 -0500 Received: from eggs.gnu.org ([209.51.188.92]:44134) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1n7GLi-0007od-4J for bug-guix@gnu.org; Tue, 11 Jan 2022 07:34:02 -0500 Received: from debbugs.gnu.org ([209.51.188.43]:33213) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1n7GLh-0000Wv-O3 for bug-guix@gnu.org; Tue, 11 Jan 2022 07:34:01 -0500 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1n7GLh-0002Hn-Ly for bug-guix@gnu.org; Tue, 11 Jan 2022 07:34:01 -0500 X-Loop: help-debbugs@gnu.org Subject: bug#52919: Hidden "disk-image-rw" files aren't deleted after use, filling $tmpdir Resent-From: Mathieu Othacehe Original-Sender: "Debbugs-submit" Resent-CC: bug-guix@gnu.org Resent-Date: Tue, 11 Jan 2022 12:34:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 52919 X-GNU-PR-Package: guix X-GNU-PR-Keywords: To: Leo Famulari Received: via spool by 52919-submit@debbugs.gnu.org id=B52919.16419044228759 (code B ref 52919); Tue, 11 Jan 2022 12:34:01 +0000 Received: (at 52919) by debbugs.gnu.org; 11 Jan 2022 12:33:42 +0000 Received: from localhost ([127.0.0.1]:54349 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1n7GLN-0002HC-OI for submit@debbugs.gnu.org; Tue, 11 Jan 2022 07:33:41 -0500 Received: from eggs.gnu.org ([209.51.188.92]:43286) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1n7GLL-0002Gx-4M for 52919@debbugs.gnu.org; Tue, 11 Jan 2022 07:33:40 -0500 Received: from [2001:470:142:3::e] (port=44614 helo=fencepost.gnu.org) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1n7GLE-0000Tb-QA; Tue, 11 Jan 2022 07:33:32 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-Version:In-Reply-To:Date:References:Subject:To: From; bh=eB1y8fogFzE2BTvbLCUCCk/oMa6AgmX+uCRunMAkW20=; b=DJvu9sD0rbILiSU6JPSJ 0RPM/OjPDhMNi/TYQ3+gdweykQUZCDdgSwvSgB+Ba4BWcdDeXMcM/rIle/D5NCPZnLk01WudNMta6 eH7Xt7CQq3iJFeZF4+9T9jpC11zVCJyerr6S64FlXQCXBqrgQ0T4LfacKLZnwCBIQzTXc9NtTXb9W p3MwRWNIpmk/KCglHN7Q0gqKWXzFf6KjyQL/W9I61Yeo1EvuWQSH7QUUSrDkOL0o1/sVe+jR7hQyB mUSnQvuqsaQoYGg0VlPa25SvOhskpEe3cq71AufP4WyUgm9OP+pR/KEcaSqsivsafK6kWaelinf77 R72n6ZlLDoCj6Q==; Received: from [2a01:e0a:19b:d9a0:2f3b:16f2:b776:3ef9] (port=51148 helo=meije) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1n7GLE-0006dD-MC; Tue, 11 Jan 2022 07:33:33 -0500 From: Mathieu Othacehe References: <87pmp850ll.fsf@gnu.org> <8735m3nccu.fsf@inria.fr> Date: Tue, 11 Jan 2022 13:33:30 +0100 In-Reply-To: (Leo Famulari's message of "Tue, 4 Jan 2022 12:26:48 -0500") Message-ID: <87v8yqv4dh.fsf@gnu.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.2 (gnu/linux) MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-guix@gnu.org List-Id: Bug reports for GNU Guix List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: 52919@debbugs.gnu.org Errors-To: bug-guix-bounces+larch=yhetil.org@gnu.org Sender: "bug-Guix" X-Migadu-Flow: FLOW_IN X-Migadu-Country: US ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1641904468; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type:resent-cc:resent-from:resent-sender: resent-message-id:in-reply-to:in-reply-to:references:references: list-id:list-help:list-unsubscribe:list-subscribe:list-post: dkim-signature; bh=eB1y8fogFzE2BTvbLCUCCk/oMa6AgmX+uCRunMAkW20=; b=KSY5CWGxhcF1Y51ieFZ/m4cSOnyh31BOH/q2DgRetAq2UvusrDQzR/Bc49JEcqQ1clhFCr sD6c50NODN9IC54djxBpBA42wX1xtz/hM0J8ulwD/D7b5iQNiSrAa1b2uqEUYWGimzQIpv 7n810NzqANr054C+lcJ5UIkMihF8tfU7SQ5WI5i8Q/2DGnfHoGFyeHL2B7dLCiY1/PtFRV DjetGbwN23jBvtoceEMQwzhKG3wBpIXLvPVHOsjfQ9kNLF00ijSQcxWNxIjqdm8HI7rtHT jjcR9O7h9nZR53z7J4AthMbQjCFTSNS84Zk/qHZqB3XvFcbOKZKCKkyrcl92pw== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1641904468; a=rsa-sha256; cv=none; b=B7pzH51YRKSA9FlAHKxFbaCXZzs2mIdukyVLIFkGfDxjqyCDbbg8+AadiTdXpI4eUeW19v xkGQJ3oCHhnRGOdCdWPVyWb7ssuob4xg4FBk1XJ9hoqxdTN9ZSPn8sH8KVal8i2f8xwB7C kEcPvLPxIMNGKABw/jGhXexkw9w/yzoxSB2VVPQl2iUHHs11SgxjuyAT2lfd/mwejzlk0I Kb37QjfW3+UriWzI1rUBrAxzAy4f0QwYdmhf18/Q3tcGiGla4BfS7sm/yUop/I1hjLyRez Cjw4+2Nl17ThEDcVeluJ/mJaYEdyofb4/oesZMWXSHzTnRsdRa2zID8KuWCrcw== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=gnu.org header.s=fencepost-gnu-org header.b=DJvu9sD0; dmarc=pass (policy=none) header.from=gnu.org; spf=pass (aspmx1.migadu.com: domain of "bug-guix-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="bug-guix-bounces+larch=yhetil.org@gnu.org" X-Migadu-Spam-Score: -2.81 Authentication-Results: aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=gnu.org header.s=fencepost-gnu-org header.b=DJvu9sD0; dmarc=pass (policy=none) header.from=gnu.org; spf=pass (aspmx1.migadu.com: domain of "bug-guix-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="bug-guix-bounces+larch=yhetil.org@gnu.org" X-Migadu-Queue-Id: 015191E110 X-Spam-Score: -2.81 X-Migadu-Scanner: scn1.migadu.com X-TUID: emt24X/glDxS --=-=-= Content-Type: text/plain Hey, Here is a patch to store the rw images in the cache directory. Regarding the volatile flag, things are a little more complex than what I thought initially. The "guix system" help menu states that: --8<---------------cut here---------------start------------->8--- --volatile for 'image', make the root file system volatile --8<---------------cut here---------------end--------------->8--- because for an image, it often makes sense to have the root file system persistent. For the 'vm' command however, it's probably the other way around as we would prefer not to copy the huge image files if possible. I feel like creating a '--volatile-image' and a '--persistent-vm' option is going to make things too much complex. WDYT? Thanks, Mathieu --=-=-= Content-Type: text/x-patch Content-Disposition: inline; filename=0001-system-vm-Do-not-store-rw-image-in-the-tmp-directory.patch >From e4efaf2ffc6d7c699f9d1c41744cfff89be65c12 Mon Sep 17 00:00:00 2001 From: Mathieu Othacehe Date: Tue, 11 Jan 2022 13:27:35 +0100 Subject: [PATCH 1/1] system: vm: Do not store rw image in the /tmp directory. * gnu/system/vm.scm (system-qemu-image/shared-store-script): Store them in the cache directory instead. --- gnu/system/vm.scm | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/gnu/system/vm.scm b/gnu/system/vm.scm index 0fc9fb57f4..bd21f9416c 100644 --- a/gnu/system/vm.scm +++ b/gnu/system/vm.scm @@ -283,7 +283,9 @@ (define kernel-arguments #+@(operating-system-kernel-arguments os "/dev/vda1"))) (define rw-image - #~(format #f "/tmp/.~a-rw" (basename #$base-image))) + #~(format #f "~a/~a-rw" + #$(string-append (cache-directory) "/images") + (basename #$base-image))) (define qemu-exec #~(list #+(file-append qemu "/bin/" @@ -310,10 +312,15 @@ (define builder #+(file-append bash "/bin/sh")) (when (not #$volatile?) (format port "~a~%" - #$(program-file "copy-image" - #~(unless (file-exists? #$rw-image) - (copy-file #$base-image #$rw-image) - (chmod #$rw-image #o640))))) + #$(program-file + "copy-image" + (with-imported-modules '((guix build utils)) + #~(begin + (use-modules (guix build utils)) + (unless (file-exists? #$rw-image) + (mkdir-p (dirname #$rw-image)) + (copy-file #$base-image #$rw-image) + (chmod #$rw-image #o640))))))) (format port "exec ~a \"$@\"~%" (string-join #$qemu-exec " ")) (chmod port #o555)))) -- 2.34.0 --=-=-=--