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 6Mf8FsYG4GF9WgAAgWs5BA (envelope-from ) for ; Thu, 13 Jan 2022 12:02:30 +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 SLRoE8YG4GGsMwEAauVa8A (envelope-from ) for ; Thu, 13 Jan 2022 12:02:30 +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 057C23BD56 for ; Thu, 13 Jan 2022 12:02:29 +0100 (CET) Received: from localhost ([::1]:39520 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1n7xsB-0002yg-Bd for larch@yhetil.org; Thu, 13 Jan 2022 06:02:27 -0500 Received: from eggs.gnu.org ([209.51.188.92]:51756) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1n7xly-0005fB-He for bug-guix@gnu.org; Thu, 13 Jan 2022 05:56:02 -0500 Received: from debbugs.gnu.org ([209.51.188.43]:39167) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1n7xly-0004E3-3Q for bug-guix@gnu.org; Thu, 13 Jan 2022 05:56:02 -0500 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1n7xly-0006R9-3N for bug-guix@gnu.org; Thu, 13 Jan 2022 05:56:02 -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: Thu, 13 Jan 2022 10:56:02 +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: Ludovic =?UTF-8?Q?Court=C3=A8s?= Received: via spool by 52919-submit@debbugs.gnu.org id=B52919.164207133624681 (code B ref 52919); Thu, 13 Jan 2022 10:56:02 +0000 Received: (at 52919) by debbugs.gnu.org; 13 Jan 2022 10:55:36 +0000 Received: from localhost ([127.0.0.1]:60300 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1n7xlX-0006Q0-B0 for submit@debbugs.gnu.org; Thu, 13 Jan 2022 05:55:35 -0500 Received: from eggs.gnu.org ([209.51.188.92]:50932) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1n7xlT-0006Pf-GI for 52919@debbugs.gnu.org; Thu, 13 Jan 2022 05:55:33 -0500 Received: from [2001:470:142:3::e] (port=41450 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 1n7xlL-0003uM-S2; Thu, 13 Jan 2022 05:55:24 -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=tI2BIRT/0fbMOAja8yxXWQQ6yo0okoIDa7uDf4NgZF4=; b=ZurpOLz8xeQI6YgkHzdL XbRrVWoPqULyvVukrBBAjQ9MXVwdlRNtRs4NkmhxYXX0hkCdLBGuB8s/7eU9WsEAMeSGfSvgNBaB7 j2K4GUiXh5ktUiiMs7vRY51lHCYv7KdYKLzU5CUTEP7i9495s1haGMRhqtAIO4ENbu7esySsKTLo6 VIf4lCTEFj8txK+SCGXT/7M32xDMKe0cD3Y2VeJQhSiK/SqCQ7g73PCnz0dt/hvfKbL4mwnvyVLBl 8qjw8ynBTyGLF4EbGM1BxzMyWkm0cxYfzOuBpRFeqH8sp9DF4aIaxMfV/vmu9/iqU3YqGQ8OQZvWP ISVrmbbGJ5yIAw==; Received: from [2a01:e0a:19b:d9a0:2f3b:16f2:b776:3ef9] (port=51254 helo=meije) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1n7xlL-0002AS-Jc; Thu, 13 Jan 2022 05:55:23 -0500 From: Mathieu Othacehe References: <87pmp850ll.fsf@gnu.org> <8735m3nccu.fsf@inria.fr> <87v8yqv4dh.fsf@gnu.org> <874k68r7y2.fsf@gnu.org> Date: Thu, 13 Jan 2022 11:55:21 +0100 In-Reply-To: <874k68r7y2.fsf@gnu.org> ("Ludovic =?UTF-8?Q?Court=C3=A8s?="'s message of "Wed, 12 Jan 2022 21:54:29 +0100") Message-ID: <87sftr52hy.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=1642071749; 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=tI2BIRT/0fbMOAja8yxXWQQ6yo0okoIDa7uDf4NgZF4=; b=hYKrm1J5v+feKvLI8rCYrSs6yV5DHNRL5oRgYhek4wL2uyBi6JQ3B6GmgnZLjDN/g3/zhr BjDdmMJGt7QqCAZetTvjl2qvaSkFHWSAMWHmAR1PnT3HtVQ4zzELpuaPZM8rvIMNNWW9Qp xwIvdFvCa3pYBOCyK8TEKJ7PAcosh/6nM7myR7Fz+hEnaVW2z7P2vZoOOWE0oxL/oLJGCX IdwZgiNfJGNqo6+EQ/GpzH+3r2oteG3V5ipL8Ur9UyLO0K6oLqxPXh25+KiQDmWCOc9CV9 c45V2Zma1rHwd5/t+gwbRpIA7HacRFybm6nRtchdBZV7SLf/bR9/nj+jN/885Q== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1642071749; a=rsa-sha256; cv=none; b=oRl/quWX1FB4CnAGyYyfMvQLM9IpzpeWkQg+xeElephIHsw8qdjVbn9XWypGl72++ddP4U DwXGc+Wb7P/hEMHvHdF+C8S8bZj6JHcz6JDdgIU1hqG4yKS4KRsjxorrI0uhGv4pN3edOK dhTcU+QTduH2ELyvGK1w8utZPOqCJwyuhAJz+onHgq4h5114/HfO8sZ9hOXFyJGScONXEz wy81pW1Vt1OgQ+V4JTM3cH7lZ9TyqWi5jexeCSnTuo1m5ORu+NQf3hgfdiOlrW4YE1mWrn ALzqK1SV3X7/YlmboSjMrQi0AeGl5MMMsTXfjEAdw05WS8+0Cx01wd+H6/3Q2g== 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=ZurpOLz8; 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: -3.12 Authentication-Results: aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=gnu.org header.s=fencepost-gnu-org header.b=ZurpOLz8; 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: 057C23BD56 X-Spam-Score: -3.12 X-Migadu-Scanner: scn0.migadu.com X-TUID: QFUyM/BUZU2L --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Hey, > Hmm. Can we keep =E2=80=9Cimage=E2=80=9D persistent by default, and make= =E2=80=98vm=E2=80=99 volatile > by default? That way, =E2=80=98--volatile=E2=80=99 would only make sense= for =E2=80=98image=E2=80=99, > and =E2=80=98--persistent=E2=80=99 would only make sense for =E2=80=98vm= =E2=80=99. (So we=E2=80=99d be adding > just one option: =E2=80=98--persistent=E2=80=99.) > > WDYT? I'm not fan of adding antithetic options: --x and --no-x. There's an attached patch introducing --volatile-image and --persistent-vm options, and documenting them. It's maybe not that bad after all. > I would still ensure they have a name like =E2=80=9Cguix-image-$USER-XXX= =E2=80=9D, where > XXX is the store file basename. Sure. Thanks, Mathieu --=-=-= Content-Type: text/x-patch Content-Disposition: inline; filename=0001-scripts-system-Rationalize-persistency.patch >From b0c84a411f9f23f4f1a4155ba5efa68cac9004a2 Mon Sep 17 00:00:00 2001 From: Mathieu Othacehe Date: Thu, 13 Jan 2022 11:35:40 +0100 Subject: [PATCH 1/2] scripts: system: Rationalize persistency. Make sure that the images are created with a non volatile root by default and the vm are created with a volatile root by default. Break the --volatile option into --volatile-image and --persistent-vm options. * guix/scripts/system.scm (perform-action): Turn volatile? argument into volatile-vm-root?. (show-help): Introduce --volatile-image and --persistent-vm options instead of --volatile. (%default-options): Adapt it. (%options): Handle those options. (process-action): Honor them. * doc/guix.texi (Invoking guix system): Adapt it accordingly. --- doc/guix.texi | 15 ++++++++++----- guix/scripts/system.scm | 25 +++++++++++++++++-------- 2 files changed, 27 insertions(+), 13 deletions(-) diff --git a/doc/guix.texi b/doc/guix.texi index bc289bad7b..9f763bcfa7 100644 --- a/doc/guix.texi +++ b/doc/guix.texi @@ -35152,6 +35152,11 @@ $ $(guix system vm my-config.scm) -m 1024 -smp 2 -nic user,model=virtio-net-pci The VM shares its store with the host system. +By default, the root file system of the VM is mounted volatile; the +@option{--persistent-vm} option can be provided to make it persistent +instead. In that case, the VM disk-image file will be copied from the +store to the @env{TMPDIR} directory to make it writable. + Additional file systems can be shared between the host and the VM using the @option{--share} and @option{--expose} command-line options: the former specifies a directory to be shared with write access, while the latter @@ -35189,14 +35194,14 @@ QEMU monitor and the VM. @cindex Creating system images in various formats @item image @cindex image, creating disk images -The @code{image} command can produce various image types. The -image type can be selected using the @option{--image-type} option. It +The @code{image} command can produce various image types. The image +type can be selected using the @option{--image-type} option. It defaults to @code{efi-raw}. When its value is @code{iso9660}, the @option{--label} option can be used to specify a volume ID with @code{image}. By default, the root file system of a disk image is -mounted non-volatile; the @option{--volatile} option can be provided to -make it volatile instead. When using @code{image}, the bootloader -installed on the generated image is taken from the provided +mounted non-volatile; the @option{--volatile-image} option can be +provided to make it volatile instead. When using @code{image}, the +bootloader installed on the generated image is taken from the provided @code{operating-system} definition. The following example demonstrates how to generate an image that uses the @code{grub-efi-bootloader} bootloader and boot it with QEMU: diff --git a/guix/scripts/system.scm b/guix/scripts/system.scm index 98e788c657..3ca5592e34 100644 --- a/guix/scripts/system.scm +++ b/guix/scripts/system.scm @@ -772,7 +772,7 @@ (define* (perform-action action image dry-run? derivations-only? use-substitutes? target full-boot? - volatile? + volatile-vm-root? (graphic? #t) container-shared-network? (mappings '()) @@ -827,7 +827,8 @@ (define bootcfg (mlet* %store-monad ((sys (system-derivation-for-action image action #:full-boot? full-boot? - #:volatile? volatile? + #:volatile? + volatile-vm-root? #:graphic? graphic? #:container-shared-network? container-shared-network? #:mappings mappings)) @@ -997,7 +998,9 @@ (define (show-help) (display (G_ " --no-bootloader for 'init', do not install a bootloader")) (display (G_ " - --volatile for 'image', make the root file system volatile")) + --volatile-image for 'image', make the root file system volatile")) + (display (G_ " + --persistent-vm for 'vm', make the root file system persistent")) (display (G_ " --label=LABEL for 'image', label disk image with LABEL")) (display (G_ " @@ -1078,9 +1081,12 @@ (define %options (option '("no-bootloader" "no-grub") #f #f (lambda (opt name arg result) (alist-cons 'install-bootloader? #f result))) - (option '("volatile") #f #f + (option '("volatile-image") #f #f + (lambda (opt name arg result) + (alist-cons 'volatile-image-root? #t result))) + (option '("persistent-vm") #f #f (lambda (opt name arg result) - (alist-cons 'volatile-root? #t result))) + (alist-cons 'volatile-vm-root? #f result))) (option '("label") #t #f (lambda (opt name arg result) (alist-cons 'label arg result))) @@ -1149,7 +1155,8 @@ (define %default-options (image-size . guess) (install-bootloader? . #t) (label . #f) - (volatile-root? . #f) + (volatile-image-root? . #f) + (volatile-vm-root? . #t) (graph-backend . "graphviz"))) (define (verbosity-level opts) @@ -1219,7 +1226,8 @@ (define save-provenance? ((docker-image) docker-image-type) (else image-type))) (image-size (assoc-ref opts 'image-size)) - (volatile? (assoc-ref opts 'volatile-root?)) + (volatile? + (assoc-ref opts 'volatile-image-root?)) (shared-network? (assoc-ref opts 'container-shared-network?)) (base-image (if (operating-system? obj) @@ -1279,7 +1287,8 @@ (define (graph-backend) #:validate-reconfigure (assoc-ref opts 'validate-reconfigure) #:full-boot? (assoc-ref opts 'full-boot?) - #:volatile? (assoc-ref opts 'volatile-root?) + #:volatile-vm-root? + (assoc-ref opts 'volatile-vm-root?) #:graphic? (not (assoc-ref opts 'no-graphic?)) #:container-shared-network? (assoc-ref opts 'container-shared-network?) -- 2.34.0 --=-=-=--